Skip to content

Commit 7de0719

Browse files
claudewan9chi
authored andcommitted
ci: test warm Linux Windows archive build
Cross-compile Windows test binaries on Linux with the xwin SDK cache restored, then run the archived default tests across six Windows partitions. Run the smaller ignored suite once in a separate Windows job to test the best wall-time split.
1 parent 6145cfe commit 7de0719

2 files changed

Lines changed: 36 additions & 15 deletions

File tree

.github/workflows/ci.yml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,12 @@ jobs:
133133

134134
# Windows tests are cross-compiled on a fast Linux runner with cargo-xwin
135135
# (clang-cl + lld-link against the xwin-downloaded MSVC CRT/Windows SDK)
136-
# and packed into a portable nextest archive. The test-windows shards then
137-
# only download the archive and run it — no Rust toolchain or compilation
138-
# on the slow Windows runners. Windows e2e fixtures dominate wall-clock
139-
# (60s per PTY step vs 20s on Unix), so the run is split across shards via
140-
# nextest's count partitioning, which spreads tests round-robin.
136+
# and packed into a portable nextest archive. The Windows runners then only
137+
# download the archive and run it: no Rust toolchain or compilation on the
138+
# slow runners. Six nextest partitions avoid most repeated setup while keeping
139+
# enough parallelism for the Windows-heavy default test workload. The much
140+
# smaller Node-backed ignored suite runs once in its own job, avoiding
141+
# duplicate Windows Node setup.
141142
build-windows-tests:
142143
needs: detect-changes
143144
if: needs.detect-changes.outputs.code-changed == 'true'
@@ -174,7 +175,7 @@ jobs:
174175
tool: cargo-nextest,cargo-xwin
175176

176177
# Downloading and unpacking the MSVC CRT/Windows SDK dominates this
177-
# job's wall time (~10 minutes); the unpacked result is immutable for a
178+
# job's wall time on a cold cache; the unpacked result is immutable for a
178179
# given manifest version, so cache it. Bump the key when bumping the
179180
# xwin version.
180181
- uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
@@ -210,14 +211,35 @@ jobs:
210211

211212
test-windows:
212213
needs: build-windows-tests
213-
name: Test (windows-${{ matrix.partition }})
214+
name: Test (${{ matrix.shard }})
214215
strategy:
215216
fail-fast: false
216217
matrix:
217-
partition: [1, 2, 3, 4, 5, 6]
218+
include:
219+
- shard: windows-1
220+
partition: count:1/6
221+
mode: default
222+
- shard: windows-2
223+
partition: count:2/6
224+
mode: default
225+
- shard: windows-3
226+
partition: count:3/6
227+
mode: default
228+
- shard: windows-4
229+
partition: count:4/6
230+
mode: default
231+
- shard: windows-5
232+
partition: count:5/6
233+
mode: default
234+
- shard: windows-6
235+
partition: count:6/6
236+
mode: default
237+
- shard: windows-ignored
238+
partition: ''
239+
mode: ignored
218240
runs-on: windows-latest
219241
env:
220-
PARTITION: count:${{ matrix.partition }}/6
242+
PARTITION: ${{ matrix.partition }}
221243
steps:
222244
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
223245

@@ -240,14 +262,15 @@ jobs:
240262
# and pnpm enter the picture. `cargo-nextest` is invoked directly so the
241263
# job never depends on the runner's Rust toolchain.
242264
- name: Run tests
265+
if: matrix.mode == 'default'
243266
run: cargo-nextest nextest run --archive-file windows-tests.tar.zst --workspace-remap . --partition "$PARTITION"
244267

245268
- uses: oxc-project/setup-node@ab97f03642370d79a7e96dd286bd02a1be40e0ba # v1.3.0
269+
if: matrix.mode == 'ignored'
246270

247-
# --no-tests=pass: a shard's partition of the (much smaller) ignored
248-
# test set may legitimately come up empty.
249271
- name: Run ignored tests
250-
run: cargo-nextest nextest run --archive-file windows-tests.tar.zst --workspace-remap . --partition "$PARTITION" --run-ignored ignored-only --no-tests pass
272+
if: matrix.mode == 'ignored'
273+
run: cargo-nextest nextest run --archive-file windows-tests.tar.zst --workspace-remap . --run-ignored ignored-only
251274

252275
test-musl:
253276
needs: detect-changes

crates/fspy/tests/oxlint.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ use test_log::test;
88
/// Get the packages/tools/.bin directory path
99
fn tools_bin_dir() -> std::path::PathBuf {
1010
// Resolve CARGO_MANIFEST_DIR at run time, not via `env!`: a compile-time
11-
// path bakes in the build machine's checkout, which breaks when the test
12-
// binary is cross-compiled and run on another machine (e.g. built on
13-
// Linux with cargo-xwin, run on Windows from a nextest archive).
11+
// path can point at a different checkout than the one executing the test.
1412
let manifest_dir = std::path::PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap());
1513
manifest_dir
1614
.parent()

0 commit comments

Comments
 (0)