From 4a6c450340c52299c7ff94896ee56edfef85b8ca Mon Sep 17 00:00:00 2001 From: Vitor Enes Date: Wed, 31 Mar 2021 19:50:53 +0100 Subject: [PATCH] Source-based coverage (#840) * Run grcov and codecov manually in CI * Bump nightly to latest * Run cargo test manually * Run cargo test manually * Run cargo test manually * Use grcov 0.6.1 * Prevent *.profraw overwrites * Add a 30-minute timeout to kvstore-integration-latest CI job * Pin nightly version * Back to cargo test through github action * Parse branch coverage info --- .github/actions-rs/grcov.yml | 6 ------ .github/workflows/test.yml | 28 ++++++++++++++-------------- 2 files changed, 14 insertions(+), 20 deletions(-) delete mode 100644 .github/actions-rs/grcov.yml diff --git a/.github/actions-rs/grcov.yml b/.github/actions-rs/grcov.yml deleted file mode 100644 index d70ee56d0..000000000 --- a/.github/actions-rs/grcov.yml +++ /dev/null @@ -1,6 +0,0 @@ -branch: true -ignore-not-existing: true -llvm: true -output-type: lcov -output-file: ./lcov.info -prefix-dir: /home/user/build/ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 93ca1bd78..b474dcf03 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -131,22 +131,22 @@ jobs: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: - toolchain: nightly + profile: minimal + toolchain: nightly-2021-03-25 override: true - - uses: actions-rs/cargo@v1 - with: - command: clean - uses: actions-rs/cargo@v1 with: command: test-all-features env: - CARGO_INCREMENTAL: "0" - RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=unwind -Zpanic_abort_tests" - - uses: actions-rs/grcov@v0.1 - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ${{ steps.coverage.outputs.report }} - yml: ./codecov.yml - fail_ci_if_error: true + RUSTFLAGS: '-Zinstrument-coverage' + LLVM_PROFILE_FILE: '%m.profraw' + - name: Install grcov + run: | + rustup component add llvm-tools-preview + curl -L https://github.com/mozilla/grcov/releases/download/v0.6.1/grcov-linux-x86_64.tar.bz2 | tar jxf - + - name: Run grcov + run: | + ./grcov . --source-dir . --binary-path ./target/debug/ --output-type lcov --output-path ./lcov.info --branch --ignore-not-existing + - name: Upload to Codecov + run: | + bash <(curl -s https://codecov.io/bash) -f ./lcov.info