Skip to content

Commit 21147c6

Browse files
committed
Merge remote-tracking branch 'origin/main' into wip-adapter-full
2 parents 7cdda4f + 381fbb6 commit 21147c6

File tree

153 files changed

+15321
-12582
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+15321
-12582
lines changed

.github/workflows/run-tests.yml

Lines changed: 92 additions & 87 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:
@@ -28,15 +28,22 @@ jobs:
2828
repo: context.repo.repo,
2929
issue_number: context.payload.pull_request.number,
3030
});
31-
return labels.some(label => label.name === 'autorelease: pending' || label.name === 'test all versions');
31+
const shouldTestAllVersions = labels.some(label => label.name === 'autorelease: pending' || label.name === 'test all versions');
32+
if (shouldTestAllVersions) {
33+
return 'all'
34+
}
35+
36+
return labels.some(label => label.name === 'test latest and canary') ? 'latest-and-canary' : 'latest'
3237
- name: Set Next.js versions to test
3338
id: set-matrix
3439
# If this is the nightly build or a release PR then run the full matrix of versions
3540
run: |
3641
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
3742
echo "matrix=${{ github.event.inputs.versions }}" >> $GITHUB_OUTPUT
38-
elif [ "${{ github.event_name }}" = "schedule" ] || [ "${{ steps.check-labels.outputs.result }}" = "true" ]; then
43+
elif [ "${{ github.event_name }}" = "schedule" ] || [ "${{ steps.check-labels.outputs.result }}" = "all" ]; then
3944
echo "matrix=[\"latest\", \"canary\", \"14.2.15\", \"13.5.1\"]" >> $GITHUB_OUTPUT
45+
elif [ "${{ steps.check-labels.outputs.result }}" = "latest-and-canary" ]; then
46+
echo "matrix=[\"latest\", \"canary\"]" >> $GITHUB_OUTPUT
4047
else
4148
echo "matrix=[\"canary\"]" >> $GITHUB_OUTPUT
4249
fi
@@ -52,25 +59,30 @@ jobs:
5259

