From c2f86f4fccc7ab9747a850881b17cbd098c72383 Mon Sep 17 00:00:00 2001 From: Magnus Dahl Eide Date: Sun, 31 Aug 2025 17:36:12 +0200 Subject: [PATCH 1/3] chore(e2e): Add e2e-local action to check workflow fix order refactor check workflow order fs-dev-nextMode for experimental refactor env variable --- .github/actions/lint/action.yml | 4 -- .github/actions/local/build/action.yml | 9 +++++ .github/actions/local/e2e/action.yml | 39 +++++++++++++++++++ .github/actions/setup-playwright/action.yml | 22 +++++++++++ .../actions/{pnpm-setup => setup}/action.yml | 19 +++++---- .github/workflows/check.yml | 7 +++- .github/workflows/e2e.yml | 19 ++------- .github/workflows/pre-release.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/v2-release.yml | 2 +- examples/app-pages-router/package.json | 2 +- examples/app-router/package.json | 3 +- .../experimental/open-next.config.local.ts | 24 ++++++++++++ examples/experimental/package.json | 5 ++- examples/pages-router/package.json | 1 + pnpm-lock.yaml | 9 +++-- 16 files changed, 131 insertions(+), 38 deletions(-) create mode 100644 .github/actions/local/build/action.yml create mode 100644 .github/actions/local/e2e/action.yml create mode 100644 .github/actions/setup-playwright/action.yml rename .github/actions/{pnpm-setup => setup}/action.yml (75%) create mode 100644 examples/experimental/open-next.config.local.ts diff --git a/.github/actions/lint/action.yml b/.github/actions/lint/action.yml index df4aeeebc..4e4acea86 100644 --- a/.github/actions/lint/action.yml +++ b/.github/actions/lint/action.yml @@ -4,10 +4,6 @@ description: Run biome to lint codebase and ensure code quality runs: using: "composite" steps: - - name: Install dependencies - run: pnpm install - shell: bash - - name: Setup Biome CLI uses: biomejs/setup-biome@v2.2.1 diff --git a/.github/actions/local/build/action.yml b/.github/actions/local/build/action.yml new file mode 100644 index 000000000..01e6e3324 --- /dev/null +++ b/.github/actions/local/build/action.yml @@ -0,0 +1,9 @@ +name: Install dependencies & build OpenNext package +description: Installs dependencies and builds OpenNext +runs: + using: 'composite' + steps: + # Build only the @opennextjs/aws package + its monorepo dependencies + - name: Build + shell: bash + run: pnpm --filter @opennextjs/aws... run build \ No newline at end of file diff --git a/.github/actions/local/e2e/action.yml b/.github/actions/local/e2e/action.yml new file mode 100644 index 000000000..240b211f2 --- /dev/null +++ b/.github/actions/local/e2e/action.yml @@ -0,0 +1,39 @@ +name: E2E Local +description: Runs E2E tests locally with development overrides +runs: + using: 'composite' + steps: + - name: Setup Playwright + uses: ./.github/actions/setup-playwright + + - name: Build examples apps with local configuration + shell: bash + run: pnpm -r openbuild:local + + # Remember to add more ports here if we add new examples app + # We filter out app-router cause we wanna set OPEN_NEXT_REQUEST_ID_HEADER=true there + - name: Start the local OpenNext servers + shell: bash + run: | + pnpm -r openbuild:local:start & + for port in 3001 3002 3003 3004; do + echo "Checking port $port..." + for attempt in {1..20}; do + sleep 0.5 + if curl --silent --fail http://localhost:$port > /dev/null; then + echo "Server on $port is ready" + break + fi + if [ $attempt -eq 20 ]; then + echo "Server on $port failed to start" + exit 1 + fi + echo "Waiting for server on $port, attempt $attempt..." + done + done + - name: Run E2E Test locally + shell: bash + run: | + pnpm e2e:test + + ## Do we want to report to Discord? \ No newline at end of file diff --git a/.github/actions/setup-playwright/action.yml b/.github/actions/setup-playwright/action.yml new file mode 100644 index 000000000..53907778b --- /dev/null +++ b/.github/actions/setup-playwright/action.yml @@ -0,0 +1,22 @@ +name: 'Setup Playwright' +description: 'Setup Playwright with caching' + +runs: + using: 'composite' + steps: + - name: Put $HOME in env + if: runner.os == 'windows' + shell: pwsh + run: echo "HOME=$HOME" | Out-File -FilePath $env:GITHUB_ENV -Append + + - name: Cache Playwright + id: playwright-cache + uses: actions/cache@v4 + with: + path: ${{ runner.os == 'Windows' && format('{0}{1}', env.HOME, '\AppData\Local\ms-playwright') || runner.os == 'Linux' && '~/.cache/ms-playwright' || '~/Library/Caches/ms-playwright' }} + key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} + + - name: Install Playwright with dependencies + if: steps.playwright-cache.outputs.cache-hit != 'true' + shell: bash + run: pnpm exec playwright install chromium --with-deps \ No newline at end of file diff --git a/.github/actions/pnpm-setup/action.yml b/.github/actions/setup/action.yml similarity index 75% rename from .github/actions/pnpm-setup/action.yml rename to .github/actions/setup/action.yml index 2355da8ef..b400265fb 100644 --- a/.github/actions/pnpm-setup/action.yml +++ b/.github/actions/setup/action.yml @@ -1,21 +1,22 @@ -name: Install & setup pnpm +name: Install & setup description: Install's node, pnpm, restores cache runs: using: 'composite' steps: - # Install nodejs. https://github.com/actions/setup-node - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 18.x - # Install pnpm. https://github.com/pnpm/action-setup - uses: pnpm/action-setup@v4 with: version: 9 # run_install: false + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20.19.4 + cache: "pnpm" + registry-url: "https://registry.npmjs.org" + # Get pnpm store path so we can cache it - name: Get pnpm store directory shell: bash @@ -29,3 +30,7 @@ runs: key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install + shell: bash \ No newline at end of file diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 735c3f9ee..b1b39666d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - main + # workflow_dispatch: jobs: validate: @@ -14,6 +15,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - uses: ./.github/actions/pnpm-setup + - uses: ./.github/actions/setup - uses: ./.github/actions/lint - - uses: ./.github/actions/test \ No newline at end of file + - uses: ./.github/actions/test + - uses: ./.github/actions/local/build + - uses: ./.github/actions/local/e2e \ No newline at end of file diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index d903a6025..b4699dd77 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -113,22 +113,9 @@ jobs: run: pnpm add next@${{ needs.check_next_version.outputs.previousNextVersion }} # We do not install the latest canary of Next in the experimental app. - - name: Get Playwright version - id: playwright-version - run: echo "version=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//' | sed 's/ .*//' )" - - - name: Cache Playwright - uses: actions/cache@v4 - id: playwright-cache - with: - path: "~/.cache/ms-playwright" - key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }} - restore-keys: | - ${{ runner.os }}-playwright- - - - name: Install Playwright - if: steps.playwright-cache.outputs.cache-hit != 'true' - run: pnpm exec playwright install chromium --with-deps + # Setup playwright + - name: Setup Playwright + uses: ./.github/actions/setup-playwright # Cache turbo runs - name: Cache Turbo diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 96a56d054..37fbfe949 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -24,7 +24,7 @@ jobs: with: registry-url: "https://registry.npmjs.org" - - uses: ./.github/actions/pnpm-setup + - uses: ./.github/actions/setup - name: Install dependencies run: pnpm install diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1a754d32..53980ac0c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: # https://github.com/actions/checkout uses: actions/checkout@v4 - - uses: ./.github/actions/pnpm-setup + - uses: ./.github/actions/setup - uses: ./.github/actions/lint - name: Create Release Pull Request or Publish to npm diff --git a/.github/workflows/v2-release.yml b/.github/workflows/v2-release.yml index a26e52811..d6490ff9b 100644 --- a/.github/workflows/v2-release.yml +++ b/.github/workflows/v2-release.yml @@ -16,7 +16,7 @@ jobs: with: registry-url: "https://registry.npmjs.org" - - uses: ./.github/actions/pnpm-setup + - uses: ./.github/actions/setup - name: Install dependencies run: pnpm install diff --git a/examples/app-pages-router/package.json b/examples/app-pages-router/package.json index 4e56ab601..b3a67087b 100644 --- a/examples/app-pages-router/package.json +++ b/examples/app-pages-router/package.json @@ -5,7 +5,7 @@ "scripts": { "openbuild": "node ../../packages/open-next/dist/index.js build --build-command \"npx turbo build\"", "openbuild:local": "node ../../packages/open-next/dist/index.js build --config-path open-next.config.local.ts", - "openbuild:local:start": "tsx proxy.ts", + "openbuild:local:start": "PORT=3003 tsx proxy.ts", "dev": "next dev --turbopack --port 3003", "build": "next build", "start": "next start --port 3003", diff --git a/examples/app-router/package.json b/examples/app-router/package.json index c7f322557..7bf1f51e7 100644 --- a/examples/app-router/package.json +++ b/examples/app-router/package.json @@ -5,6 +5,7 @@ "scripts": { "openbuild": "node ../../packages/open-next/dist/index.js build", "openbuild:local": "node ../../packages/open-next/dist/index.js build --config-path open-next.config.local.ts", + "openbuild:local:start": "PORT=3001 OPEN_NEXT_REQUEST_ID_HEADER=true node .open-next/server-functions/default/index.mjs", "dev": "next dev --turbopack --port 3001", "build": "next build", "start": "next start --port 3001", @@ -13,12 +14,12 @@ }, "dependencies": { "@example/shared": "workspace:*", - "@opennextjs/aws": "workspace:*", "next": "catalog:", "react": "catalog:", "react-dom": "catalog:" }, "devDependencies": { + "@opennextjs/aws": "workspace:*", "@types/node": "catalog:", "@types/react": "catalog:", "@types/react-dom": "catalog:", diff --git a/examples/experimental/open-next.config.local.ts b/examples/experimental/open-next.config.local.ts new file mode 100644 index 000000000..63d80481e --- /dev/null +++ b/examples/experimental/open-next.config.local.ts @@ -0,0 +1,24 @@ +import type { OpenNextConfig } from "@opennextjs/aws/types/open-next.js"; + +export default { + default: { + override: { + wrapper: "express-dev", + converter: "node", + incrementalCache: "fs-dev", + queue: "direct", + tagCache: "fs-dev-nextMode", + }, + }, + + imageOptimization: { + override: { + wrapper: "dummy", + converter: "dummy", + }, + loader: "fs-dev", + }, + + // You can override the build command here so that you don't have to rebuild next every time you make a change + //buildCommand: "echo 'No build command'", +} satisfies OpenNextConfig; diff --git a/examples/experimental/package.json b/examples/experimental/package.json index a40ac8ff7..8b1cd833e 100644 --- a/examples/experimental/package.json +++ b/examples/experimental/package.json @@ -4,6 +4,8 @@ "private": true, "scripts": { "openbuild": "node ../../packages/open-next/dist/index.js build", + "openbuild:local": "node ../../packages/open-next/dist/index.js build --config-path open-next.config.local.ts", + "openbuild:local:start": "PORT=3004 node .open-next/server-functions/default/index.mjs", "dev": "next dev --turbopack --port 3004", "build": "next build", "start": "next start --port 3004", @@ -19,6 +21,7 @@ "@types/node": "catalog:", "@types/react": "catalog:", "@types/react-dom": "catalog:", - "typescript": "catalog:" + "typescript": "catalog:", + "@opennextjs/aws": "workspace:*" } } diff --git a/examples/pages-router/package.json b/examples/pages-router/package.json index d289cd616..58201fbb6 100644 --- a/examples/pages-router/package.json +++ b/examples/pages-router/package.json @@ -5,6 +5,7 @@ "scripts": { "openbuild": "node ../../packages/open-next/dist/index.js build --build-command \"npx turbo build\"", "openbuild:local": "node ../../packages/open-next/dist/index.js build --config-path open-next.config.local.ts", + "openbuild:local:start": "PORT=3002 node .open-next/server-functions/default/index.mjs", "dev": "next dev --turbopack --port 3002", "build": "next build", "start": "next start --port 3002", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dbd70b37a..a27a3bb17 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -114,9 +114,6 @@ importers: '@example/shared': specifier: workspace:* version: link:../shared - '@opennextjs/aws': - specifier: workspace:* - version: link:../../packages/open-next next: specifier: 'catalog:' version: 15.4.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0) @@ -127,6 +124,9 @@ importers: specifier: 'catalog:' version: 19.0.0(react@19.0.0) devDependencies: + '@opennextjs/aws': + specifier: workspace:* + version: link:../../packages/open-next '@types/node': specifier: 'catalog:' version: 20.17.6 @@ -161,6 +161,9 @@ importers: specifier: 'catalog:' version: 19.0.0(react@19.0.0) devDependencies: + '@opennextjs/aws': + specifier: workspace:* + version: link:../../packages/open-next '@types/node': specifier: 'catalog:' version: 20.17.6 From 0b069096416a5fc95bcada920ecf0a14a2dcb62d Mon Sep 17 00:00:00 2001 From: Magnus Dahl Eide Date: Sun, 31 Aug 2025 22:01:55 +0200 Subject: [PATCH 2/3] rm comment --- .github/actions/local/e2e/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/local/e2e/action.yml b/.github/actions/local/e2e/action.yml index 240b211f2..6f54461e3 100644 --- a/.github/actions/local/e2e/action.yml +++ b/.github/actions/local/e2e/action.yml @@ -11,7 +11,6 @@ runs: run: pnpm -r openbuild:local # Remember to add more ports here if we add new examples app - # We filter out app-router cause we wanna set OPEN_NEXT_REQUEST_ID_HEADER=true there - name: Start the local OpenNext servers shell: bash run: | From 1cda2e7d575d95f2acac6792bbd4e294514ef45e Mon Sep 17 00:00:00 2001 From: Magnus Dahl Eide Date: Mon, 1 Sep 2025 09:57:36 +0200 Subject: [PATCH 3/3] refactor descriptions --- .github/actions/local/build/action.yml | 2 +- .github/actions/setup/action.yml | 2 +- .github/workflows/check.yml | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/actions/local/build/action.yml b/.github/actions/local/build/action.yml index 01e6e3324..2ce18f8c9 100644 --- a/.github/actions/local/build/action.yml +++ b/.github/actions/local/build/action.yml @@ -1,4 +1,4 @@ -name: Install dependencies & build OpenNext package +name: Build OpenNext package description: Installs dependencies and builds OpenNext runs: using: 'composite' diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index b400265fb..02a394fe4 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -1,5 +1,5 @@ name: Install & setup -description: Install's node, pnpm, restores cache +description: Install's node, pnpm, restores cache, and then installs dependencies runs: using: 'composite' diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b1b39666d..8d262636c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -4,7 +4,6 @@ on: pull_request: branches: - main - # workflow_dispatch: jobs: validate: @@ -15,8 +14,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - uses: ./.github/actions/setup - uses: ./.github/actions/lint + - uses: ./.github/actions/setup - uses: ./.github/actions/test - uses: ./.github/actions/local/build - uses: ./.github/actions/local/e2e \ No newline at end of file