Improve accuracy of coverage reports 231 (#232)

* Add flag to coverage tool to exclude files we don't need to test (#231)

* Add documentation to README for running code coverage tests locally (#231)

---------

Co-authored-by: Natalie Eskinazi <nat@trees.local>
This commit is contained in:
Natalie 2023-02-09 23:01:02 +00:00 committed by GitHub
parent 09f3f36aab
commit c39e95f973
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -38,10 +38,10 @@ jobs:
run: cargo install cargo-llvm-cov
- name: Run tests
run: cargo llvm-cov --lcov --no-report
run: cargo llvm-cov --lcov --no-report --ignore-filename-regex 'tests.rs|benches.rs|gendoc'
- name: Generate coverage report
run: cargo llvm-cov --lcov --no-run --output-path lcov.info
run: cargo llvm-cov report --lcov --ignore-filename-regex 'tests.rs|benches.rs|gendoc' --output-path lcov.info
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3.1.1

View File

@ -35,3 +35,10 @@ dependency.
1. Run tests `cargo test`
2. Run formatter `cargo fmt`
3. Check linter `cargo clippy` and if you want to automatically fix then run `cargo clippy --fix`
## Coverage
Test coverage checks are performed in the pipeline. This is cofigured here: `.github/workflows/coverage.yaml`
To run these locally:
1. Install coverage tool by running `cargo install cargo-llvm-cov`
2. Run `cargo llvm-cov --ignore-filename-regex 'tests.rs|benches.rs|gendoc'` (you may be asked if you want to install `llvm-tools-preview`, if so type `Y`)