Skip to content

Commit 09a8697

Browse files
committed
ci(coverage): fix llvm-cov report invocation and add job timeout
The `report` subcommand does not accept `--workspace`/`--exclude` (those are specific to the test-running form), which failed the summary and HTML steps. Switch to the canonical collect-once/report-many pattern: `--no-report` gathers coverage (excluding my-llvm), then `report` renders the floor gate, summary, LCOV, and HTML from the collected data. Also add timeout-minutes to the job. https://claude.ai/code/session_014uKLLhZiAGNayhLjdxGXUx
1 parent c5f6646 commit 09a8697

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
coverage:
3838
name: llvm-cov
3939
runs-on: ubuntu-latest
40+
timeout-minutes: 30
4041
permissions:
4142
contents: read
4243
steps:
@@ -51,30 +52,35 @@ jobs:
5152
- name: Install cargo-llvm-cov
5253
run: cargo install cargo-llvm-cov --locked
5354

54-
# Coverage gate. --fail-under-lines must mirror COVERAGE_FLOOR. The LLVM
55-
# back end (my-llvm) needs a system LLVM toolchain, so it is excluded here
56-
# to keep the job hermetic; everything else in the workspace is measured.
57-
- name: Measure coverage (enforce floor)
58-
run: |
59-
cargo llvm-cov \
60-
--workspace \
61-
--exclude my-llvm \
62-
--lcov --output-path lcov.info \
63-
--fail-under-lines "${COVERAGE_FLOOR}"
55+
# Collect coverage once, then render multiple reports from the same data.
56+
# The LLVM back end (my-llvm) needs a system LLVM toolchain, so it is
57+
# excluded here to keep the job hermetic; everything else is measured.
58+
# NOTE: --workspace/--exclude are only valid on the test-running form, not
59+
# on the `report` subcommand, which renders the already-collected data.
60+
- name: Collect coverage
61+
run: cargo llvm-cov --no-report --workspace --exclude my-llvm
62+
63+
# Coverage gate. --fail-under-lines must mirror COVERAGE_FLOOR.
64+
- name: Enforce coverage floor
65+
run: cargo llvm-cov report --fail-under-lines "${COVERAGE_FLOOR}"
6466

6567
- name: Coverage summary
6668
if: always()
6769
run: |
6870
{
6971
echo '## Coverage summary'
7072
echo '```'
71-
cargo llvm-cov report --workspace --exclude my-llvm --summary-only
73+
cargo llvm-cov report --summary-only
7274
echo '```'
7375
} >> "$GITHUB_STEP_SUMMARY"
7476
77+
- name: Generate LCOV report
78+
if: always()
79+
run: cargo llvm-cov report --lcov --output-path lcov.info
80+
7581
- name: Generate HTML report
7682
if: always()
77-
run: cargo llvm-cov report --workspace --exclude my-llvm --html --output-dir coverage-html
83+
run: cargo llvm-cov report --html --output-dir coverage-html
7884

7985
- name: Upload coverage reports
8086
if: always()

0 commit comments

Comments
 (0)