Skip to content

Commit c03ed2d

Browse files
authored
Updates code coverage CI to stable (#538)
Removes pin to nightly and removes the old `-Zprofile` runs and `grcov` based coverage generation in favor of `-C source-instrumentation` which is in stable. This updates the CI to install `llvm-tools-preview` from `rustup` and install a nice wrapper for running source instrumentation called [`cargo-llvm-cov`][1]. We use this wrapper to generate codecov JSON to get region coverage since LCOV style output from source coverage in Rust/LLVM doesn't output branch coverage. [1]: https://crates.io/crates/cargo-llvm-cov
1 parent 5cd8cc8 commit c03ed2d

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

.github/workflows/coverage.yml

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,30 @@ jobs:
1515

1616
steps:
1717
- name: Git Checkout
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v3
1919
with:
2020
submodules: recursive
2121
- name: Rust Toolchain
2222
uses: actions-rs/toolchain@v1
2323
with:
2424
profile: minimal
25-
# Coverage requires the nightly toolchain because it uses the presently unstable `-Z profile` feature
26-
# See: https://github.com/rust-lang/rust/issues/42524
27-
# See also: https://github.com/actions-rs/grcov#usage
28-
toolchain: nightly-2022-12-18 # nightly can be very volatile--pin this to a version we know works well
25+
toolchain: stable
26+
# We need this component to generate source coverage in stable
27+
components: llvm-tools-preview
2928
override: true
30-
- name: Cargo Test
29+
# Wrapper for running coverage with -C instrument-coverage
30+
- name: Cargo Install Coverage Wrapper
3131
uses: actions-rs/cargo@v1
3232
with:
33-
command: test
34-
args: --verbose --workspace --all-features --no-fail-fast
35-
env:
36-
CARGO_INCREMENTAL: '0'
37-
# https://github.com/marketplace/actions/rust-grcov
38-
# For some reason the panic=abort modes don't work for build script...
39-
#RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
40-
#RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
41-
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off'
42-
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off'
43-
- id: coverage
44-
name: Code Coverage
45-
uses: actions-rs/[email protected]
33+
command: install
34+
args: cargo-llvm-cov
35+
- name: Cargo Test w/ Coverage
36+
uses: actions-rs/cargo@v1
37+
with:
38+
command: llvm-cov
39+
args: --verbose --workspace --all-features --no-fail-fast --codecov --output-path codecov.json
4640
- name: Codecov Upload
47-
uses: codecov/codecov-action@v1
41+
uses: codecov/codecov-action@v3
4842
with:
49-
files: ${{ steps.coverage.outputs.report }}
43+
files: codecov.json
44+
fail_ci_if_error: true

0 commit comments

Comments
 (0)