Attempt to fix coverage by copying Zebra workflow

This commit is contained in:
Conrado Gouvea 2021-11-18 14:42:52 -03:00 committed by Deirdre Connolly
parent a32ae3fc87
commit e615db7170
1 changed files with 12 additions and 31 deletions

View File

@ -1,6 +1,7 @@
name: CI
name: Coverage
on:
workflow_dispatch:
pull_request:
branches:
- main
@ -11,11 +12,13 @@ on:
jobs:
coverage:
name: Coverage
name: Coverage (+nightly)
timeout-minutes: 30
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v2.4.0
with:
persist-credentials: false
- uses: actions-rs/toolchain@v1.0.7
with:
@ -24,35 +27,13 @@ jobs:
profile: minimal
components: llvm-tools-preview
- name: Install rustfilt symbol demangler
run: |
cargo install rustfilt
- name: Install cargo-llvm-cov cargo command
run: cargo install cargo-llvm-cov
- name: Rerun tests for coverage
- 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
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
- 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"
CARGO_INCREMENTAL: 0
run: cargo llvm-cov --lcov > lcov.info
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v1.5.2
uses: codecov/codecov-action@v2.1.0