Code coverage threshold#106
Open
gloskull wants to merge 2 commits into
Open
Conversation
…d-in-ci Enforce CI code coverage threshold
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Prevent regressions by enforcing a workspace line coverage minimum in CI across all Rust contracts and packages.
Provide a reusable, configurable gate that CI and contributors can run locally to verify coverage thresholds.
Description
Add scripts/coverage.sh, a small wrapper that requires cargo-llvm-cov, reads COVERAGE_THRESHOLD (default 80), and runs cargo llvm-cov for the root package and the contracts workspace.
Update .github/workflows/ci.yml to install cargo-llvm-cov and run the coverage gate after cargo test with COVERAGE_THRESHOLD: 80.
Update README.md to document local usage (COVERAGE_THRESHOLD=80 scripts/coverage.sh) and to list the new coverage gate in the CI testing stages.
Testing
Ran bash -n scripts/coverage.sh to validate script syntax and it succeeded.
Ran formatting and unit tests with cargo fmt --all -- --check and cargo test, both of which completed successfully in the environment used for validation.
Verified that local coverage execution was skipped when cargo-llvm-cov was not present locally and that CI will install cargo-llvm-cov before running the gate.
Ran git diff --check to confirm no whitespace or diff errors were introduced.
Closes #85