5360
steps:
5461
- 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'"
5569
- name: Decide Node Version
5670
id: decide-node-version
5771
shell: bash
5872
run: |
5973
NODE_VERSION=18.x
60-
if [ "${{ matrix.version}}" = "canary" ]; then
61-
# this is not ideal, because we set node@20 just when explicitly using canary tag as target
62-
# but next@canary are still on 15 major, so we can't yet use major version of resolved next version
63-
# as condition
74+
if [[ "${{ steps.resolve-next-version.outputs.version }}" == "16."* ]]; then
75+
# Next@16 requires Node.js 20+
6476
NODE_VERSION=20.x
6577
fi
6678
echo "version=$NODE_VERSION" >> $GITHUB_OUTPUT
67-
echo "Node version for 'next@${{ matrix.version }}' is '$NODE_VERSION'"
68-
- name: 'Install Node'
79+
echo "Node version for 'next@${{ steps.resolve-next-version.outputs.version }}' is '$NODE_VERSION'"
80+
- name: "Install Node"
6981
uses: actions/setup-node@v5
7082
with:
7183
node-version: ${{ steps.decide-node-version.outputs.version }}
72-
cache: 'npm'
73-
cache-dependency-path: '**/package-lock.json'
84+
cache: "npm"
85+
cache-dependency-path: "**/package-lock.json"
7486
- uses: oven-sh/setup-bun@v2
7587
- name: setup pnpm/yarn
7688
run: |
@@ -82,9 +94,9 @@ jobs:
8294
with:
8395
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20
8496
deno-version: v2.2.4
85-
- name: 'Install dependencies'
97+
- name: "Install dependencies"
8698
run: npm ci
87-
- name: 'Prepare Netlify CLI'
99+
- name: "Prepare Netlify CLI"
88100
env:
89101
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
90102
run: |
@@ -97,26 +109,20 @@ jobs:
97109
- uses: actions/cache@v4
98110
id: playwright-cache
99111
with:
100-
path: '~/.cache/ms-playwright'
101-
key: '${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}'
112+
path: "~/.cache/ms-playwright"
113+
key: "${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}"
102114
restore-keys: |
103115
${{ runner.os }}-playwright-
104116
- name: Install Playwright Browsers
105117
if: steps.playwright-cache.outputs.cache-hit != 'true'
106118
run: npx playwright install --with-deps
107-
- name: Resolve Next.js version
108-
id: resolve-next-version
109-
shell: bash
110-
run: |
111-
RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version)
112-
echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT
113-
echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'"
114119
- name: Run Playwright tests
115120
run: npm run test:ci:e2e -- --shard=${{ matrix.shard }}/5
116121
env:
117122
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
118123
NEXT_VERSION: ${{ matrix.version }}
119124
NEXT_RESOLVED_VERSION: ${{ steps.resolve-next-version.outputs.version }}
125+
NODE_OPTIONS: --import ${{ github.workspace }}/tools/fetch-retry.mjs
120126
- name: Upload blob report to GitHub Actions Artifacts
121127
uses: actions/upload-artifact@v4
122128
if: always()
@@ -135,31 +141,36 @@ jobs:
135141
version: ${{ fromJson(needs.setup.outputs.matrix) }}
136142
exclude:
137143
- os: windows-2025
138-
version: '13.5.1'
144+
version: "13.5.1"
139145
- os: windows-2025
140-
version: '14.2.15'
146+
version: "14.2.15"
141147
runs-on: ${{ matrix.os }}
142148
steps:
143149
- 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'"
144157
- name: Decide Node Version
145158
id: decide-node-version
146159
shell: bash
147160
run: |
148161
NODE_VERSION=18.x
149-
if [ "${{ matrix.version}}" = "canary" ]; then
150-
# this is not ideal, because we set node@20 just when explicitly using canary tag as target
151-
# but next@canary are still on 15 major, so we can't yet use major version of resolved next version
152-
# as condition
162+
if [[ "${{ steps.resolve-next-version.outputs.version }}" == "16."* ]]; then
163+
# Next@16 requires Node.js 20+
153164
NODE_VERSION=20.x
154165
fi
155166
echo "version=$NODE_VERSION" >> $GITHUB_OUTPUT
156167
echo "Node version for 'next@${{ matrix.version }}' is '$NODE_VERSION'"
157-
- name: 'Install Node'
168+
- name: "Install Node"
158169
uses: actions/setup-node@v5
159170
with:
160171
node-version: ${{ steps.decide-node-version.outputs.version }}
161-
cache: 'npm'
162-
cache-dependency-path: '**/package-lock.json'
172+
cache: "npm"
173+
cache-dependency-path: "**/package-lock.json"
163174
- name: Prefer npm global on windows
164175
if: runner.os == 'Windows'
165176
# On Windows by default PATH prefers corepack bundled with Node.js
@@ -178,19 +189,12 @@ jobs:
178189
with:
179190
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/edge-bundler/blob/e55f825bd985d3c92e21d1b765d71e70d5628fba/node/bridge.ts#L17
180191
deno-version: v2.2.4
181-
- name: 'Install dependencies'
192+
- name: "Install dependencies"
182193
run: npm ci
183-
- name: 'Build'
194+
- name: "Build"
184195
run: npm run build
185-
- name: 'Vendor deno helpers for integration tests'
196+
- name: "Vendor deno helpers for integration tests"
186197
run: node tools/vendor-deno-tools.js
187-
- name: Resolve Next.js version
188-
id: resolve-next-version
189-
shell: bash
190-
run: |
191-
RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version)
192-
echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT
193-
echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'"
194198
- name: Compute Fixtures Cache Key
195199
id: fixture-cache-key
196200
# Fixtures only need to be rebuilt if either fixture or support files change,
@@ -207,19 +211,21 @@ jobs:
207211
key:
208212
integration-fixtures-${{ runner.os }}-${{steps.resolve-next-version.outputs.version}}-${{
209213
steps.fixture-cache-key.outputs.key }}
210-
- name: 'Prepare Fixtures'
214+
- name: "Prepare Fixtures"
211215
if: steps.cache-fixtures.outputs.cache-hit != 'true'
212216
run: npm run pretest
213217
env:
214218
NEXT_VERSION: ${{ matrix.version }}
215219
NEXT_RESOLVED_VERSION: ${{ steps.resolve-next-version.outputs.version }}
216-
- name: 'Unit and integration tests'
220+
NODE_OPTIONS: --import ${{ github.workspace }}/tools/fetch-retry.mjs
221+
- name: "Unit and integration tests"
217222
run: npm run test:ci:unit-and-integration -- --shard=${{ matrix.shard }}/8
218223
env:
219224
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
220225
NEXT_VERSION: ${{ matrix.version }}
221226
NEXT_RESOLVED_VERSION: ${{ steps.resolve-next-version.outputs.version }}
222227
TEMP: ${{ github.workspace }}/..
228+
NODE_OPTIONS: --import ${{ github.workspace }}/tools/fetch-retry.mjs
223229

