Skip to content

Commit f4ca2ca

Browse files
ztannerijjk
authored andcommitted
[ci]: switch to GitHub runners (#93164)
Switch CI from self-hosted runners to GitHub-hosted runners and fix the follow-up issues that showed up once the hosted jobs were exercised. - Move Linux workflows onto `ubuntu-latest-16-core-oss`, Windows workflows onto `windows-latest-8-core-oss`, and the native mac release lane onto `macos-15-intel`. - Update the reusable build workflow to work in hosted environments by relying on `runner.os` instead of label string matching, and by removing the hardcoded `/home/runner` `fnm` path. - Make Turbo/sccache configuration explicit for hosted runners: - unify on `vtest314-next-adapter-e2e-tests` - pass `TURBO_TOKEN` via workflow env/secrets instead of assuming runner-level env - switch Turbo cache mode to `local:rw,remote:rw` so jobs still have local cache behavior when remote cache is unavailable - Update the `sccache` action defaults/docs to use the hosted-runner secret setup (`TURBO_TOKEN`) instead of the old self-hosted token wiring. - Make Datadog reporting fail open so missing `DATA_DOG_API_KEY` does not block CI. - Fix the CLI reserved-port test so it asserts Next’s own `-p 1` validation instead of failing earlier on hosted Linux due to privileged-port binding. - Replace the live `musl.cc` dependency in `native-builder.Dockerfile` with musl sysroots imported from GHCR-hosted `rust-musl-cross` images, keeping the existing `/opt/*-cross` layout used by the Linux native build scripts. - Fix the macOS native build workaround s so it applies to all *-apple-darwin targets based on the Cargo target OS rather than the host architecture, which avoids napi-build injecting the unsupported -Wl linker arg when @next/swc is linked with rust-lld on hosted mac runners. Test Plan: - This PR's CI - This [build_and_deploy](https://github.com/vercel/next.js/actions/runs/24865715983/job/72801225722) job running on every arch
1 parent 369d33c commit f4ca2ca

12 files changed

Lines changed: 84 additions & 110 deletions

.github/workflows/build_and_deploy.yml

Lines changed: 26 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ env:
2121
NAPI_CLI_VERSION: 2.18.4
2222
TURBO_VERSION: 2.8.11
2323
NODE_LTS_VERSION: 20
24-
TURBO_TEAM: 'vercel'
25-
TURBO_CACHE: 'remote:rw'
24+
TURBO_TEAM: 'vtest314-next-adapter-e2e-tests'
25+
# Prefer shared remote cache across runs, but keep local cache enabled so jobs
26+
# degrade gracefully if the remote cache or token is unavailable.
27+
TURBO_CACHE: 'local:rw,remote:rw'
28+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
2629
# Without this environment variable, rust-lld will fail because some dependencies defaults to newer version of macOS by default.
2730
#
2831
# See https://doc.rust-lang.org/rustc/platform-support/apple-darwin.html#os-version for more details
@@ -158,11 +161,7 @@ jobs:
158161
target: ${{ needs.deploy-target.outputs.value == 'automated-preview' && 'x86_64-apple-darwin' }}
159162

160163
settings:
161-
- host:
162-
- 'self-hosted'
163-
- 'macos'
164-
- 'arm64'
165-
164+
- host: 'macos-15-intel'
166165
target: 'x86_64-apple-darwin'
167166
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
168167
# TODO: we should add the relevant envs later to to switch to strict mode
@@ -171,11 +170,7 @@ jobs:
171170
pnpm dlx turbo@${TURBO_VERSION} run build-native-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target x86_64-apple-darwin
172171
strip -x packages/next-swc/native/next-swc.*.node
173172
174-
- host:
175-
- 'self-hosted'
176-
- 'macos'
177-
- 'arm64'
178-
173+
- host: 'macos-15'
179174
target: 'aarch64-apple-darwin'
180175
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
181176
# TODO: we should add the relevant envs later to to switch to strict mode
@@ -184,11 +179,7 @@ jobs:
184179
pnpm dlx turbo@${TURBO_VERSION} run build-native-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target aarch64-apple-darwin
185180
strip -x packages/next-swc/native/next-swc.*.node
186181
187-
- host:
188-
- 'self-hosted'
189-
- 'windows'
190-
- 'x64'
191-
182+
- host: 'windows-latest-8-core-oss'
192183
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
193184
# TODO: we should add the relevant envs later to to switch to strict mode
194185
build: |
@@ -197,11 +188,7 @@ jobs:
197188
pnpm dlx turbo@${TURBO_VERSION} run build-native-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target x86_64-pc-windows-msvc
198189
target: 'x86_64-pc-windows-msvc'
199190

200-
- host:
201-
- 'self-hosted'
202-
- 'windows'
203-
- 'x64'
204-
191+
- host: 'windows-latest-8-core-oss'
205192
target: 'aarch64-pc-windows-msvc'
206193
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
207194
# TODO: we should add the relevant envs later to to switch to strict mode
@@ -210,12 +197,7 @@ jobs:
210197
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}"
211198
pnpm dlx turbo@${TURBO_VERSION} run build-native-no-plugin-release -vvv --env-mode loose --remote-cache-timeout 90 --summarize -- --target aarch64-pc-windows-msvc
212199
213-
- host:
214-
- 'self-hosted'
215-
- 'linux'
216-
- 'x64'
217-
- 'metal'
218-
200+
- host: 'ubuntu-latest-16-core-oss'
219201
target: 'x86_64-unknown-linux-gnu'
220202
# [NOTE] If you want to update / modify build steps, check these things:
221203
# - We use docker images to pin the glibc version to link against,
@@ -241,12 +223,7 @@ jobs:
241223
strip native/next-swc.*.node
242224
objdump -T native/next-swc.*.node | grep GLIBC_
243225
244-
- host:
245-
- 'self-hosted'
246-
- 'linux'
247-
- 'x64'
248-
- 'metal'
249-
226+
- host: 'ubuntu-latest-16-core-oss'
250227
target: 'x86_64-unknown-linux-musl'
251228
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-alpine
252229
build: |
@@ -262,12 +239,7 @@ jobs:
262239
npm run build-native-release -- --target x86_64-unknown-linux-musl
263240
strip native/next-swc.*.node
264241
265-
- host:
266-
- 'self-hosted'
267-
- 'linux'
268-
- 'x64'
269-
- 'metal'
270-
242+
- host: 'ubuntu-latest-16-core-oss'
271243
target: 'aarch64-unknown-linux-gnu'
272244
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-aarch64
273245
build: |
@@ -288,12 +260,7 @@ jobs:
288260
llvm-strip -x native/next-swc.*.node
289261
objdump -T native/next-swc.*.node | grep GLIBC_
290262
291-
- host:
292-
- 'self-hosted'
293-
- 'linux'
294-
- 'x64'
295-
- 'metal'
296-
263+
- host: 'ubuntu-latest-16-core-oss'
297264
target: 'aarch64-unknown-linux-musl'
298265
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:stable-2023-09-17-alpine
299266
build: |
@@ -310,23 +277,17 @@ jobs:
310277
npm run build-native-release -- --target aarch64-unknown-linux-musl
311278
llvm-strip -x native/next-swc.*.node
312279
313-
name: stable - ${{ matrix.settings.target }} - node@16
280+
name: stable - ${{ matrix.settings.target }} - node@20
314281
runs-on: ${{ matrix.settings.host }}
315-
timeout-minutes: 45
282+
timeout-minutes: ${{ contains(matrix.settings.target, 'apple-darwin') && 90 || 45 }}
316283
steps:
317284
# https://github.com/actions/virtual-environments/issues/1187
318285
- name: tune linux network
319286
run: sudo ethtool -K eth0 tx off rx off
320-
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
321-
- name: tune linux network
322-
run: sudo ethtool -K eth0 tx off rx off
323-
if: ${{ matrix.settings.host == 'ubuntu-latest' }}
324-
- name: tune windows network
325-
run: Disable-NetAdapterChecksumOffload -Name * -TcpIPv4 -UdpIPv4 -TcpIPv6 -UdpIPv6
326-
if: ${{ matrix.settings.host == 'windows-latest' }}
287+
if: ${{ matrix.settings.host == 'ubuntu-latest-16-core-oss' }}
327288
- name: tune mac network
328289
run: sudo sysctl -w net.link.generic.system.hwcksum_tx=0 && sudo sysctl -w net.link.generic.system.hwcksum_rx=0
329-
if: ${{ matrix.settings.host == 'macos-latest' }}
290+
if: ${{ startsWith(matrix.settings.host, 'macos-15') }}
330291
# we use checkout here instead of the build cache since
331292
# it can fail to restore in different OS'
332293
- uses: actions/checkout@v4
@@ -342,10 +303,12 @@ jobs:
342303
node-version: ${{ env.NODE_LTS_VERSION }}
343304
check-latest: true
344305

