Skip to content

Commit 33ada05

Browse files
authored
ci: adjustments after next@16 stable release (#3195)
1 parent 9245ae4 commit 33ada05

File tree

4 files changed

+89
-101
lines changed

4 files changed

+89
-101
lines changed

.github/workflows/run-tests.yml

Lines changed: 79 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
name: 'Run tests'
1+
name: "Run tests"
22
on:
33
pull_request:
44
branches: [main]
55
schedule:
6-
- cron: '0 6 * * *' # Run every day at 6am UTC
6+
- cron: "0 6 * * *" # Run every day at 6am UTC
77
workflow_dispatch:
88
inputs:
99
versions:
10-
description: 'The versions of Next.js to test against (quoted and comma separated)'
10+
description: "The versions of Next.js to test against (quoted and comma separated)"
1111
required: false
12-
default: 'latest'
12+
default: "latest"
1313

1414
jobs:
1515
setup:
@@ -59,25 +59,30 @@ jobs:
5959

6060
steps:
6161
- uses: actions/checkout@v5
62+
- name: Resolve Next.js version
63+
id: resolve-next-version
64+
shell: bash
65+
run: |
66+
RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version)
67+
echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT
68+
echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'"
6269
- name: Decide Node Version
6370
id: decide-node-version
6471
shell: bash
6572
run: |
6673
NODE_VERSION=18.x
67-
if [ "${{ matrix.version}}" = "canary" ]; then
68-
# this is not ideal, because we set node@20 just when explicitly using canary tag as target
69-
# but next@canary are still on 15 major, so we can't yet use major version of resolved next version
70-
# as condition
74+
if [[ "${{ steps.resolve-next-version.outputs.version }}" == "16."* ]]; then
75+
# Next@16 requires Node.js 20+
7176
NODE_VERSION=20.x
7277
fi
7378
echo "version=$NODE_VERSION" >> $GITHUB_OUTPUT
74-
echo "Node version for 'next@${{ matrix.version }}' is '$NODE_VERSION'"
75-
- name: 'Install Node'
79+
echo "Node version for 'next@${{ steps.resolve-next-version.outputs.version }}' is '$NODE_VERSION'"
80+
- name: "Install Node"
7681
uses: actions/setup-node@v5
7782
with:
7883
node-version: ${{ steps.decide-node-version.outputs.version }}
79-
cache: 'npm'
80-
cache-dependency-path: '**/package-lock.json'
84+
cache: "npm"
85+
cache-dependency-path: "**/package-lock.json"
8186
- uses: oven-sh/setup-bun@v2
8287
- name: setup pnpm/yarn
8388
run: |
@@ -89,9 +94,9 @@ jobs:
8994
with:
9095
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20
9196
deno-version: v2.2.4
92-
- name: 'Install dependencies'
97+
- name: "Install dependencies"
9398
run: npm ci
94-
- name: 'Prepare Netlify CLI'
99+
- name: "Prepare Netlify CLI"
95100
env:
96101
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
97102
run: |
@@ -104,20 +109,13 @@ jobs:
104109
- uses: actions/cache@v4
105110
id: playwright-cache
106111
with:
107-
path: '~/.cache/ms-playwright'
108-
key: '${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}'
112+
path: "~/.cache/ms-playwright"
113+
key: "${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}"
109114
restore-keys: |
110115
${{ runner.os }}-playwright-
111116
- name: Install Playwright Browsers
112117
if: steps.playwright-cache.outputs.cache-hit != 'true'
113118
run: npx playwright install --with-deps
114-
- name: Resolve Next.js version
115-
id: resolve-next-version
116-
shell: bash
117-
run: |
118-
RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version)
119-
echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT
120-
echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'"
121119
- name: Run Playwright tests
122120
run: npm run test:ci:e2e -- --shard=${{ matrix.shard }}/5
123121
env:
@@ -143,31 +141,36 @@ jobs:
143141
version: ${{ fromJson(needs.setup.outputs.matrix) }}
144142
exclude:
145143
- os: windows-2025
146-
version: '13.5.1'
144+
version: "13.5.1"
147145
- os: windows-2025
148-
version: '14.2.15'
146+
version: "14.2.15"
149147
runs-on: ${{ matrix.os }}
150148
steps:
151149
- uses: actions/checkout@v5
150+
- name: Resolve Next.js version
151+
id: resolve-next-version
152+
shell: bash
153+
run: |
154+
RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version)
155+
echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT
156+
echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'"
152157
- name: Decide Node Version
153158
id: decide-node-version
154159
shell: bash
155160
run: |
156161
NODE_VERSION=18.x
157-
if [ "${{ matrix.version}}" = "canary" ]; then
158-
# this is not ideal, because we set node@20 just when explicitly using canary tag as target
159-
# but next@canary are still on 15 major, so we can't yet use major version of resolved next version
160-
# as condition
162+
if [[ "${{ steps.resolve-next-version.outputs.version }}" == "16."* ]]; then
163+
# Next@16 requires Node.js 20+
161164
NODE_VERSION=20.x
162165
fi
163166
echo "version=$NODE_VERSION" >> $GITHUB_OUTPUT
164167
echo "Node version for 'next@${{ matrix.version }}' is '$NODE_VERSION'"
165-
- name: 'Install Node'
168+
- name: "Install Node"
166169
uses: actions/setup-node@v5
167170
with:
168171
node-version: ${{ steps.decide-node-version.outputs.version }}
169-
cache: 'npm'
170-
cache-dependency-path: '**/package-lock.json'
172+
cache: "npm"
173+
cache-dependency-path: "**/package-lock.json"
171174
- name: Prefer npm global on windows
172175
if: runner.os == 'Windows'
173176
# On Windows by default PATH prefers corepack bundled with Node.js
@@ -186,19 +189,12 @@ jobs:
186189
with:
187190
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/edge-bundler/blob/e55f825bd985d3c92e21d1b765d71e70d5628fba/node/bridge.ts#L17
188191
deno-version: v2.2.4
189-
- name: 'Install dependencies'
192+
- name: "Install dependencies"
190193
run: npm ci
191-
- name: 'Build'
194+
- name: "Build"
192195
run: npm run build
193-
- name: 'Vendor deno helpers for integration tests'
196+
- name: "Vendor deno helpers for integration tests"
194197
run: node tools/vendor-deno-tools.js
195-
- name: Resolve Next.js version
196-
id: resolve-next-version
197-
shell: bash
198-
run: |
199-
RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version)
200-
echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT
201-
echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'"
202198
- name: Compute Fixtures Cache Key
203199
id: fixture-cache-key
204200
# Fixtures only need to be rebuilt if either fixture or support files change,
@@ -215,14 +211,14 @@ jobs:
215211
key:
216212
integration-fixtures-${{ runner.os }}-${{steps.resolve-next-version.outputs.version}}-${{
217213
steps.fixture-cache-key.outputs.key }}
218-
- name: 'Prepare Fixtures'
214+
- name: "Prepare Fixtures"
219215
if: steps.cache-fixtures.outputs.cache-hit != 'true'
220216
run: npm run pretest
221217
env:
222218
NEXT_VERSION: ${{ matrix.version }}
223219
NEXT_RESOLVED_VERSION: ${{ steps.resolve-next-version.outputs.version }}
224220
NODE_OPTIONS: --import ${{ github.workspace }}/tools/fetch-retry.mjs
225-
- name: 'Unit and integration tests'
221+
- name: "Unit and integration tests"
226222
run: npm run test:ci:unit-and-integration -- --shard=${{ matrix.shard }}/8
227223
env:
228224
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -241,25 +237,30 @@ jobs:
241237
version: ${{ fromJson(needs.setup.outputs.matrix) }}
242238
steps:
243239
- uses: actions/checkout@v5
240+
- name: Resolve Next.js version
241+
id: resolve-next-version
242+
shell: bash
243+
run: |
244+
RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version)
245+
echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT
246+
echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'"
244247
- name: Decide Node Version
245248
id: decide-node-version
246249
shell: bash
247250
run: |
248251
NODE_VERSION=18.x
249-
if [ "${{ matrix.version}}" = "canary" ]; then
250-
# this is not ideal, because we set node@20 just when explicitly using canary tag as target
251-
# but next@canary are still on 15 major, so we can't yet use major version of resolved next version
252-
# as condition
252+
if [[ "${{ steps.resolve-next-version.outputs.version }}" == "16."* ]]; then
253+
# Next@16 requires Node.js 20+
253254
NODE_VERSION=20.x
254255
fi
255256
echo "version=$NODE_VERSION" >> $GITHUB_OUTPUT
256257
echo "Node version for 'next@${{ matrix.version }}' is '$NODE_VERSION'"
257-
- name: 'Install Node'
258+
- name: "Install Node"
258259
uses: actions/setup-node@v5
259260
with:
260261
node-version: ${{ steps.decide-node-version.outputs.version }}
261-
cache: 'npm'
262-
cache-dependency-path: '**/package-lock.json'
262+
cache: "npm"
263+
cache-dependency-path: "**/package-lock.json"
263264
- name: setup pnpm/yarn
264265
run: corepack enable
265266
shell: bash
@@ -268,25 +269,18 @@ jobs:
268269
with:
269270
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20
270271
deno-version: v2.2.4
271-
- name: 'Install dependencies'
272+
- name: "Install dependencies"
272273
run: npm ci
273-
- name: 'Build'
274+
- name: "Build"
274275
run: npm run build
275-
- name: 'Prepare Netlify CLI'
276+
- name: "Prepare Netlify CLI"
276277
env:
277278
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
278279
run: |
279280
# Control netlify-cli as a regular dev dep but expose it globally for test fixtures to use
280281
npm install -g "netlify-cli@$(npm list --json --depth=0 netlify-cli | jq -r ".dependencies[\"netlify-cli\"].version")"
281282
npx netlify login
282-
- name: Resolve Next.js version
283-
id: resolve-next-version
284-
shell: bash
285-
run: |
286-
RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version)
287-
echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT
288-
echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'"
289-
- name: 'Smoke tests'
283+
- name: "Smoke tests"
290284
run: npm run test:ci:smoke
291285
env:
292286
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -296,36 +290,36 @@ jobs:
296290

