Skip to content

Commit

Permalink
Update CI config for Windows runner (#74850)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ijjk authored Jan 14, 2025
1 parent 87bd4ec commit 2261bd3
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 194 deletions.
98 changes: 96 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ jobs:
stepName: 'build-native'
secrets: inherit

build-native-windows:
name: build-native-windows
uses: ./.github/workflows/build_reusable.yml
with:
skipInstallBuild: 'yes'
stepName: 'build-native-windows'
runs_on_labels: '["windows","self-hosted","x64"]'
buildNativeTarget: 'x86_64-pc-windows-msvc'

secrets: inherit

build-next:
name: build-next
uses: ./.github/workflows/build_reusable.yml
Expand Down Expand Up @@ -201,8 +212,6 @@ jobs:
name: test devlow package
needs: ['optimize-ci', 'changes']
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}
strategy:
fail-fast: false
uses: ./.github/workflows/build_reusable.yml
with:
stepName: 'test-devlow'
Expand Down Expand Up @@ -336,6 +345,26 @@ jobs:

secrets: inherit

test-unit-windows:
name: test unit windows
needs: ['changes', 'build-native', 'build-native-windows']
if: ${{ needs.changes.outputs.docs-only == 'false' }}

strategy:
fail-fast: false
matrix:
node: [18, 20] # TODO: use env var like [env.NODE_MAINTENANCE_VERSION, env.NODE_LTS_VERSION]

uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: ${{ matrix.node }}
afterBuild: node run-tests.js -c ${TEST_CONCURRENCY} --type unit
stepName: 'test-unit-windows-${{ matrix.node }}'
runs_on_labels: '["windows","self-hosted","x64"]'
buildNativeTarget: 'x86_64-pc-windows-msvc'

secrets: inherit

test-new-tests-dev:
name: Test new tests for flakes (dev)
needs: ['optimize-ci', 'changes', 'build-native', 'build-next']
Expand Down Expand Up @@ -408,6 +437,67 @@ jobs:
stepName: 'test-dev-react-${{ matrix.react }}-${{ matrix.group }}'
secrets: inherit

test-dev-windows:
name: test dev windows
needs:
[
'optimize-ci',
'changes',
'build-native-windows',
'build-native',
'build-next',
]
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}

uses: ./.github/workflows/build_reusable.yml
with:
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
stepName: 'test-dev-windows'
runs_on_labels: '["windows","self-hosted","x64"]'
buildNativeTarget: 'x86_64-pc-windows-msvc'
secrets: inherit

test-integration-windows:
name: test integration windows
needs:
[
'optimize-ci',
'changes',
'build-native-windows',
'build-native',
'build-next',
]
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}

uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 18.18.2
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
stepName: 'test-integration-windows'
runs_on_labels: '["windows","self-hosted","x64"]'
buildNativeTarget: 'x86_64-pc-windows-msvc'
secrets: inherit

test-prod-windows:
name: test prod windows
needs:
[
'optimize-ci',
'changes',
'build-native-windows',
'build-native',
'build-next',
]
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}

uses: ./.github/workflows/build_reusable.yml
with:
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
stepName: 'test-prod-windows'
runs_on_labels: '["windows","self-hosted","x64"]'
buildNativeTarget: 'x86_64-pc-windows-msvc'
secrets: inherit

test-prod:
name: test prod
needs: ['optimize-ci', 'changes', 'build-native', 'build-next']
Expand Down Expand Up @@ -589,6 +679,10 @@ jobs:
'test-new-tests-deploy',
'test-turbopack-production',
'test-turbopack-production-integration',
'test-unit-windows',
'test-dev-windows',
'test-integration-windows',
'test-prod-windows',
]

if: always()
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/build_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ on:
required: false
type: string
default: '["self-hosted", "linux", "x64", "metal"]'
buildNativeTarget:
description: 'Target for build-native step'
required: false
type: string
default: 'x86_64-unknown-linux-gnu'

env:
NAPI_CLI_VERSION: 2.14.7
Expand Down Expand Up @@ -92,6 +97,10 @@ jobs:
timeout-minutes: ${{ inputs.timeout_minutes }}
runs-on: ${{ fromJson(inputs.runs_on_labels) }}

defaults:
run:
shell: bash -leo pipefail {0}

outputs:
input_step_key: ${{ steps.var.outputs.input_step_key }}

Expand All @@ -103,12 +112,8 @@ jobs:
script: |
core.setOutput('input_step_key', '${{ inputs.stepName }}'.toLowerCase().replaceAll(/[/.]/g, '-').trim('-'));
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodeVersion || env.NODE_LTS_VERSION }}
check-latest: true

- run: fnm use --install-if-missing ${{ inputs.nodeVersion || env.NODE_LTS_VERSION }}
- run: fnm default ${{ inputs.nodeVersion || env.NODE_LTS_VERSION }}
- run: node -v
- run: corepack enable
- run: pwd
Expand Down Expand Up @@ -146,7 +151,7 @@ jobs:
with:
cache-provider: 'turbo'
save-if: ${{ github.ref_name == 'canary' }}
shared-key: ${{ inputs.rustCacheKey }}-x86_64-unknown-linux-gnu-build-${{ hashFiles('.cargo/config.toml') }}
shared-key: ${{ inputs.rustCacheKey }}-${{ inputs.buildNativeTarget }}-build-${{ hashFiles('.cargo/config.toml') }}

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

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

- name: Upload next-swc artifact
Expand Down
184 changes: 0 additions & 184 deletions azure-pipelines.yml

This file was deleted.

0 comments on commit 2261bd3

Please sign in to comment.