Skip to content

Commit 1f98ee6

Browse files
authored
[ci] also generate coverage report for doctests (#1081)
Per #1080.
1 parent ef523d1 commit 1f98ee6

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

.github/workflows/coverage.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on:
22
push:
3-
branches: [ main, auto, canary ]
3+
branches: [main, auto, canary]
44
pull_request:
55
branches:
66
- main
@@ -18,18 +18,23 @@ jobs:
1818
CARGO_TERM_COLOR: always
1919
steps:
2020
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
21-
- uses: dtolnay/rust-toolchain@stable
21+
# Nightly Rust is used for cargo llvm-cov --doc below.
22+
- uses: dtolnay/rust-toolchain@nightly
2223
with:
2324
components: llvm-tools-preview
2425
- uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2
25-
26+
2627
- name: Install latest nextest release
2728
uses: taiki-e/install-action@nextest
2829
- name: Install cargo-llvm-cov
2930
uses: taiki-e/install-action@cargo-llvm-cov
30-
31+
3132
- name: Collect coverage data
32-
run: cargo llvm-cov nextest --lcov --output-path lcov.info
33+
# Generate separate reports for nextest and doctests, and combine them.
34+
run: |
35+
cargo llvm-cov --no-report nextest
36+
cargo llvm-cov --no-report --doc
37+
cargo llvm-cov report --doctests --lcov --output-path lcov.info
3338
- name: Upload coverage data to codecov
3439
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3
3540
with:

0 commit comments

Comments
 (0)