297291
merge-reports:
298292
if: always()
299-
needs: [setup,e2e]
293+
needs: [setup, e2e]
300294
strategy:
301295
fail-fast: false
302296
matrix:
303297
version: ${{ fromJson(needs.setup.outputs.matrix) }}
304298

305299
runs-on: ubuntu-latest
306300
steps:
307-
- uses: actions/checkout@v5
308-
- uses: actions/setup-node@v5
309-
with:
310-
node-version: 18
311-
- name: Install dependencies
312-
run: npm ci
301+
- uses: actions/checkout@v5
302+
- uses: actions/setup-node@v5
303+
with:
304+
node-version: 18
305+
- name: Install dependencies
306+
run: npm ci
313307

314-
- name: Download blob reports from GitHub Actions Artifacts
315-
uses: actions/download-artifact@v5
316-
with:
317-
path: all-blob-reports
318-
pattern: blob-report-${{ matrix.version }}-*
319-
merge-multiple: true
308+
- name: Download blob reports from GitHub Actions Artifacts
309+
uses: actions/download-artifact@v5
310+
with:
311+
path: all-blob-reports
312+
pattern: blob-report-${{ matrix.version }}-*
313+
merge-multiple: true
320314

321-
- name: Merge reports
322-
run: |
323-
npx playwright merge-reports --reporter html ./all-blob-reports
324-
npx playwright merge-reports --reporter json ./all-blob-reports > merged_reports.json
315+
- name: Merge reports
316+
run: |
317+
npx playwright merge-reports --reporter html ./all-blob-reports
318+
npx playwright merge-reports --reporter json ./all-blob-reports > merged_reports.json
325319
326-
- name: Upload HTML report
327-
uses: actions/upload-artifact@v4
328-
with:
329-
name: html-report-${{ matrix.version }}-attempt-${{ github.run_attempt }}
330-
path: playwright-report
331-
retention-days: 14
320+
- name: Upload HTML report
321+
uses: actions/upload-artifact@v4
322+
with:
323+
name: html-report-${{ matrix.version }}-attempt-${{ github.run_attempt }}
324+
path: playwright-report
325+
retention-days: 14

