-
Notifications
You must be signed in to change notification settings - Fork 53
Switch to cargo-llvm-cov for code coverage #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Updated .github/workflows/code_coverage.yml to use cargo-llvm-cov instead of grcov - Removed environment variables (RUSTFLAGS, RUSTDOCFLAGS, LLVM_PROFILE_FILE) - Switched to nightly toolchain for coverage generation - Enabled coverage_nightly config attribute in lib.rs - Added coverage(off) attribute to all test modules to exclude them from coverage reports - Added lint config for coverage_nightly cfg to Cargo.toml Co-authored-by: ValuedMammal <95981133+ValuedMammal@users.noreply.github.com>
Also add lcov.info to .gitignore to prevent accidental commits Co-authored-by: ValuedMammal <95981133+ValuedMammal@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #371 +/- ##
==========================================
- Coverage 85.33% 79.06% -6.28%
==========================================
Files 24 24
Lines 8335 5432 -2903
Branches 0 234 +234
==========================================
- Hits 7113 4295 -2818
+ Misses 1222 1067 -155
- Partials 0 70 +70
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Concept ACK, haven't done an in-depth review. |
|
@copilot When running the |
Added --branch flag to enable branch coverage tracking Added --quiet flag to reduce output verbosity Co-authored-by: ValuedMammal <95981133+ValuedMammal@users.noreply.github.com>
Description
Replaces
grcovwithcargo-llvm-covfor coverage generation.grcovlacks branch coverage support and has other limitations.Workflow changes:
cargo-llvm-covRUSTFLAGS="--cfg coverage_nightly"during coverage runs onlylcovtools and old coverage environment variables--branchflag--quietflag to reduce output verbosityCode changes:
coverage_attributefeature via#[cfg_attr(coverage_nightly, feature(coverage_attribute))]inlib.rs#[cfg_attr(coverage_nightly, coverage(off))]on 13 test modulescoverage_nightlyto[lints.rust]inCargo.tomlto declare the custom cfgStable builds are unaffected. Coverage exclusions only activate when the cfg is set.
Notes to the reviewers
The
coverage_nightlycfg is only set during coverage generation in CI. Regular builds and tests use stable toolchain without this cfg.Branch coverage is now explicitly enabled, providing more detailed coverage metrics than the previous grcov setup.
Changelog notice
Checklists
All Submissions:
just pbefore pushingNew Features:
Bugfixes:
Original prompt
cargo-llvm-cov#366💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.