224230
smoke:
225231
if: always()
@@ -231,25 +237,30 @@ jobs:
231237
version: ${{ fromJson(needs.setup.outputs.matrix) }}
232238
steps:
233239
- 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'"
234247
- name: Decide Node Version
235248
id: decide-node-version
236249
shell: bash
237250
run: |
238251
NODE_VERSION=18.x
239-
if [ "${{ matrix.version}}" = "canary" ]; then
240-
# this is not ideal, because we set node@20 just when explicitly using canary tag as target
241-
# but next@canary are still on 15 major, so we can't yet use major version of resolved next version
242-
# as condition
252+
if [[ "${{ steps.resolve-next-version.outputs.version }}" == "16."* ]]; then
253+
# Next@16 requires Node.js 20+
243254
NODE_VERSION=20.x
244255
fi
245256
echo "version=$NODE_VERSION" >> $GITHUB_OUTPUT
246257
echo "Node version for 'next@${{ matrix.version }}' is '$NODE_VERSION'"
247-
- name: 'Install Node'
258+
- name: "Install Node"
248259
uses: actions/setup-node@v5
249260
with:
250261
node-version: ${{ steps.decide-node-version.outputs.version }}
251-
cache: 'npm'
252-
cache-dependency-path: '**/package-lock.json'
262+
cache: "npm"
263+
cache-dependency-path: "**/package-lock.json"
253264
- name: setup pnpm/yarn
254265
run: corepack enable
255266
shell: bash
@@ -258,63 +269,57 @@ jobs:
258269
with:
259270
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20
260271
deno-version: v2.2.4
261-
- name: 'Install dependencies'
272+
- name: "Install dependencies"
262273
run: npm ci
263-
- name: 'Build'
274+
- name: "Build"
264275
run: npm run build
265-
- name: 'Prepare Netlify CLI'
276+
- name: "Prepare Netlify CLI"
266277
env:
267278
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
268279
run: |
269280
# Control netlify-cli as a regular dev dep but expose it globally for test fixtures to use
270281
npm install -g "netlify-cli@$(npm list --json --depth=0 netlify-cli | jq -r ".dependencies[\"netlify-cli\"].version")"
271282
npx netlify login
272-
- name: Resolve Next.js version
273-
id: resolve-next-version
274-
shell: bash
275-
run: |
276-
RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version)
277-
echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT
278-
echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'"
279-
- name: 'Smoke tests'
283+
- name: "Smoke tests"
280284
run: npm run test:ci:smoke
281285
env:
282286
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
283287
NEXT_VERSION: ${{ matrix.version }}
284288
NEXT_RESOLVED_VERSION: ${{ steps.resolve-next-version.outputs.version }}
289+
NODE_OPTIONS: --import ${{ github.workspace }}/tools/fetch-retry.mjs
285290

286291
merge-reports:
287292
if: always()
288-
needs: [setup,e2e]
293+
needs: [setup, e2e]
289294
strategy:
290295
fail-fast: false
291296
matrix:
292297
version: ${{ fromJson(needs.setup.outputs.matrix) }}
293298

294299
runs-on: ubuntu-latest
295300
steps:
296-
- uses: actions/checkout@v5
297-
- uses: actions/setup-node@v5
298-
with:
299-
node-version: 18
300-
- name: Install dependencies
301-
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
302307

303-
- name: Download blob reports from GitHub Actions Artifacts
304-
uses: actions/download-artifact@v5
305-
with:
306-
path: all-blob-reports
307-
pattern: blob-report-${{ matrix.version }}-*
308-
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
309314

310-
- name: Merge reports
311-
run: |
312-
npx playwright merge-reports --reporter html ./all-blob-reports
313-
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
314319
315-
- name: Upload HTML report
316-
uses: actions/upload-artifact@v4
317-
with:
318-
name: html-report-${{ matrix.version }}-attempt-${{ github.run_attempt }}
319-
path: playwright-report
320-
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

0 commit comments

Comments
 (0)