.github/workflows/test-e2e.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,12 @@ jobs:
114114
shell: bash
115115
run: |
116116
NODE_VERSION=18.x
117-
if [ "${{ matrix.version_spec.selector }}" = "canary" ]; then
118-
# this is not ideal, because we set node@20 just when explicitly using canary tag as target
119-
# but next@canary are still on 15 major, so we can't yet use major version of resolved next version
120-
# as condition
117+
if [[ "${{ matrix.version_spec.version }}" == "16."* ]]; then
118+
# Next@16 requires Node.js 20+
121119
NODE_VERSION=20.x
122120
fi
123121
echo "version=$NODE_VERSION" >> $GITHUB_OUTPUT
124-
echo "Node version for 'next@${{ matrix.version_spec.selector }}' is '$NODE_VERSION'"
122+
echo "Node version for 'next@${{ matrix.version_spec.version }}' is '$NODE_VERSION'"
125123
126124
- name: Decide default bundler
127125
id: decide-default-bundler
@@ -132,14 +130,12 @@ jobs:
132130
# so we need to set IS_WEBPACK_TEST, IS_TURBOPACK_TEST env vars accordingly
133131
# to ensure tests assert behavior of the default bundler
134132
DEFAULT_BUNDLER="webpack"
135-
if [ "${{ matrix.version_spec.selector }}" = "canary" ]; then
136-
# this is not ideal, because we set turbopack default just when explicitly using canary tag as target
137-
# but next@canary are still on 15 major, so we can't yet use major version of resolved next version
138-
# as condition
133+
if [[ "${{ matrix.version_spec.version }}" == "16."* ]]; then
134+
# Next@16 defaults to Turbopack
139135
DEFAULT_BUNDLER="turbopack"
140136
fi
141137
echo "default_bundler=$DEFAULT_BUNDLER" >> $GITHUB_OUTPUT
142-
echo "Default bundler for 'next@${{ matrix.version_spec.selector }}' is '$DEFAULT_BUNDLER'"
138+
echo "Default bundler for 'next@${{ matrix.version_spec.version }}' is '$DEFAULT_BUNDLER'"
143139
144140
- name: setup node
145141
uses: actions/setup-node@v5

tests/fixtures/proxy-i18n-skip-normalize/proxy.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,3 @@ export async function proxy(request: NextRequest) {
1616
return response
1717
}
1818
}
19-
20-
export const config = {
21-
runtime: 'nodejs',
22-
}

tests/utils/next-version-helpers.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ export function shouldHaveAppRouterNotFoundInPrerenderManifest() {
4141
export function shouldHaveAppRouterGlobalErrorInPrerenderManifest() {
4242
// https://github.com/vercel/next.js/pull/82444
4343

44-
// this is not used in any stable version yet
45-
return isNextCanary() && nextVersionSatisfies('>=15.5.1-canary.4')
44+
return (
45+
(isNextCanary() && nextVersionSatisfies('>=15.5.1-canary.4')) ||
46+
nextVersionSatisfies('>=16.0.0')
47+
)
4648
}
4749

4850
export function hasNodeMiddlewareSupport() {

0 commit comments

Comments
 (0)