Skip to content

Commit 82d63d0

Browse files
committed
ci: use cargo-llvm-cov to generate code coverage data
The rustc's -Zprofile compiler flag was removed on nightly [1], which means gcov-style coverage instrumentation is no longer possible. [1] rust-lang/rust#131829 Signed-off-by: Renato Westphal <[email protected]>
1 parent 4aab004 commit 82d63d0

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

.github/workflows/ci.yaml

+7-22
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,16 @@ jobs:
4343

4444
test:
4545
name: Tests and Coverage Report
46-
env:
47-
holo: rust_ci_github_actions_workflow
48-
CARGO_INCREMENTAL: 0
49-
RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort
50-
RUSTDOCFLAGS: -Cpanic=abort
51-
permissions:
52-
checks: write
53-
pull-requests: write
5446
runs-on: ubuntu-latest
5547
steps:
5648
- uses: actions/checkout@v4
57-
- uses: dtolnay/rust-toolchain@nightly
58-
- name: Generate test result and coverage report
59-
run: |
60-
cargo install cargo2junit grcov;
61-
cargo test $CARGO_OPTIONS -p holo-bfd -p holo-bgp -p holo-isis -p holo-ldp -p holo-ospf -p holo-rip -- -Z unstable-options --format json | cargo2junit > results.xml;
62-
grcov . -s . -t lcov --llvm --ignore-not-existing --ignore "/*" --ignore "holo-*/tests/*" -o lcov.info;
63-
- name: Upload test results
64-
uses: EnricoMi/publish-unit-test-result-action@v1
65-
if: github.event_name != 'pull_request'
66-
with:
67-
check_name: Test Results
68-
github_token: ${{ secrets.GITHUB_TOKEN }}
69-
files: results.xml
70-
- name: Upload to CodeCov
49+
- name: Install Rust
50+
run: rustup update nightly && rustup default nightly
51+
- name: Install cargo-llvm-cov
52+
uses: taiki-e/install-action@cargo-llvm-cov
53+
- name: Generate code coverage
54+
run: cargo llvm-cov --all-features --codecov --output-path codecov.json -p holo-bfd -p holo-bgp -p holo-isis -p holo-ldp -p holo-ospf -p holo-rip
55+
- name: Upload to Codecov
7156
uses: codecov/codecov-action@v4
7257
if: github.event_name != 'pull_request'
7358
with:

0 commit comments

Comments
 (0)