Skip to content

Commit cacbce2

Browse files
committed
cleanup
1 parent 1bec12c commit cacbce2

File tree

4 files changed

+60
-88
lines changed

4 files changed

+60
-88
lines changed

.github/workflows/run-tests.yml

Lines changed: 51 additions & 58 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:
@@ -65,12 +65,12 @@ jobs:
6565
fi
6666
echo "version=$NODE_VERSION" >> $GITHUB_OUTPUT
6767
echo "Node version for 'next@${{ matrix.version }}' is '$NODE_VERSION'"
68-
- name: "Install Node"
68+
- name: 'Install Node'
6969
uses: actions/setup-node@v5
7070
with:
7171
node-version: ${{ steps.decide-node-version.outputs.version }}
72-
cache: "npm"
73-
cache-dependency-path: "**/package-lock.json"
72+
cache: 'npm'
73+
cache-dependency-path: '**/package-lock.json'
7474
- uses: oven-sh/setup-bun@v2
7575
- name: setup pnpm/yarn
7676
run: |
@@ -82,9 +82,9 @@ jobs:
8282
with:
8383
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20
8484
deno-version: v2.2.4
85-
- name: "Install dependencies"
85+
- name: 'Install dependencies'
8686
run: npm ci
87-
- name: "Prepare Netlify CLI"
87+
- name: 'Prepare Netlify CLI'
8888
env:
8989
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
9090
run: |
@@ -97,8 +97,8 @@ jobs:
9797
- uses: actions/cache@v4
9898
id: playwright-cache
9999
with:
100-
path: "~/.cache/ms-playwright"
101-
key: "${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}"
100+
path: '~/.cache/ms-playwright'
101+
key: '${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}'
102102
restore-keys: |
103103
${{ runner.os }}-playwright-
104104
- name: Install Playwright Browsers
@@ -124,13 +124,6 @@ jobs:
124124
name: blob-report-${{matrix.version}}-${{ matrix.shard }}
125125
path: blob-report
126126
retention-days: 1
127-
- name: Upload debug artifacts
128-
uses: actions/upload-artifact@v4
129-
if: always()
130-
with:
131-
name: debug-artifacts-${{matrix.version}}-${{ matrix.shard }}
132-
path: debug-artifacts
133-
retention-days: 1
134127