306+
- name: Prepare corepack
307+
if: ${{ matrix.settings.host != 'windows-latest-8-core-oss' }}
308+
run: npm i -g corepack@0.31
309+
345310
- name: Setup corepack
346-
run: |
347-
npm i -g corepack@0.31
348-
corepack enable
311+
run: corepack enable
349312

350313
# we always want to run this to set environment variables
351314
- name: Install Rust
@@ -388,10 +351,10 @@ jobs:
388351
# put the command in an environment variable to avoid escaping issues
389352
DOCKER_CMD: ${{ matrix.settings.build }}
390353
run: |
391-
docker run -v "/var/run/docker.sock":"/var/run/docker.sock" \
354+
docker run --rm -v "/var/run/docker.sock":"/var/run/docker.sock" \
392355
-e CI -e RUST_BACKTRACE -e NAPI_CLI_VERSION -e CARGO_TERM_COLOR -e CARGO_INCREMENTAL \
393356
-e CARGO_PROFILE_RELEASE_LTO -e CARGO_REGISTRIES_CRATES_IO_PROTOCOL -e TURBO_API \
394-
-e TURBO_TEAM -e TURBO_TOKEN -e TURBO_VERSION -e TURBO_CACHE="remote:rw" \
357+
-e TURBO_TEAM -e TURBO_TOKEN -e TURBO_VERSION -e TURBO_CACHE="local:rw,remote:rw" \
395358
-v ${{ env.HOME }}/.cargo/git:/root/.cargo/git \
396359
-v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry \
397360
-v ${{ github.workspace }}:/build \
@@ -457,11 +420,7 @@ jobs:
457420
matrix:
458421
target: [web, nodejs]
459422

