Skip to content

Commit 22ce8ea

Browse files
ijjkztanner
authored andcommitted
Update CI config for Windows runner (#74850)
As discussed this replaces our Azure pipelines handling with our own runners instead. This allows us to build the `next-swc` binary to run tests against for Windows when necessary instead of trying to leverage the canary binary which requires any relevant changes to have been published which can cause us to miss Windows specific failures until after a canary is published. This also has the benefit of us being able to consolidate our CI config for Windows/Linux for better consistency. Since running workloads on Windows is slower still this just starts with copying over the tests we had configured previously although we can look at adding more we see useful for catching regressions.
1 parent 2bd6588 commit 22ce8ea

File tree

3 files changed

+109
-194
lines changed

3 files changed

+109
-194
lines changed

.github/workflows/build_and_test.yml

+96-2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ jobs:
7171
stepName: 'build-native'
7272
secrets: inherit
7373

74+
build-native-windows:
75+
name: build-native-windows
76+
uses: ./.github/workflows/build_reusable.yml
77+
with:
78+
skipInstallBuild: 'yes'
79+
stepName: 'build-native-windows'
80+
runs_on_labels: '["windows","self-hosted","x64"]'
81+
buildNativeTarget: 'x86_64-pc-windows-msvc'
82+
83+
secrets: inherit
84+
7485
build-next:
7586
name: build-next
7687
uses: ./.github/workflows/build_reusable.yml
@@ -200,8 +211,6 @@ jobs:
200211
name: test devlow package
201212
needs: ['optimize-ci', 'changes']
202213
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}
203-
strategy:
204-
fail-fast: false
205214
uses: ./.github/workflows/build_reusable.yml
206215
with:
207216
stepName: 'test-devlow'
@@ -335,6 +344,26 @@ jobs:
335344

336345
secrets: inherit
337346

347+
test-unit-windows:
348+
name: test unit windows
349+
needs: ['changes', 'build-native', 'build-native-windows']
350+
if: ${{ needs.changes.outputs.docs-only == 'false' }}
351+
352+
strategy:
353+
fail-fast: false
354+
matrix:
355+
node: [18, 20] # TODO: use env var like [env.NODE_MAINTENANCE_VERSION, env.NODE_LTS_VERSION]
356+
357+
uses: ./.github/workflows/build_reusable.yml
358+
with:
359+
nodeVersion: ${{ matrix.node }}
360+
afterBuild: node run-tests.js -c ${TEST_CONCURRENCY} --type unit
361+
stepName: 'test-unit-windows-${{ matrix.node }}'
362+
runs_on_labels: '["windows","self-hosted","x64"]'
363+
buildNativeTarget: 'x86_64-pc-windows-msvc'
364+
365+
secrets: inherit
366+
338367
test-new-tests-dev:
339368
name: Test new tests for flakes (dev)
340369
needs: ['optimize-ci', 'changes', 'build-native', 'build-next']
@@ -407,6 +436,67 @@ jobs:
407436
stepName: 'test-dev-react-${{ matrix.react }}-${{ matrix.group }}'
408437
secrets: inherit
409438

439+
test-dev-windows:
440+
name: test dev windows
441+
needs:
442+
[
443+
'optimize-ci',
444+
'changes',
445+
'build-native-windows',
446+
'build-native',
447+
'build-next',
448+
]
449+
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}
450+
451+
uses: ./.github/workflows/build_reusable.yml
452+
with:
453+
afterBuild: NEXT_TEST_MODE=dev node run-tests.js -c ${TEST_CONCURRENCY} test/e2e/app-dir/app/index.test.ts test/e2e/app-dir/app-edge/app-edge.test.ts
454+
stepName: 'test-dev-windows'
455+
runs_on_labels: '["windows","self-hosted","x64"]'
456+
buildNativeTarget: 'x86_64-pc-windows-msvc'
457+
secrets: inherit
458+
459+
test-integration-windows:
460+
name: test integration windows
461+
needs:
462+
[
463+
'optimize-ci',
464+
'changes',
465+
'build-native-windows',
466+
'build-native',
467+
'build-next',
468+
]
469+
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}
470+
471+
uses: ./.github/workflows/build_reusable.yml
472+
with:
473+
nodeVersion: 18.18.2
474+
afterBuild: node run-tests.js -c 4 test/production/pages-dir/production/test/index.test.ts test/integration/css-client-nav/test/index.test.js test/integration/rewrites-has-condition/test/index.test.js test/integration/create-next-app/index.test.ts test/integration/create-next-app/package-manager/pnpm.test.ts
475+
stepName: 'test-integration-windows'
476+
runs_on_labels: '["windows","self-hosted","x64"]'
477+
buildNativeTarget: 'x86_64-pc-windows-msvc'
478+
secrets: inherit
479+
480+
test-prod-windows:
481+
name: test prod windows
482+
needs:
483+
[
484+
'optimize-ci',
485+
'changes',
486+
'build-native-windows',
487+
'build-native',
488+
'build-next',
489+
]
490+
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}
491+
492+
uses: ./.github/workflows/build_reusable.yml
493+
with:
494+
afterBuild: NEXT_TEST_MODE=start node run-tests.js test/e2e/app-dir/app/index.test.ts test/e2e/app-dir/app-edge/app-edge.test.ts
495+
stepName: 'test-prod-windows'
496+
runs_on_labels: '["windows","self-hosted","x64"]'
497+
buildNativeTarget: 'x86_64-pc-windows-msvc'
498+
secrets: inherit
499+
410500
test-prod:
411501
name: test prod
412502
needs: ['optimize-ci', 'changes', 'build-native', 'build-next']
@@ -587,6 +677,10 @@ jobs:
587677
'test-new-tests-deploy',
588678
'test-turbopack-production',
589679
'test-turbopack-production-integration',
680+
'test-unit-windows',
681+
'test-dev-windows',
682+
'test-integration-windows',
683+
'test-prod-windows',
590684
]
591685

592686
if: always()

.github/workflows/build_reusable.yml

+13-8
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ on:
6464
required: false
6565
type: string
6666
default: '["self-hosted", "linux", "x64", "metal"]'
67+
buildNativeTarget:
68+
description: 'Target for build-native step'
69+
required: false
70+
type: string
71+
default: 'x86_64-unknown-linux-gnu'
6772

6873
env:
6974
NAPI_CLI_VERSION: 2.14.7
@@ -91,6 +96,10 @@ jobs:
9196
timeout-minutes: ${{ inputs.timeout_minutes }}
9297
runs-on: ${{ fromJson(inputs.runs_on_labels) }}
9398

99+
defaults:
100+
run:
101+
shell: bash -leo pipefail {0}
102+
94103
outputs:
95104
input_step_key: ${{ steps.var.outputs.input_step_key }}
96105

@@ -102,12 +111,8 @@ jobs:
102111
script: |
103112
core.setOutput('input_step_key', '${{ inputs.stepName }}'.toLowerCase().replaceAll(/[/.]/g, '-').trim('-'));
104113
105-
- name: Setup Node.js
106-
uses: actions/setup-node@v4
107-
with:
108-
node-version: ${{ inputs.nodeVersion || env.NODE_LTS_VERSION }}
109-
check-latest: true
110-
114+
- run: fnm use --install-if-missing ${{ inputs.nodeVersion || env.NODE_LTS_VERSION }}
115+
- run: fnm default ${{ inputs.nodeVersion || env.NODE_LTS_VERSION }}
111116
- run: node -v
112117
- run: corepack enable
113118
- run: pwd
@@ -145,7 +150,7 @@ jobs:
145150
with:
146151
cache-provider: 'turbo'
147152
save-if: ${{ github.ref_name == 'canary' }}
148-
shared-key: ${{ inputs.rustCacheKey }}-x86_64-unknown-linux-gnu-build-${{ hashFiles('.cargo/config.toml') }}
153+
shared-key: ${{ inputs.rustCacheKey }}-${{ inputs.buildNativeTarget }}-build-${{ hashFiles('.cargo/config.toml') }}
149154

150155
# clean up any previous artifacts to avoid hitting disk space limits
151156
- run: git clean -xdf && rm -rf /tmp/next-repo-*; rm -rf /tmp/next-install-* /tmp/yarn-* /tmp/ncc-cache target
@@ -163,7 +168,7 @@ jobs:
163168
- run: node scripts/normalize-version-bump.js
164169
name: normalize versions
165170

166-
- run: turbo run build-native-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target x86_64-unknown-linux-gnu
171+
- run: turbo run build-native-release -v --env-mode loose --remote-cache-timeout 90 --summarize -- --target ${{ inputs.buildNativeTarget }}
167172
if: ${{ inputs.skipNativeBuild != 'yes' }}
168173

169174
- name: Upload next-swc artifact

azure-pipelines.yml

-184
This file was deleted.

0 commit comments

Comments
 (0)