135128
test:
136129
needs: setup
@@ -142,9 +135,9 @@ jobs:
142135
version: ${{ fromJson(needs.setup.outputs.matrix) }}
143136
exclude:
144137
- os: windows-2025
145-
version: "13.5.1"
138+
version: '13.5.1'
146139
- os: windows-2025
147-
version: "14.2.15"
140+
version: '14.2.15'
148141
runs-on: ${{ matrix.os }}
149142
steps:
150143
- uses: actions/checkout@v5
@@ -161,12 +154,12 @@ jobs:
161154
fi
162155
echo "version=$NODE_VERSION" >> $GITHUB_OUTPUT
163156
echo "Node version for 'next@${{ matrix.version }}' is '$NODE_VERSION'"
164-
- name: "Install Node"
157+
- name: 'Install Node'
165158
uses: actions/setup-node@v5
166159
with:
167160
node-version: ${{ steps.decide-node-version.outputs.version }}
168-
cache: "npm"
169-
cache-dependency-path: "**/package-lock.json"
161+
cache: 'npm'
162+
cache-dependency-path: '**/package-lock.json'
170163
- name: Prefer npm global on windows
171164
if: runner.os == 'Windows'
172165
# On Windows by default PATH prefers corepack bundled with Node.js
@@ -185,11 +178,11 @@ jobs:
185178
with:
186179
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/edge-bundler/blob/e55f825bd985d3c92e21d1b765d71e70d5628fba/node/bridge.ts#L17
187180
deno-version: v2.2.4
188-
- name: "Install dependencies"
181+
- name: 'Install dependencies'
189182
run: npm ci
190-
- name: "Build"
183+
- name: 'Build'
191184
run: npm run build
192-
- name: "Vendor deno helpers for integration tests"
185+
- name: 'Vendor deno helpers for integration tests'
193186
run: node tools/vendor-deno-tools.js
194187
- name: Resolve Next.js version
195188
id: resolve-next-version
@@ -214,13 +207,13 @@ jobs:
214207
key:
215208
integration-fixtures-${{ runner.os }}-${{steps.resolve-next-version.outputs.version}}-${{
216209
steps.fixture-cache-key.outputs.key }}
217-
- name: "Prepare Fixtures"
210+
- name: 'Prepare Fixtures'
218211
if: steps.cache-fixtures.outputs.cache-hit != 'true'
219212
run: npm run pretest
220213
env:
221214
NEXT_VERSION: ${{ matrix.version }}
222215
NEXT_RESOLVED_VERSION: ${{ steps.resolve-next-version.outputs.version }}
223-
- name: "Unit and integration tests"
216+
- name: 'Unit and integration tests'
224217
run: npm run test:ci:unit-and-integration -- --shard=${{ matrix.shard }}/8
225218
env:
226219
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -251,12 +244,12 @@ jobs:
251244
fi
252245
echo "version=$NODE_VERSION" >> $GITHUB_OUTPUT
253246
echo "Node version for 'next@${{ matrix.version }}' is '$NODE_VERSION'"
254-
- name: "Install Node"
247+
- name: 'Install Node'
255248
uses: actions/setup-node@v5
256249
with:
257250
node-version: ${{ steps.decide-node-version.outputs.version }}
258-
cache: "npm"
259-
cache-dependency-path: "**/package-lock.json"
251+
cache: 'npm'
252+
cache-dependency-path: '**/package-lock.json'
260253
- name: setup pnpm/yarn
261254
run: corepack enable
262255
shell: bash
@@ -265,11 +258,11 @@ jobs:
265258
with:
266259
# Should match the `DENO_VERSION_RANGE` from https://github.com/netlify/build/blob/main/packages/edge-bundler/node/bridge.ts#L20
267260
deno-version: v2.2.4
268-
- name: "Install dependencies"
261+
- name: 'Install dependencies'
269262
run: npm ci
270-
- name: "Build"
263+
- name: 'Build'
271264
run: npm run build
272-
- name: "Prepare Netlify CLI"
265+
- name: 'Prepare Netlify CLI'
273266
env:
274267
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
275268
run: |
@@ -283,7 +276,7 @@ jobs:
283276
RESOLVED_VERSION=$(npm view next@${{ matrix.version }} version)
284277
echo "version=$RESOLVED_VERSION" >> $GITHUB_OUTPUT
285278
echo "Resolved Next.js version for 'next@${{ matrix.version }}' is '$RESOLVED_VERSION'"
286-
- name: "Smoke tests"
279+
- name: 'Smoke tests'
287280
run: npm run test:ci:smoke
288281
env:
289282
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
@@ -292,36 +285,36 @@ jobs:
292285

293286
merge-reports:
294287
if: always()
295-
needs: [setup, e2e]
288+
needs: [setup,e2e]
296289
strategy:
297290
fail-fast: false
298291
matrix:
299292
version: ${{ fromJson(needs.setup.outputs.matrix) }}
300293

301294
runs-on: ubuntu-latest
302295
steps:
303-
- uses: actions/checkout@v5
304-
- uses: actions/setup-node@v5
305-
with:
306-
node-version: 18
307-
- name: Install dependencies
308-
run: npm ci
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
309302

310-
- name: Download blob reports from GitHub Actions Artifacts
311-
uses: actions/download-artifact@v5
312-
with:
313-
path: all-blob-reports
314-
pattern: blob-report-${{ matrix.version }}-*
315-
merge-multiple: true
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
316309