460-
runs-on:
461-
- 'self-hosted'
462-
- 'linux'
463-
- 'x64'
464-
- 'metal'
423+
runs-on: ubuntu-latest-16-core-oss
465424

466425
steps:
467426
- uses: actions/checkout@v4
@@ -709,6 +668,7 @@ jobs:
709668
path: turbopack-bin-size
710669

711670
- name: Upload to Datadog
671+
if: ${{ env.DATADOG_API_KEY != '' }}
712672
run: |
713673
ls -al turbopack-bin-size
714674

.github/workflows/build_and_test.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
with:
8282
skipInstallBuild: 'yes'
8383
stepName: 'build-native-windows'
84-
runs_on_labels: '["windows","self-hosted","x64"]'
84+
runs_on_labels: '["windows-latest-8-core-oss"]'
8585
buildNativeTarget: 'x86_64-pc-windows-msvc'
8686

8787
secrets: inherit
@@ -711,7 +711,7 @@ jobs:
711711
nodeVersion: ${{ matrix.node }}
712712
afterBuild: node run-tests.js --type unit
713713
stepName: 'test-unit-windows-${{ matrix.node }}'
714-
runs_on_labels: '["windows","self-hosted","x64"]'
714+
runs_on_labels: '["windows-latest-8-core-oss"]'
715715
buildNativeTarget: 'x86_64-pc-windows-msvc'
716716

