Skip to content

Commit 82edde0

Browse files
committed
ci: use the code-coverage logic we use in the FVM
1 parent 377b717 commit 82edde0

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

.github/workflows/check-pr.yml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,22 @@ jobs:
2929
- name: Test Actors
3030
run: make test-actors
3131
code-coverage:
32-
if: github.event.pull_request.draft == false
32+
if: github.event.pull_request.draft == false
3333
runs-on: ubuntu-latest
3434
steps:
35-
- name: Checkout
36-
uses: actions/checkout@v2
37-
38-
- name: Test Libraries
39-
run: make test-coverage
40-
env:
41-
CARGO_INCREMENTAL: '0'
42-
RUSTFLAGS: '-C instrument-coverage -C codegen-units=1 -C llvm-args=--inline-threshold=0 -C overflow-checks=off'
43-
RUSTDOCFLAGS: '-C instrument-coverage -C codegen-units=1 -C llvm-args=--inline-threshold=0 -C overflow-checks=off'
44-
RUSTC_BOOTSTRAP: '1'
45-
46-
- name: Generate Coverage Report
47-
id: coverage
48-
uses: actions-rs/grcov@v0.1
49-
50-
- name: Upload to Coveralls
51-
uses: coverallsapp/github-action@master
52-
with:
53-
github-token: ${{ secrets.GITHUB_TOKEN }}
54-
path-to-lcov: ${{ steps.coverage.outputs.report }}
35+
- name: Checkout
36+
uses: actions/checkout@v2
37+
- name: Installing Cargo llvm-cov
38+
uses: taiki-e/install-action@bc0a06a003a8225fe3e896c9ed3a4c3cc2e8416a
39+
with:
40+
tool: cargo-llvm-cov@0.4.5
41+
- name: Running tests with coverage
42+
run: make ci-test-coverage
43+
- name: Upload coverage to Codecov
44+
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
45+
with:
46+
files: target/coverage/ci-coverage.info
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
# Codecov is flaky and will randomly fail. We'd rather not have random failures on master.
49+
fail_ci_if_error: false
50+
verbose: true

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ test-coverage: install-toolchain
3232
RUSTFLAGS='-Cinstrument-coverage -C codegen-units=1 -C llvm-args=--inline-threshold=0 -C overflow-checks=off' \
3333
LLVM_PROFILE_FILE='target/coverage/raw/cargo-test-%p-%m.profraw' \
3434
cargo test --workspace $(WASM_EXCLUSION)
35+
grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/html
36+
37+
# Just run the tests we want coverage of (for CI)
38+
ci-test-coverage: install-toolchain
39+
rustup component add llvm-tools-preview
40+
cargo llvm-cov --lcov --output-path target/coverage/ci-coverage.info --workspace $(WASM_EXCLUSION)
3541

3642
# separate actor testing stage to run from CI without coverage support
3743
test-actors: install-toolchain
@@ -48,4 +54,3 @@ clean:
4854
# generate local coverage report in html format using grcov
4955
# install it with `cargo install grcov`
5056
local-coverage: test-coveuage
51-
grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage/html

0 commit comments

Comments
 (0)