Skip to content

Commit

Permalink
ci: improve the codecov workflow
Browse files Browse the repository at this point in the history
* proper caching of the librocksdb-sys crate
* use the beta compiler which has -Cinstrument-coverage stabilized.
  We can move to stable once 1.60.0 is released
  • Loading branch information
bmwill committed Apr 5, 2022
1 parent 260cbc2 commit 9ce105b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
- '!(explorer|doc|.github)/**'
- '.github/workflows/bench.yml'
codecov-grcov:
name: Generate code coverage
needs: diff
Expand All @@ -33,20 +32,23 @@ jobs:
strategy:
fail-fast: true
steps:
- name: install toolchain according to rust-toolchain
uses: actions-rs/toolchain@v1
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
toolchain: beta # temporarily use beta till 'instrument-coverage' stabilizes in 1.60
profile: default
override: true
components: llvm-tools-preview
- name: Checkout sources
uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v1
# Enable caching of the 'librocksdb-sys' crate by additionally caching the
# 'librocksdb-sys' src directory which is managed by cargo
- uses: bmwill/rust-cache@v1 # Fork of 'Swatinem/rust-cache' which allows caching additional paths
with:
path: ~/.cargo/registry/src/**/librocksdb-sys-*
- name: Install grcov, and cache the binary
uses: baptiste0928/cargo-install@v1
with:
crate: grcov
locked: true
- name: Build
uses: actions-rs/cargo@v1
with:
Expand All @@ -59,9 +61,8 @@ jobs:
RUSTFLAGS: '-Cinstrument-coverage'
RUSTDOCFLAGS: '-Cinstrument-coverage'
LLVM_PROFILE_FILE: 'codecov-instrumentation-%p-%m.profraw'
run: |
cargo test
run: cargo test
- name: Run grcov
run: grcov . --binary-path target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov
- name: Upload to codecov.io
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v1

0 comments on commit 9ce105b

Please sign in to comment.