717717
secrets: inherit
@@ -884,7 +884,7 @@ jobs:
884884
test/e2e/app-dir/proxy-runtime-nodejs/proxy-runtime-nodejs.test.ts \
885885
test/development/app-dir/segment-explorer/segment-explorer.test.ts
886886
stepName: 'test-dev-windows'
887-
runs_on_labels: '["windows","self-hosted","x64"]'
887+
runs_on_labels: '["windows-latest-8-core-oss"]'
888888
buildNativeTarget: 'x86_64-pc-windows-msvc'
889889
secrets: inherit
890890

@@ -914,7 +914,7 @@ jobs:
914914
test/integration/create-next-app/index.test.ts \
915915
test/integration/create-next-app/package-manager/pnpm.test.ts
916916
stepName: 'test-integration-windows'
917-
runs_on_labels: '["windows","self-hosted","x64"]'
917+
runs_on_labels: '["windows-latest-8-core-oss"]'
918918
buildNativeTarget: 'x86_64-pc-windows-msvc'
919919
secrets: inherit
920920

@@ -944,7 +944,7 @@ jobs:
944944
test/e2e/app-dir/non-root-project-monorepo/non-root-project-monorepo.test.ts \
945945
test/e2e/app-dir/proxy-runtime-nodejs/proxy-runtime-nodejs.test.ts
946946
stepName: 'test-prod-windows'
947-
runs_on_labels: '["windows","self-hosted","x64"]'
947+
runs_on_labels: '["windows-latest-8-core-oss"]'
948948
buildNativeTarget: 'x86_64-pc-windows-msvc'
949949
secrets: inherit
950950

.github/workflows/build_reusable.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ on:
6868
description: 'List of runner labels'
6969
required: false
7070
type: string
71-
default: '["self-hosted", "linux", "x64", "metal"]'
71+
default: '["ubuntu-latest-16-core-oss"]'
7272
buildNativeTarget:
7373
description: 'Target for build-native step'
7474
required: false
@@ -101,9 +101,11 @@ env:
101101
# disable backtrace for test snapshots
102102
RUST_BACKTRACE: 0
103103

104-
TURBO_TEAM: 'vtest314-next-e2e-tests'
105-
TURBO_CACHE: 'remote:rw'
106-
TURBO_TOKEN: ${{ secrets.TURBO_REMOTE_CACHE_TOKEN }}
104+
TURBO_TEAM: 'vtest314-next-adapter-e2e-tests'
105+
# Prefer shared remote cache across runs, but keep local cache enabled so jobs
106+
# degrade gracefully if the remote cache or token is unavailable.
107+
TURBO_CACHE: 'local:rw,remote:rw'
108+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
107109

108110
NEXT_TELEMETRY_DISABLED: 1
109111
# allow not skipping install-native postinstall script if we don't have a binary available already
@@ -147,7 +149,7 @@ jobs:
147149
steps:
148150
# enforce consistent line endings for git on windows
149151
- name: Configure git to use LF endings
150-
if: ${{ contains(fromJson(inputs.runs_on_labels), 'windows') }}
152+
if: ${{ runner.os == 'Windows' }}
151153
run: |
152154
git config --global core.autocrlf false
153155
git config --global core.eol lf
@@ -167,9 +169,10 @@ jobs:
167169
- name: Install fnm
168170
if: steps.check-fnm.outputs.found != 'true'
169171
run: |
172+
export FNM_DIR="${HOME}/.local/share/fnm"
170173
curl -fsSL https://fnm.vercel.app/install | bash
171-
export PATH="/home/runner/.local/share/fnm:$PATH"
172-
echo "/home/runner/.local/share/fnm" >> $GITHUB_PATH
174+
export PATH="$FNM_DIR:$PATH"
175+
echo "$FNM_DIR" >> $GITHUB_PATH
173176
fnm env --json | jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' | xargs -I {} echo "{}" >> $GITHUB_ENV
174177
175178
- name: Normalize input step names into path key
@@ -202,7 +205,7 @@ jobs:
202205
which node
203206
node --version
204207
- name: Prepare corepack
205-
if: ${{ contains(fromJson(inputs.runs_on_labels), 'ubuntu-latest') }}
208+
if: ${{ runner.os == 'Linux' }}
206209
run: |
207210
npm i -g corepack@0.31
208211
- run: corepack enable
@@ -353,7 +356,7 @@ jobs:
353356
path: packages/next/dist/compiled/next-server/report.*.html
354357

