ci: switch code coverage to grcov

This commit is contained in:
Quentin Gliech
2021-10-06 12:18:38 +02:00
parent 3ee57a0a61
commit a2671fcce8

View File

@@ -256,9 +256,10 @@ jobs:
id: toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
target: x86_64-unknown-linux-musl
override: true
components: llvm-tools-preview
- name: Setup Cargo cache
uses: actions/cache@v2.1.6
@@ -279,14 +280,34 @@ jobs:
${{ runner.os }}-cargo-coverage-${{ steps.toolchain.outputs.rustc_hash }}-
${{ runner.os }}-cargo-coverage-
- name: Run cargo tarpaulin
uses: actions-rs/tarpaulin@v0.1
- name: Download grcov
run: |
mkdir -p "${HOME}/.local/bin"
curl -sL https://github.com/mozilla/grcov/releases/latest/download/grcov-linux-x86_64.tar.bz2 | tar -jxf - -C "${HOME}/.local/bin"
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Run test suite with profiling enabled
uses: actions-rs/cargo@v1
with:
version: '0.18.2'
args: '--avoid-cfg-tarpaulin'
command: test
args: --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zinstrument-coverage'
RUSTDOCFLAGS: "-Cpanic=abort -Zinstrument-coverage -Zunstable-options --persist-doctests ${{ github.workspace }}/target/debug/doctestbins"
LLVM_PROFILE_FILE: "cargo-test-%p-%m.profraw"
- name: Build grcov report
run: |
mkdir -p target/coverage
grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/tests.lcov
grcov . --binary-path ./target/debug/doctestbins/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/doctests.lcov
- name: Upload to codecov.io
uses: codecov/codecov-action@v2
with:
files: target/coverage/*.lcov
build-image: