Skip to content

Commit a35caeb

Browse files
committed
Switch to llvm-cov for CI coverage
1 parent e4ec77e commit a35caeb

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

.github/workflows/coverage.yml

+12-18
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,25 @@ jobs:
1818
with:
1919
toolchain: stable
2020
override: true
21+
- name: Install cargo-llvm-cov
22+
uses: taiki-e/install-action@cargo-llvm-cov
2123
- name: Run no-default-features tests with code coverage
2224
uses: actions-rs/cargo@v1
2325
with:
24-
command: test
25-
args: --no-default-features --no-fail-fast
26-
env:
27-
RUSTC_BOOTSTRAP: '1'
28-
CARGO_INCREMENTAL: '0'
29-
RUSTFLAGS: '-Zprofile -Cinstrument-coverage -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
30-
RUSTDOCFLAGS: '-Zprofile -Cinstrument-coverage -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
26+
command: llvm-cov
27+
args: --no-report --no-default-features --no-fail-fast
3128
- name: Run default tests with code coverage
3229
uses: actions-rs/cargo@v1
3330
with:
34-
command: test
35-
args: --all-features --no-fail-fast
36-
env:
37-
RUSTC_BOOTSTRAP: '1'
38-
CARGO_INCREMENTAL: '0'
39-
RUSTFLAGS: '-Zprofile -Cinstrument-coverage -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
40-
RUSTDOCFLAGS: '-Zprofile -Cinstrument-coverage -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
41-
- name: Run grcov
42-
id: coverage
43-
uses: rraval/grcov@master
31+
command: llvm-cov
32+
args: --no-report --all-features --no-fail-fast
33+
- name: Generate Report
34+
uses: actions-rs/cargo@v1
35+
with:
36+
command: llvm-cov
37+
args: report --lcov --output-path lcov.info
4438
- name: Coveralls upload
4539
uses: coverallsapp/github-action@master
4640
with:
4741
github-token: ${{ secrets.GITHUB_TOKEN }}
48-
path-to-lcov: ${{ steps.coverage.outputs.report }}
42+
path-to-lcov: lcov.info

bb.edn

+11-9
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,18 @@
2121
clippy {:doc "Runs all variations of cargo clippy"
2222
:depends [cargo-clippy-all-features cargo-clippy-no-defaults cargo-clippy-examples]}
2323
cov-all-features {:doc "Coverage, all features"
24-
:task (shell {:extra-env code-cov-env} "cargo test --all-features")}
24+
:task (shell {:extra-env code-cov-env} "cargo llvm-cov --no-report --all-features")}
2525
cov-std-only {:doc "Coverage, std only"
26-
:task (shell {:extra-env code-cov-env} "cargo test --no-default-features")}
26+
:task (shell {:extra-env code-cov-env} "cargo llvm-cov --no-report --no-default-features")}
2727
cov-examples {:doc "Coverage, examples"
28-
:task (shell {:extra-env code-cov-env} "cargo test --examples")}
29-
clean-cov {:doc "Cleans all .profraw files and generated html"
30-
:task (fs/delete-tree "target/coverage")}
31-
grcov {:doc "Runs grcov to generate human readable html"
32-
:task (shell "grcov target/coverage --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing -o target/coverage/html")}
33-
coverage {:doc "Generates coverage in human friendly html in target/coverage/"
34-
:depends [clean-cov cov-all-features cov-std-only cov-examples grcov]}
28+
:task (shell {:extra-env code-cov-env} "cargo llvm-cov --no-report --examples")}
29+
cov-clean {:doc "Cleans all .profraw files and generated html"
30+
:task (shell "cargo llvm-cov clean --workspace")}
31+
cov-report {:doc "Runs llvm-cov"
32+
:task (shell "cargo llvm-cov")}
33+
cov-html {:doc "Runs llvm-cov to generate human readable html"
34+
:task (shell "cargo llvm-cov --html")}
35+
coverage {:doc "Generates coverage in human friendly html in target/llvm-cov/html/index.html"
36+
:depends [cov-clean cov-all-features cov-std-only cov-examples cov-html cov-report]}
3537
test {:doc "Runs all tests and checks"
3638
:depends [cargo-test cargo-fmt clippy]}}}

0 commit comments

Comments
 (0)