Commit 22ce8eae authored by JJ Kasper's avatar JJ Kasper Committed by Zack Tanner

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.
parent 2bd65884
...@@ -71,6 +71,17 @@ jobs: ...@@ -71,6 +71,17 @@ jobs:
stepName: 'build-native' stepName: 'build-native'
secrets: inherit 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: build-next:
name: build-next name: build-next
uses: ./.github/workflows/build_reusable.yml uses: ./.github/workflows/build_reusable.yml
...@@ -200,8 +211,6 @@ jobs: ...@@ -200,8 +211,6 @@ jobs:
name: test devlow package name: test devlow package
needs: ['optimize-ci', 'changes'] needs: ['optimize-ci', 'changes']
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }} if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}
strategy:
fail-fast: false
uses: ./.github/workflows/build_reusable.yml uses: ./.github/workflows/build_reusable.yml
with: with:
stepName: 'test-devlow' stepName: 'test-devlow'
...@@ -335,6 +344,26 @@ jobs: ...@@ -335,6 +344,26 @@ jobs:
secrets: inherit 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: test-new-tests-dev:
name: Test new tests for flakes (dev) name: Test new tests for flakes (dev)
needs: ['optimize-ci', 'changes', 'build-native', 'build-next'] needs: ['optimize-ci', 'changes', 'build-native', 'build-next']
...@@ -407,6 +436,67 @@ jobs: ...@@ -407,6 +436,67 @@ jobs:
stepName: 'test-dev-react-${{ matrix.react }}-${{ matrix.group }}' stepName: 'test-dev-react-${{ matrix.react }}-${{ matrix.group }}'
secrets: inherit 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: test-prod:
name: test prod name: test prod
needs: ['optimize-ci', 'changes', 'build-native', 'build-next'] needs: ['optimize-ci', 'changes', 'build-native', 'build-next']
...@@ -587,6 +677,10 @@ jobs: ...@@ -587,6 +677,10 @@ jobs:
'test-new-tests-deploy', 'test-new-tests-deploy',
'test-turbopack-production', 'test-turbopack-production',
'test-turbopack-production-integration', 'test-turbopack-production-integration',
'test-unit-windows',
'test-dev-windows',
'test-integration-windows',
'test-prod-windows',
] ]
if: always() if: always()
......
...@@ -64,6 +64,11 @@ on: ...@@ -64,6 +64,11 @@ on:
required: false required: false
type: string type: string
default: '["self-hosted", "linux", "x64", "metal"]' default: '["self-hosted", "linux", "x64", "metal"]'
buildNativeTarget:
description: 'Target for build-native step'
required: false
type: string
default: 'x86_64-unknown-linux-gnu'
env: env:
NAPI_CLI_VERSION: 2.14.7 NAPI_CLI_VERSION: 2.14.7
...@@ -91,6 +96,10 @@ jobs: ...@@ -91,6 +96,10 @@ jobs:
timeout-minutes: ${{ inputs.timeout_minutes }} timeout-minutes: ${{ inputs.timeout_minutes }}
runs-on: ${{ fromJson(inputs.runs_on_labels) }} runs-on: ${{ fromJson(inputs.runs_on_labels) }}
defaults:
run:
shell: bash -leo pipefail {0}
outputs: outputs:
input_step_key: ${{ steps.var.outputs.input_step_key }} input_step_key: ${{ steps.var.outputs.input_step_key }}
...@@ -102,12 +111,8 @@ jobs: ...@@ -102,12 +111,8 @@ jobs:
script: | script: |
core.setOutput('input_step_key', '${{ inputs.stepName }}'.toLowerCase().replaceAll(/[/.]/g, '-').trim('-')); core.setOutput('input_step_key', '${{ inputs.stepName }}'.toLowerCase().replaceAll(/[/.]/g, '-').trim('-'));
- name: Setup Node.js - run: fnm use --install-if-missing ${{ inputs.nodeVersion || env.NODE_LTS_VERSION }}
uses: actions/setup-node@v4 - run: fnm default ${{ inputs.nodeVersion || env.NODE_LTS_VERSION }}
with:
node-version: ${{ inputs.nodeVersion || env.NODE_LTS_VERSION }}
check-latest: true
- run: node -v - run: node -v
- run: corepack enable - run: corepack enable
- run: pwd - run: pwd
...@@ -145,7 +150,7 @@ jobs: ...@@ -145,7 +150,7 @@ jobs:
with: with:
cache-provider: 'turbo' cache-provider: 'turbo'
save-if: ${{ github.ref_name == 'canary' }} 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 # 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 - 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: ...@@ -163,7 +168,7 @@ jobs:
- run: node scripts/normalize-version-bump.js - run: node scripts/normalize-version-bump.js
name: normalize versions 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' }} if: ${{ inputs.skipNativeBuild != 'yes' }}
- name: Upload next-swc artifact - name: Upload next-swc artifact
......
trigger:
# Only run latest commit for branches:
batch: true
# Do not run Azure CI for docs-only/example-only changes:
paths:
include:
- '*'
exclude:
- bench
- docs
- errors
- examples
# Do not run Azure on release tags. This unnecessarily increases the backlog.
branches:
include:
- '*'
exclude:
- refs/tags/*
pr:
# Do not run Azure CI for docs-only/example-only changes:
paths:
include:
- '*'
exclude:
- bench
- docs
- errors
- examples
variables:
PNPM_CACHE_FOLDER: $(Pipeline.Workspace)/.pnpm-store
NEXT_TELEMETRY_DISABLED: '1'
node_version: ^18.18.2
stages:
- stage: Test
jobs:
- job: test_integration
pool:
vmImage: 'windows-2019'
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- bash: |
node scripts/run-for-change.js --not --type docs --exec echo "##vso[task.setvariable variable=isDocsOnly]No"
displayName: 'Check Docs Only Change'
- script: corepack enable
condition: eq(variables['isDocsOnly'], 'No')
displayName: 'Enable Corepack'
- script: pnpm config set store-dir $(PNPM_CACHE_FOLDER)
condition: eq(variables['isDocsOnly'], 'No')
- script: pnpm store path
condition: eq(variables['isDocsOnly'], 'No')
- script: pnpm install && pnpm run build
condition: eq(variables['isDocsOnly'], 'No')
displayName: 'Install and build'
- script: npx playwright@1.35.1 install chromium
condition: eq(variables['isDocsOnly'], 'No')
# Test critical app router and CNA tests to cover basic usage cases with windows
- script: |
node run-tests.js -c 1 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/examples.test.ts test/integration/create-next-app/index.test.ts test/integration/create-next-app/package-manager/pnpm.test.ts
condition: eq(variables['isDocsOnly'], 'No')
displayName: 'Run tests'
- job: test_unit
pool:
vmImage: 'windows-2019'
steps:
- script: |
wmic datafile where name="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" get Version /value
displayName: 'List Chrome version'
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- bash: |
node scripts/run-for-change.js --not --type docs --exec echo "##vso[task.setvariable variable=isDocsOnly]No"
displayName: 'Check Docs Only Change'
- script: corepack enable
condition: eq(variables['isDocsOnly'], 'No')
displayName: 'Enable Corepack'
- script: pnpm config set store-dir $(PNPM_CACHE_FOLDER)
condition: eq(variables['isDocsOnly'], 'No')
- script: pnpm store path
condition: eq(variables['isDocsOnly'], 'No')
- script: pnpm install && pnpm run build
condition: eq(variables['isDocsOnly'], 'No')
displayName: 'Install and build'
- script: node run-tests.js --type unit
condition: eq(variables['isDocsOnly'], 'No')
displayName: 'Run tests'
env:
NEXT_TEST_MODE: 'dev'
- job: test_e2e_dev
pool:
vmImage: 'windows-2019'
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- bash: |
node scripts/run-for-change.js --not --type docs --exec echo "##vso[task.setvariable variable=isDocsOnly]No"
displayName: 'Check Docs Only Change'
- script: corepack enable
condition: eq(variables['isDocsOnly'], 'No')
displayName: 'Enable Corepack'
- script: pnpm config set store-dir $(PNPM_CACHE_FOLDER)
condition: eq(variables['isDocsOnly'], 'No')
- script: pnpm store path
condition: eq(variables['isDocsOnly'], 'No')
- script: pnpm install && pnpm run build
condition: eq(variables['isDocsOnly'], 'No')
displayName: 'Install and build'
- script: npx playwright@1.35.1 install chromium
condition: eq(variables['isDocsOnly'], 'No')
- script: |
node run-tests.js -c 1 --debug test/e2e/app-dir/app/index.test.ts test/e2e/app-dir/app-edge/app-edge.test.ts
condition: eq(variables['isDocsOnly'], 'No')
displayName: 'Run tests (E2E Development)'
env:
NEXT_TEST_MODE: 'dev'
- job: test_e2e_prod
pool:
vmImage: 'windows-2019'
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- bash: |
node scripts/run-for-change.js --not --type docs --exec echo "##vso[task.setvariable variable=isDocsOnly]No"
displayName: 'Check Docs Only Change'
- script: corepack enable
condition: eq(variables['isDocsOnly'], 'No')
displayName: 'Enable Corepack'
- script: pnpm config set store-dir $(PNPM_CACHE_FOLDER)
condition: eq(variables['isDocsOnly'], 'No')
- script: pnpm store path
condition: eq(variables['isDocsOnly'], 'No')
- script: pnpm install && pnpm run build
condition: eq(variables['isDocsOnly'], 'No')
displayName: 'Install and build'
- script: npx playwright@1.35.1 install chromium
condition: eq(variables['isDocsOnly'], 'No')
- script: |
node run-tests.js -c 1 --debug test/e2e/app-dir/app/index.test.ts test/e2e/app-dir/app-edge/app-edge.test.ts
condition: eq(variables['isDocsOnly'], 'No')
displayName: 'Run tests (E2E Production)'
env:
NEXT_TEST_MODE: 'start'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment