ci: cross-compile Windows tests on Linux and shard runs via nextest archives#443
Open
wan9chi wants to merge 5 commits into
Open
ci: cross-compile Windows tests on Linux and shard runs via nextest archives#443wan9chi wants to merge 5 commits into
wan9chi wants to merge 5 commits into
Conversation
…rchives Windows CI jobs previously spent most of their wall-clock compiling the workspace on slow windows-latest runners, six times over. Instead: - A new build-windows-tests job cross-compiles all test binaries for x86_64-pc-windows-msvc on a Linux runner with cargo-xwin (clang-cl + lld-link against the xwin-fetched MSVC CRT/Windows SDK) and packs them into a portable `cargo nextest archive`, uploaded as an artifact. - Six test-windows shards download the archive and only run tests via `cargo nextest run --archive-file --workspace-remap`, partitioned with nextest's native `--partition count:N/6` — no Rust toolchain, dev drive, or compilation on the Windows runners. - The e2e harness's VT_SHARD_INDEX/VT_SHARD_TOTAL self-sharding is removed; nextest partitioning replaces its only user (Windows CI). - fspy's oxlint test now resolves CARGO_MANIFEST_DIR at run time instead of `env!`, since compile-time paths bake in the build machine's checkout and break when the binary runs on another machine. https://claude.ai/code/session_012vwVCFFfjepzPQGKWLPycf
…ners The namespace runner image has no system LLVM; cc-rs failed to find llvm-lib when archiving Detours. With the rustup llvm-tools component installed, cargo-xwin symlinks llvm-lib/llvm-dlltool from the toolchain's llvm-ar (and lld-link from rust-lld), verified locally with system LLVM tools hidden. https://claude.ai/code/session_012vwVCFFfjepzPQGKWLPycf
fspy_detours_sys's bindings test runs bindgen at test time against the Detours submodule headers, so run-only shards still need the submodule. https://claude.ai/code/session_012vwVCFFfjepzPQGKWLPycf
Downloading and unpacking the SDK took 9m40s of the build job's 12m41s; the cross-compile itself took 45s. The unpacked SDK is immutable for a given manifest version, so cache it keyed on the xwin major version. https://claude.ai/code/session_012vwVCFFfjepzPQGKWLPycf
Empty commit to re-run CI now that the previous run saved the cargo-xwin SDK cache. https://claude.ai/code/session_012vwVCFFfjepzPQGKWLPycf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Windows CI jobs previously compiled the whole workspace on slow
windows-latestrunners — six times over (5 e2e shards + 1 non-e2e shard). This PR moves all Windows compilation to a fast Linux runner and turns the Windows jobs into run-only shards:build-windows-testsjob (Linux): cross-compiles every test binary forx86_64-pc-windows-msvcwith cargo-xwin (clang-cl + lld-link against the xwin-fetched MSVC CRT/Windows SDK) and packs them into a portablecargo nextest archive, uploaded as a ~46 MB artifact.cargo xwin envis eval'd beforecargo nextest archive, so the plain cargo invocation nextest makes cross-compiles exactly likecargo xwinwould. The repo rustflags from.cargo/config.tomlare preserved (cargo-xwin merges them intoCARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS).llvm-toolsrustup component suppliesllvm-ar, from which cargo-xwin symlinks the MSVC-stylellvm-lib/llvm-dlltool(andlld-linkfromrust-lld) — no system LLVM needed on the runner.CXXFLAGS=-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCHis Microsoft's documented escape hatch for the VS17 STL's minimum-Clang static assert; Detours is the only C++ in the workspace.actions/cache, keyed on the xwin manifest version.test-windowsshards: download the archive, thencargo-nextest nextest run --archive-file --workspace-remap . --partition count:N/6. No Rust toolchain, dev drive, or compilation on the Windows runners. Ignored (Node-dependent) tests run aftersetup-node, same as before. The Detours submodule is still checked out becausefspy_detours_sys's bindings test runs bindgen at test time.VT_SHARD_INDEX/VT_SHARD_TOTALself-sharding is removed — nextest's native partitioning replaces its only user (Windows CI), and it spreads e2e and non-e2e tests evenly instead of dedicating a whole shard to non-e2e.CARGO_MANIFEST_DIRat run time instead ofenv!(...): compile-time paths bake in the build machine's checkout, which breaks when the binary is built on Linux and executed on a Windows runner from a nextest archive.Verified end to end: cross-compiled locally on Linux, validated the archive→
--workspace-remap→run flow, and all six Windows shards run the cross-compiled tests green in this PR's CI (runs 27367734096, 27369662921).Time improvement
Baseline is the old workflow's latest
mainrun (27363778976, warm caches); the new numbers are this PR's warm-cache run (27369662921).windows-e2e-5, 5m00s)windows-latestrunner minutesNet: ~28% faster wall clock for Windows coverage with warm caches, ~40% fewer (2×-billed) Windows runner minutes, and the cold-cache cliff moves from six parallel Windows builds to a single cached-away Linux job. Windows shard times are also far more uniform since they no longer include toolchain setup, dev-drive creation, or compilation.
https://claude.ai/code/session_012vwVCFFfjepzPQGKWLPycf