From 692a7fe5c95947e11850eeefc4e071623d4bbf47 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Mon, 16 Nov 2026 17:45:15 +0100 Subject: [PATCH] ci: run the Windows gate's tests with nextest (#1881) * ci: run the Windows gate's tests with nextest and link with rust-lld The Windows leg of the Workspace gate takes 55-100 minutes. About half of that is cargo test running ~370 test binaries one after another, twice (default and all features), and another 15-17 minutes per feature set is the uncached test build, where link.exe links every test executable. - Windows runs the tests with cargo-nextest (parallel across binaries) and the doctests with cargo test --doc. The same tests run; .config/nextest.toml puts the tests that relied on in-process mutexes (craft-ui GPU, craft-video h264 fixtures, craft-print) in one-at-a-time groups. - Windows links with rust-lld via CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER. Linux and macOS legs are unchanged. * ci: keep link.exe on the Windows gate The first run with rust-lld built the tests no faster than link.exe at the same runner speed (14.4 min against 15.1 min on a runner 8% slower at clippy), so the linker change is not worth its risk. nextest stays. --- .config/nextest.toml | 44 +++++++++++++++++++++++++++++++++ .github/workflows/workspace.yml | 11 ++++++--- 2 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 .config/nextest.toml diff --git a/.config/nextest.toml b/.config/nextest.toml new file mode 100644 index 000000000..1037b2310 --- /dev/null +++ b/.config/nextest.toml @@ -0,0 +1,44 @@ +# cargo-nextest (https://nexte.st) runs every test in its own process, in parallel across test +# binaries. The Windows leg of the Workspace gate uses it (.github/workflows/workspace.yml); every +# other leg, and local runs, keep `cargo test`. Nextest does not run doctests, so the Windows leg +# also runs `cargo test --doc`. +# +# cargo nextest run --workspace --profile ci +# cargo test --workspace --doc +# +# Refuse an older nextest: CI installs exactly this version (GHSA-vc25-qg58-w57c is fixed in it). +nextest-version = "0.9.150" + +# Some tests share a resource that an in-process mutex keeps to one test at a time. With one +# process per test those mutexes no longer serialize anything, so these groups do it instead, one +# test at a time, as under `cargo test`. +[test-groups] +# craft-ui: `gpu_test_lock()` / `gpu_lock()`. Each renderer creates its own wgpu instance and +# device, and creating or destroying one while another test uses its device can crash. +gpu = { max-threads = 1 } +# craft-video h264_decode: `FIXTURE_GENERATION` keeps a second producer from replacing a fixture +# file another test is reading. +video-fixtures = { max-threads = 1 } +# craft-print: `PRINT_TICKET_PROVIDER` serializes the Windows PrintTicket provider, and the tests +# share the one test print queue the gate installs. +print = { max-threads = 1 } + +[[profile.default.overrides]] +filter = 'package(craft-ui) & (binary(visual_regression) | test(/^combo::tests::|selected_tab_erases_a_baseline_centered_on_its_bottom_edge/))' +test-group = 'gpu' + +[[profile.default.overrides]] +filter = 'package(craft-video) & binary(h264_decode)' +test-group = 'video-fixtures' + +[[profile.default.overrides]] +filter = 'package(craft-print)' +test-group = 'print' + +# The gate (`--profile ci`). Run every test and list all failures at the end, as `cargo test` +# reports a whole binary. Slow tests are named every 60 seconds; none is stopped for being slow, +# so a hang is still ended by the gate's own timeout, as before. +[profile.ci] +fail-fast = false +slow-timeout = { period = "60s" } +failure-output = "immediate-final" diff --git a/.github/workflows/workspace.yml b/.github/workflows/workspace.yml index 20e947480..4d717fed8 100644 --- a/.github/workflows/workspace.yml +++ b/.github/workflows/workspace.yml @@ -25,7 +25,8 @@ jobs: with: os: '["ubuntu-latest","windows-latest","macos-latest"]' timeout-minutes: 120 - tools: "" + # The Windows leg runs its tests with nextest (.config/nextest.toml). + tools: cargo-nextest@0.9.150 packages: mesa-vulkan-drivers libvulkan1 craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 linux-env: WGPU_BACKEND=vulkan @@ -58,8 +59,12 @@ jobs: cargo fmt --check cargo clippy --workspace --all-targets --locked -- -D warnings cargo clippy --workspace --all-targets --all-features --locked -- -D warnings - cargo test --workspace --locked - cargo test --workspace --all-features --locked + # The same tests as `cargo test`, run in parallel across test binaries instead of one + # binary at a time; nextest skips doctests, so `cargo test --doc` runs them. + cargo nextest run --workspace --locked --profile ci + cargo test --workspace --doc --locked + cargo nextest run --workspace --all-features --locked --profile ci + cargo test --workspace --doc --all-features --locked msrv: name: Rust 1.95