Skip to content

Commit 34c36aa

Browse files
fengmk2branchseer
andauthored
ci: migrate runners to namespace (#310)
## Summary - Migrate GitHub-hosted Linux/macOS CI runners to [namespace.so](https://namespace.so) runners for faster builds (Windows remains on GitHub-hosted) - Use `pipx` + `mlugg/setup-zig` for cargo-zigbuild toolchain on namespace runners (no pre-installed pip/zig) - Improve CI conditionals to use `matrix.target` instead of `matrix.os` for more robust platform checks - Simplify duplicated build/test steps using matrix variables (`cargo_cmd`, `build_target`) - Add Sponsors section to README crediting namespace.so Ref: voidzero-dev/vite-plus#1066 ## CI Speed Comparison | Job | GitHub-hosted | Namespace | Change | |-----|--------------|-----------|--------| | Clippy | 60s | 72s | +12s (cold cache) | | Format | 65s | 65s | same | | Test Linux | 119s | 88s | **-31s (26% faster)** | | Test macOS arm64 | 93s | 60s | **-33s (35% faster)** | | Test macOS x86_64 | 217s | 138s | **-79s (36% faster)** | | Test musl | 250s | 113s | **-137s (55% faster)** | | Test Windows | 267s | 286s | +19s (still GH-hosted, variance) | Linux and macOS jobs are **26–55% faster**. Overall wall time is bottlenecked by Windows (still on GitHub-hosted). ## Test plan - [x] CI passes on all platforms (Linux, macOS, Windows) --------- Co-authored-by: branchseer <3612422+branchseer@users.noreply.github.com>
1 parent 94fa9c4 commit 34c36aa

File tree

2 files changed

+34
-24
lines changed

2 files changed

+34
-24
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ defaults:
2424

2525
jobs:
2626
detect-changes:
27-
runs-on: ubuntu-latest
27+
runs-on: namespace-profile-linux-x64-default
2828
permissions:
2929
contents: read
3030
pull-requests: read
@@ -43,7 +43,7 @@ jobs:
4343
needs: detect-changes
4444
if: needs.detect-changes.outputs.code-changed == 'true'
4545
name: Clippy
46-
runs-on: ubuntu-latest
46+
runs-on: namespace-profile-linux-x64-default
4747
steps:
4848
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4949
with:
@@ -57,7 +57,10 @@ jobs:
5757
components: clippy
5858

5959
- run: rustup target add x86_64-unknown-linux-musl
60-
- run: pip install cargo-zigbuild
60+
- run: pipx install cargo-zigbuild
61+
# pipx isolates cargo-zigbuild in its own venv, so its ziglang dependency
62+
# (which bundles zig) isn't on PATH. Install zig separately.
63+
- uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2
6164

6265
# --locked: verify Cargo.lock is up to date (replaces the removed `cargo check --locked`)
6366
- run: cargo clippy --locked --all-targets --all-features -- -D warnings
@@ -70,14 +73,22 @@ jobs:
7073
fail-fast: false
7174
matrix:
7275
include:
73-
- os: ubuntu-latest
76+
- os: namespace-profile-linux-x64-default
7477
target: x86_64-unknown-linux-gnu
78+
cargo_cmd: cargo-zigbuild
79+
build_target: x86_64-unknown-linux-gnu.2.17
7580
- os: windows-latest
7681
target: x86_64-pc-windows-msvc
77-
- os: macos-latest
82+
cargo_cmd: cargo
83+
build_target: x86_64-pc-windows-msvc
84+
- os: namespace-profile-mac-default
7885
target: aarch64-apple-darwin
79-
- os: macos-latest
86+
cargo_cmd: cargo
87+
build_target: aarch64-apple-darwin
88+
- os: namespace-profile-mac-default
8089
target: x86_64-apple-darwin
90+
cargo_cmd: cargo
91+
build_target: x86_64-apple-darwin
8192
runs-on: ${{ matrix.os }}
8293
steps:
8394
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -102,10 +113,15 @@ jobs:
102113
- run: rustup target add ${{ matrix.target }}
103114

104115
- run: rustup target add x86_64-unknown-linux-musl
105-
if: ${{ matrix.os == 'ubuntu-latest' }}
116+
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
106117

107-
- run: pip install cargo-zigbuild
108-
if: ${{ matrix.os == 'ubuntu-latest' }}
118+
- run: pipx install cargo-zigbuild
119+
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
120+
121+
# pipx isolates cargo-zigbuild in its own venv, so its ziglang dependency
122+
# (which bundles zig) isn't on PATH. Install zig separately.
123+
- uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2
124+
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' }}
109125

110126
# For x86_64-apple-darwin on arm64 runner, install x64 node so fspy preload dylib
111127
# (compiled for x86_64) can be injected into node processes running under Rosetta.
@@ -128,26 +144,16 @@ jobs:
128144
- run: pnpm install
129145

130146
- name: Build tests
131-
run: cargo test --no-run --target ${{ matrix.target }}
132-
if: ${{ matrix.os != 'ubuntu-latest' }}
133-
134-
- name: Build tests
135-
run: cargo-zigbuild test --no-run --target x86_64-unknown-linux-gnu.2.17
136-
if: ${{ matrix.os == 'ubuntu-latest' }}
137-
138-
- name: Run tests
139-
run: cargo test --target ${{ matrix.target }}
140-
if: ${{ matrix.os != 'ubuntu-latest' }}
147+
run: ${{ matrix.cargo_cmd }} test --no-run --target ${{ matrix.build_target }}
141148

142149
- name: Run tests
143-
run: cargo-zigbuild test --target x86_64-unknown-linux-gnu.2.17
144-
if: ${{ matrix.os == 'ubuntu-latest' }}
150+
run: ${{ matrix.cargo_cmd }} test --target ${{ matrix.build_target }}
145151

146152
test-musl:
147153
needs: detect-changes
148154
if: needs.detect-changes.outputs.code-changed == 'true'
149155
name: Test (musl)
150-
runs-on: ubuntu-latest
156+
runs-on: namespace-profile-linux-x64-default
151157
container:
152158
image: node:22-alpine3.21
153159
options: --shm-size=256m # shm_io tests need bigger shared memory
@@ -193,7 +199,7 @@ jobs:
193199

194200
fmt:
195201
name: Format and Check Deps
196-
runs-on: ubuntu-latest
202+
runs-on: namespace-profile-linux-x64-default
197203
steps:
198204
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
199205
with:
@@ -221,7 +227,7 @@ jobs:
221227
run: pnpm dedupe --check
222228

223229
done:
224-
runs-on: ubuntu-latest
230+
runs-on: namespace-profile-linux-x64-default
225231
if: always()
226232
needs:
227233
- clippy

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ vp run -t @my/app#build # run in a package and its transitive dependencies
1313
vp run --cache build # run with caching enabled
1414
```
1515

16+
## Sponsors
17+
18+
Thanks to [namespace.so](https://namespace.so) for powering our CI/CD pipelines with fast, free macOS and Linux runners.
19+
1620
## License
1721

1822
[MIT](LICENSE)

0 commit comments

Comments
 (0)