355358
- name: Upload test report to datadog
356-
if: ${{ inputs.afterBuild && always() && !github.event.pull_request.head.repo.fork }}
359+
if: ${{ inputs.afterBuild && always() && !github.event.pull_request.head.repo.fork && env.DATADOG_API_KEY != '' }}
357360
run: |
358361
# Add a `test.type` tag to distinguish between turbopack and next.js runs
359362
# Add a `nextjs.test_session.name` tag to help identify the job

.github/workflows/integration_tests_reusable.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
secrets: inherit
5757

5858
generate-matrices:
59-
runs-on: [self-hosted, linux, x64, metal]
59+
runs-on: ubuntu-latest-16-core-oss
6060
steps:
6161
- id: out
6262
run: |
@@ -147,7 +147,7 @@ jobs:
147147
collect_nextjs_development_integration_stat:
148148
needs: [test-e2e, test-integration]
149149
name: Next.js integration test development status report
150-
runs-on: [self-hosted, linux, x64, metal]
150+
runs-on: ubuntu-latest-16-core-oss
151151
if: always()
152152
permissions:
153153
pull-requests: write

.github/workflows/pull_request_stats.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ env:
1818
NODE_LTS_VERSION: 20
1919
TEST_CONCURRENCY: 6
2020

21-
TURBO_TEAM: 'vercel'
22-
TURBO_CACHE: 'remote:rw'
21+
TURBO_TEAM: 'vtest314-next-adapter-e2e-tests'
22+
# Prefer shared remote cache across runs, but keep local cache enabled so jobs
23+
# degrade gracefully if the remote cache or token is unavailable.
24+
TURBO_CACHE: 'local:rw,remote:rw'
25+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
2326
NEXT_TELEMETRY_DISABLED: 1
2427
# we build a dev binary for use in CI so skip downloading
2528
# canary next-swc binaries in the monorepo
@@ -47,11 +50,7 @@ jobs:
4750
fail-fast: false
4851
matrix:
4952
bundler: [webpack, turbopack]
50-
runs-on:
51-
- 'self-hosted'
52-
- 'linux'
53-
- 'x64'
54-
- 'metal'
53+
runs-on: ubuntu-latest-16-core-oss
5554
steps:
5655
- uses: actions/checkout@v4
5756
with:

.github/workflows/setup-nextjs-build.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ on:
1616
jobs:
1717
build_nextjs:
1818
name: Build Next.js for the turbopack integration test
19-
runs-on:
20-
- 'self-hosted'
21-
- 'linux'
22-
- 'x64'
23-
- 'metal'
19+
runs-on: ubuntu-latest-16-core-oss
2420
outputs:
2521
output1: ${{ steps.build-next-swc-turbopack-patch.outputs.success }}
2622
steps:

.github/workflows/test-turbopack-rust-bench-test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
inputs:
55
runner:
66
type: string
7-
default: '["self-hosted", "linux", "x64", "metal"]'
7+
default: '["ubuntu-latest-16-core-oss"]'
88
os:
99
type: string
1010
default: 'linux'
@@ -17,6 +17,8 @@ env:
1717
TURBOPACK_BENCH_PROGRESS: '1'
1818

1919
NODE_LTS_VERSION: 20
20+
TURBO_TEAM: 'vtest314-next-adapter-e2e-tests'
21+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
2022

2123
jobs:
2224
test:

.github/workflows/test_e2e_deploy_release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ jobs:
240240
merge-multiple: true
241241

242242
- name: Upload test report to datadog
243+
if: ${{ env.DATADOG_API_KEY != '' }}
243244
run: |
244245
if [ -d ./test/test-junit-report ]; then
245246
DD_ENV=ci npx @datadog/datadog-ci@2.23.1 junit upload --tags test.type:deploy --service nextjs ./test/test-junit-report

0 commit comments

Comments
 (0)