317-
- name: Merge reports
318-
run: |
319-
npx playwright merge-reports --reporter html ./all-blob-reports
320-
npx playwright merge-reports --reporter json ./all-blob-reports > merged_reports.json
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
321314
322-
- name: Upload HTML report
323-
uses: actions/upload-artifact@v4
324-
with:
325-
name: html-report-${{ matrix.version }}-attempt-${{ github.run_attempt }}
326-
path: playwright-report
327-
retention-days: 14
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

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default defineConfig({
1010
/* Fail the build on CI if you accidentally left test.only in the source code. */
1111
forbidOnly: Boolean(process.env.CI),
1212
/* Retry on CI only */
13-
retries: process.env.CI ? 0 : 0,
13+
retries: process.env.CI ? 2 : 0,
1414
/* Limit the number of workers on CI, use default locally */
1515
workers: process.env.CI ? 3 : undefined,
1616
globalSetup: './tests/test-setup-e2e.ts',

tests/fixtures/middleware/next.config.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ const nextConfig = {
2323
// without turbopack configuration, so we add a turbopack configuration here to ensure this fixture
2424
// works with default build bundler for all tested versions
2525
// see https://github.com/vercel/next.js/blob/ba5a0ca79944b4c8a59d80d677bfedaf0fef33d6/packages/next/src/lib/turbopack-warning.ts#L159-L177
26-
turbopack: {
27-
// there need to be some keys here, as empty object despite currently being suggesting is not actually allowing build to go through
28-
// so we'll set root (which serves same purpose as outputFileTracingRoot more generally)
29-
root: __dirname,
30-
},
26+
turbopack: {},
3127
outputFileTracingRoot: __dirname,
3228
}
3329

tests/utils/create-e2e-fixture.ts

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import { execaCommand } from 'execa'
22
import fg from 'fast-glob'
33
import { exec } from 'node:child_process'
44
import { existsSync } from 'node:fs'
5-
import { appendFile, copyFile, cp, mkdir, mkdtemp, readFile, rm } from 'node:fs/promises'
5+
import { appendFile, copyFile, mkdir, mkdtemp, readFile, rm } from 'node:fs/promises'
66
import { tmpdir } from 'node:os'
7-
import { basename, dirname, join } from 'node:path'
7+
import { dirname, join } from 'node:path'
88
import process from 'node:process'
99
import { fileURLToPath } from 'node:url'
1010
import { cpus } from 'os'
@@ -69,9 +69,9 @@ export const createE2EFixture = async (fixture: string, config: E2EConfig = {})
6969
}
7070
console.log('\n\n\n🪵 Deploy logs:')
7171
console.log(logs)
72-
// on failures locally we don't delete the deploy
72+
// on failures we don't delete the deploy, but we do cleanup the fixture from filesystem in CI
7373
if (process.env.CI) {
74-
return cleanup(isolatedFixtureRoot, deployID)
74+
return cleanup(isolatedFixtureRoot, undefined)
7575
}
7676
}
7777
try {
@@ -277,24 +277,7 @@ async function deploySite(
277277
}
278278

279279
const siteDir = join(isolatedFixtureRoot, cwd)
280-
try {
281-
await execaCommand(cmd, { cwd: siteDir, all: true }).pipeAll?.(join(siteDir, outputFile))
282-
} catch (error: unknown) {
283-
// try to collect zips if they exist
284-
const functionsPath = join(isolatedFixtureRoot, packagePath ?? '', '.netlify/functions')
285-
const zipPaths = await fg.glob('**/*.zip', {
286-
cwd: functionsPath,
287-
dot: true,
288-
})
289-
if (zipPaths.length) {
290-
const debugDir = join('debug-artifacts', isolatedFixtureRoot)
291-
await mkdir(debugDir, { recursive: true })
292-
for (const path of zipPaths) {
293-
await cp(join(functionsPath, path), join(debugDir, basename(path)))
294-
}
295-
}
296-
throw error
297-
}
280+
await execaCommand(cmd, { cwd: siteDir, all: true }).pipeAll?.(join(siteDir, outputFile))
298281
const output = await readFile(join(siteDir, outputFile), 'utf-8')
299282

300283
const { siteName, deployID } =
@@ -413,13 +396,13 @@ export const fixtureFactories = {
413396
nxIntegrated: () =>
414397
createE2EFixture('nx-integrated', {
415398
packagePath: 'apps/next-app',
416-
buildCommand: 'nx run next-app:build --verbose',
399+
buildCommand: 'nx run next-app:build',
417400
publishDirectory: 'dist/apps/next-app/.next',
418401
}),
419402
nxIntegratedDistDir: () =>
420403
createE2EFixture('nx-integrated', {
421404
packagePath: 'apps/custom-dist-dir',
422-
buildCommand: 'nx run custom-dist-dir:build --verbose',
405+
buildCommand: 'nx run custom-dist-dir:build',
423406
publishDirectory: 'dist/apps/custom-dist-dir/dist',
424407
}),
425408
cliBeforeRegionalBlobsSupport: () =>

0 commit comments

Comments
 (0)