reusable-ci-rust.yml cannot express "run tests across the whole workspace, with default features". A caller that wants --workspace on cargo test has no way to keep the coverage job working.
cargo-flags is appended to clippy and test:
run: cargo test --locked $CARGO_FLAGS $TEST_ARGS
The coverage step hardcodes --workspace and falls back to cargo-flags when coverage-flags is empty:
COVERAGE_FLAGS: ${{ inputs.coverage-flags || inputs.cargo-flags }}
run: cargo llvm-cov --locked $COVERAGE_FLAGS --workspace --lcov --output-path lcov.info
So cargo-flags: --workspace produces cargo llvm-cov --locked --workspace --workspace, and llvm-cov refuses:
error: the argument '--workspace' was provided more than once, but cannot be used multiple times
Verified with cargo-llvm-cov 0.8.5.
The coverage-flags description already names the workaround, "set separately when cargo-flags already carries --workspace", but it only works when the caller has some other non-empty value to put there. A caller that deliberately clears the --all-features default has nothing: coverage-flags: '' is falsy in a GitHub expression, so it falls straight back to cargo-flags.
Found in FerrFleet-Cloud, where cargo-flags: '' exists precisely to keep --all-features from compiling database-gated tests into the plain test job. Adding --workspace there as a guard against a future workspace member going untested is currently impossible without breaking Coverage.
Two ways out, either is fine:
- Drop the hardcoded
--workspace from the llvm-cov command and let callers pass it through coverage-flags / cargo-flags. Changes the default for callers that rely on it, so it wants a look at who does.
- Keep the hardcode and strip a
--workspace out of COVERAGE_FLAGS before splicing it.
The second is the smaller change and breaks nobody.
reusable-ci-rust.ymlcannot express "run tests across the whole workspace, with default features". A caller that wants--workspaceoncargo testhas no way to keep the coverage job working.cargo-flagsis appended to clippy and test:The coverage step hardcodes
--workspaceand falls back tocargo-flagswhencoverage-flagsis empty:So
cargo-flags: --workspaceproducescargo llvm-cov --locked --workspace --workspace, and llvm-cov refuses:Verified with cargo-llvm-cov 0.8.5.
The
coverage-flagsdescription already names the workaround, "set separately when cargo-flags already carries --workspace", but it only works when the caller has some other non-empty value to put there. A caller that deliberately clears the--all-featuresdefault has nothing:coverage-flags: ''is falsy in a GitHub expression, so it falls straight back tocargo-flags.Found in FerrFleet-Cloud, where
cargo-flags: ''exists precisely to keep--all-featuresfrom compiling database-gated tests into the plaintestjob. Adding--workspacethere as a guard against a future workspace member going untested is currently impossible without breakingCoverage.Two ways out, either is fine:
--workspacefrom the llvm-cov command and let callers pass it throughcoverage-flags/cargo-flags. Changes the default for callers that rely on it, so it wants a look at who does.--workspaceout ofCOVERAGE_FLAGSbefore splicing it.The second is the smaller change and breaks nobody.