Pushes to main cancel the Workspace run they supersede, as pull requests
already do; the newest push's run tests everything before it. On 16 Nov main
had 144 pushes, each a three-OS run that could not be cancelled, which is much
of what fills the org's macOS runners. Release tags, manual runs and a new
scheduled run every 6 hours keep a group of their own and always finish, and the
scheduled run saves the caches (the gate already saves on scheduled runs of the
default branch). scripts/test-workspace-concurrency.py checks the new policy.
The per-crate workflows, which no longer save caches, cancel superseded runs on
every branch, main included.
workspace.yml passes select-os to the gate: a pull request runs the macOS and
Windows legs when a changed file is in a crate with platform cfg code or in a
crate that depends on one, is part of the build setup (workflows, Cargo.lock,
the root Cargo.toml, toolchain, .cargo, .config), or lies outside the crates
and is not documentation. 37 of 177 crates have platform code and 57 are
affected with their dependents; 39 of the last 80 merged pull requests would
have run Linux only, without the macOS queue. The full-ci label runs every leg
from the next push or manual run. Pushes to main run every leg.
workspace.yml moves fmt, both clippy runs and the workflow script checks into
the gate's lint-command, so each OS gets a lint (<os>) leg running beside its
gate (<os>) leg. Clippy (about 6 min on Linux and 11 on Windows) no longer runs
before the test build. scripts/test-workspace-tests.py checks both blocks.
The gate restores .test-inputs/photocraft/corpus before its setup, keyed on
scripts/ci-test-inputs.sh (which holds the PhotoCraft pin), and the setup uses a
restored corpus as it is. A hit skips the PhotoCraft checkout and its xtask
build: 2:17 of Windows setup, about 1:00 on Linux and macOS. Uses
craft-common-actions' new cache-paths, cache-key and cache-key-files inputs.
CARGO_PROFILE_DEV_DEBUG=0 on Windows, as PhotoCraft's Windows legs do: writing
PDBs for every test binary is a large part of the Windows build. The gate
writes windows-env after its dev-debug default, so the Linux and macOS legs keep
line-tables-only.
Every Workspace leg runs nextest with --all-features and the doctests with
cargo test --doc. The default-feature test run is gone: it added exactly four
tests, all in craft-image-codecs and craft-text (feature-off behaviour), so
those two crates run their tests with default features as well. The
default-feature compile stays covered by the first clippy run.
The resource groups from craft-libs#2058's audit move into the ci profile with
platform = 'cfg(unix)', so Linux and macOS share one profile and Windows keeps
the groups it already passes with. No separate example build: nextest builds
examples as cargo test does, and clippy --all-targets checks them.
scripts/test-workspace-tests.py follows the single command set.
craft-testkit's hostile hammer reads CRAFT_HOSTILE_DIVISOR=N: the unmodified
seed, every N-th truncation and 1/N of the rounds. hostile::divisor() gives the
same value to sweeps written without the hammer; craft-image-codecs' TIFF zoo
and malformed-header sweeps use it, with a different offset per input so the
inputs together still reach every position. Proptests without their own case
count read proptest's PROPTEST_CASES.
The Workspace gate and the media, audio, video and PDF workflows set
CRAFT_HOSTILE_DIVISOR=8 and PROPTEST_CASES=64. The longest of these tests
(craft-media's MXF hostile input, 1,310 s on Windows; craft-pdf's crypt
proptests, up to 257 s; the image-codecs sweeps, 140-162 s) drop to about an
eighth or a quarter. nightly.yml runs the whole workspace on Linux without
either variable, so every case still runs once a day.
The gate's test-input setup moves to scripts/ci-test-inputs.sh, shared by both
workflows; it uses a corpus that is already present.
* 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.
* ci: cancel superseded Workspace pull-request runs
The Workspace workflow (the native, MSRV and WASM legs) had no concurrency
group, so every push to a lockfile or dependency pull request started a second
full set of runs while the first set kept going, up to three runners each.
Give pull requests one group per pull request, so a newer push cancels the
older run, and give every other run a group of its own, so a main push, a
release tag or a manual run is neither cancelled nor replaced while queued.
github.ref is refs/pull/<n>/merge for a pull request, so two forks with the
same branch name stay separate. The pattern is the one merged in #772 for the
23 crate workflows, which left this reusable-workflow caller out.
The gate commands, jobs, inputs, matrices, timeouts, triggers and permissions
are untouched.
scripts/test-workspace-concurrency.py checks the policy itself: the two fields
and their documented expression shapes, one group per pull request and one per
other run, cancellation on a pull request only, and no job-level concurrency.
It reads the workflow without wiring anything into CI.
* test(workspace-concurrency): reject a scalar concurrency value
`read_concurrency` matched any line starting with `concurrency:` and read the
indented lines under it as fields. Under `concurrency: |` — a block scalar, not
a mapping — the workflow would have passed every policy check with the reader
alone, while the `PyYAML` cross-check that catches it is skipped when PyYAML is
absent. `concurrency: some-string` was rejected only by accident, through the
empty field set.
Require the header itself to be `concurrency:` (an inline comment allowed), and
test both scalar shapes. CodeRabbit found this on the pull request.
* sonar: analyse the Workspace concurrency guard as a test
scripts/test-workspace-concurrency.py is a unittest module: each case reads a
workflow and asserts on the policy. Listing it in sonar.test.inclusions keeps it
analysed as test code — linted, indexed and reported — instead of counting it as
production code that needs coverage, which is what failed the quality gate at
0.0% Coverage on New Code.
The exact path is appended to the three existing Rust patterns, so no other
script, and nothing else in the repository, is reclassified. No coverage
exclusion, quality threshold, workflow or build change.
* ci: run the Workspace concurrency guard in the gate
scripts/test-workspace-concurrency.py guarded the policy only when someone remembered to
run it, so a reworded concurrency block could land with 16 green checks. The gate's
`command` step now runs it before the cargo steps; `command` covers the Linux and macOS
legs, and it is one python3 call that needs nothing installed and fails in a second, ahead
of an hour of building.
The Windows leg keeps its existing `windows-command`: the script passes on a CRLF copy of
the workflow, but this change does not put an untested step on Windows.