Repository navigation
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
|
Noting: the reason I'm currently gating this behind a label is because it makes tests in CI more than twice as slow. |
f310af7 to
226b0e5
Compare
5f83af3 to
e609f98
Compare
|
NB: I'm going to clean this up and change it to just run on main. |
|
NB: I've refactored this quite a bit, to avoid putting the coverage performance hit on the happy CI path. What we do now:
(1) in particular means we won't slow down our normal CI runs. |
|
|
||
| - name: "Upload pending snapshots" | ||
| if: ${{ failure() }} | ||
| if: ${{ failure() && !inputs.collect-coverage }} |
There was a problem hiding this comment.
Note: no point in doing this work for coverage.
|
|
||
| - name: "Upload JUnit results" | ||
| if: always() | ||
| if: ${{ always() && !inputs.collect-coverage }} |
There was a problem hiding this comment.
Same here, no point in uploading JUnit results for coverage.
This adds a new `cargo dev coverage` subcommand, which invokes nextest under our new coverage pesudo-profile. This profile in turn enables `-C instrument-coverage`. `cargo dev coverage` also takes care of merging raw profiling samples into profdata and LCOV reports for us, which our new `coverage-html-report.py` script can turn into a readable (but very large) HTML report. The basic flow for this is: ``` $ # any nextest flags will work $ cargo dev coverage ... ``` That will output something like: ``` Merged profile: .../astral-sh/uv/target/coverage/profdata/b46cc0f3-7cd0-4309-9df2-10ab653e6dd8.profdata LCOV profile: .../astral-sh/uv/target/coverage/lcov/b46cc0f3-7cd0-4309-9df2-10ab653e6dd8.lcov Generate an HTML report with: uv run --script scripts/coverage-html-report.py b46cc0f3-7cd0-4309-9df2-10ab653e6dd8 ``` And then you can run: ``` uv run --script scripts/coverage-html-report.py b46cc0f3-7cd0-4309-9df2-10ab653e6dd8 ``` (or add `--open` to auto-open in the browser). Under the hood, this only uses existing dependencies plus Rust's own LLVM toolchain, plus coverage.py for the HTML report generation. Signed-off-by: William Woodruff <[email protected]> MVP coverage workflow Signed-off-by: William Woodruff <[email protected]> MVP coverage workflow, take 2 Signed-off-by: William Woodruff <[email protected]> Use a pool of 16 raw profiles for pooling Signed-off-by: William Woodruff <[email protected]> Avoid some Windows UNC pain Signed-off-by: William Woodruff <[email protected]> Fix rustflags for coverage on Windows Signed-off-by: William Woodruff <[email protected]> Remove coverage ID chum Signed-off-by: William Woodruff <[email protected]> Avoid Windows nonsense Signed-off-by: William Woodruff <[email protected]> Add coverage guide to CONTRIBUTING Signed-off-by: William Woodruff <[email protected]> Be less strict about the ID Signed-off-by: William Woodruff <[email protected]> Prettier Signed-off-by: William Woodruff <[email protected]> Use plan job to determine coverage run Signed-off-by: William Woodruff <[email protected]> Remove coverage.yml Signed-off-by: William Woodruff <[email protected]> Remove test-only changes Signed-off-by: William Woodruff <[email protected]> Run macos tests if we're collecting coverage Signed-off-by: William Woodruff <[email protected]> Make pool size a property of concurrency Signed-off-by: William Woodruff <[email protected]> Only instrument workspace members Signed-off-by: William Woodruff <[email protected]> Use single-argument form Signed-off-by: William Woodruff <[email protected]> Add a lockfile Signed-off-by: William Woodruff <[email protected]> Remove exclude-newer Signed-off-by: William Woodruff <[email protected]> Limit coverage to main pushes Signed-off-by: William Woodruff <[email protected]> Simplify Signed-off-by: William Woodruff <[email protected]> Refactor coverage dispatch Signed-off-by: William Woodruff <[email protected]> Avoid pruning weirdness Signed-off-by: William Woodruff <[email protected]> Try to generate the HTML report in CI Signed-off-by: William Woodruff <[email protected]> Normalize source paths Signed-off-by: William Woodruff <[email protected]> Avoid -Zpanic-abort-tests on Windows during cov Signed-off-by: William Woodruff <[email protected]> Remove intermediate HTML builds Signed-off-by: William Woodruff <[email protected]> Don't use `-Z panic-abort-tests` for any coverage builds Signed-off-by: William Woodruff <[email protected]> Emit combined LCOV too Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>

Summary
This adds a new
cargo dev coveragesubcommand, which invokes nextest under our new coverage pesudo-profile. This profile in turn enables-C instrument-coverage.cargo dev coveragealso takes care of merging raw profiling samples into profdata and LCOV reports for us, which our newcoverage-html-report.pyscript can turn into a readable (but very large) HTML report.The basic flow for this is:
That will output something like:
And then you can run:
(or add
--opento auto-open in the browser).Under the hood, this only uses existing dependencies plus Rust's own LLVM toolchain, plus coverage.py for the HTML report generation.
TODOs:
CONTRIBUTING.mdTest Plan
Internal only.