Skip to content

Commit 3bee145

Browse files
committed
workflows/check: Add test coverage report
1 parent 9a42f07 commit 3bee145

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/check.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,33 @@ jobs:
145145
submodules: true
146146
- name: Install stable
147147
uses: dtolnay/rust-toolchain@stable
148+
with:
149+
# For grcov
150+
components: llvm-tools
148151
- name: cargo install cargo-hack
149152
uses: taiki-e/install-action@cargo-hack
150153
- name: cargo test
151154
run: cargo hack --feature-powerset --exclude-features defmt test --all-targets --locked
155+
env:
156+
RUSTFLAGS: '-C instrument-coverage'
157+
CARGO_INCREMENTAL: '0'
152158
# After ensuring tests pass, finally ensure the test code itself contains no clippy warnings
153159
# Cap lints to avoid complaints about possible panics in our tests
154160
- name: cargo clippy
155161
run: |
156162
cargo clippy --locked --tests -- --cap-lints allow
163+
# Generate and upload test coverage report
164+
- name: Install grcov
165+
uses: taiki-e/install-action@grcov
166+
- name: Generate test coverage report
167+
run: |
168+
grcov . --binary-path ./target/debug/deps -s . --branch --ignore-not-existing --ignore "/home/runner/*" -t html -o ./target/debug/coverage
169+
grcov . --binary-path ./target/debug/deps -s . --branch --ignore-not-existing --ignore "/home/runner/*" -t markdown >> $GITHUB_STEP_SUMMARY
170+
- name: Upload test coverage report
171+
uses: actions/upload-artifact@v4
172+
with:
173+
name: test-coverage-report
174+
path: ./target/debug/coverage
157175

158176
msrv:
159177
# check that we can build using the minimal rust version that is specified by this crate

0 commit comments

Comments
 (0)