Skip to content
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

Replace bespoke source-based coverage config with cargo-llvm-cov #2286

Merged
merged 5 commits into from
Jun 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 8 additions & 20 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
persist-credentials: false

- uses: actions-rs/toolchain@v1
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: nightly
teor2345 marked this conversation as resolved.
Show resolved Hide resolved
override: true
Expand All @@ -30,28 +30,16 @@ jobs:
- name: Install rustfilt symbol demangler
run: |
cargo install rustfilt
- name: Rerun tests for coverage

- name: Install cargo-llvm-cov cargo command
run: |
cargo install cargo-llvm-cov --version ^0.1.0-alpha.4

- name: Generate code coverage
env:
RUSTFLAGS: -Zinstrument-coverage -C link-dead-code -C debuginfo=2
LLVM_PROFILE_FILE: "${{ github.workspace }}/test.%p.profraw"
ZEBRA_SKIP_NETWORK_TESTS: 1
dconnolly marked this conversation as resolved.
Show resolved Hide resolved
CARGO_INCREMENTAL: 0
dconnolly marked this conversation as resolved.
Show resolved Hide resolved
run: |
cargo test
cargo test --no-run --message-format=json | jq -r "select(.profile.test == true) | .filenames[]" | grep -v dSYM - > filenames.txt
- name: Merge coverage data
run: |
$(rustc --print target-libdir)/../bin/llvm-profdata merge test.*.profraw -o test.profdata
- name: Generate detailed html coverage report for github artifact
run: |
$(rustc --print target-libdir)/../bin/llvm-cov show -format=html -ignore-filename-regex=".*/.cargo/registry/.*" -ignore-filename-regex=".*/.cargo/git/.*" -ignore-filename-regex=".*/.rustup/.*" -Xdemangler=rustfilt -show-instantiations -output-dir=./coverage -instr-profile=./test.profdata $(printf -- "-object %s " $(cat filenames.txt))
- uses: actions/upload-artifact@v2
with:
name: coverage
path: ./coverage
run: cargo llvm-cov --lcov > lcov.info

- name: Generate lcov coverage report for codecov
run: |
$(rustc --print target-libdir)/../bin/llvm-cov export -format=lcov -instr-profile=test.profdata $(printf -- "-object %s " $(cat filenames.txt)) > "lcov.info"
- name: Upload coverage report to Codecov
uses: codecov/[email protected]