From 28c3a23f1462a133b194dec97521a6e3c0fe4a7f Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Mon, 14 Jun 2021 21:35:26 -0400 Subject: [PATCH] Replace bespoke source-based coverage config with cargo-llvm-cov (#2286) * Replace bespoke source-based coverage config with cargo-llvm-cov * Keep incremental builds disabled * Use cargo-llvm-cov ^0.1.0-alpha.4 Co-authored-by: teor --- .github/workflows/coverage.yml | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 4e3c26f5..fe6102fc 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -20,7 +20,7 @@ jobs: with: persist-credentials: false - - uses: actions-rs/toolchain@v1 + - uses: actions-rs/toolchain@v1.0.7 with: toolchain: nightly override: true @@ -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 CARGO_INCREMENTAL: 0 - 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/codecov-action@v1.5.2