Skip to content

Commit a22d44f

Browse files
ci: add code coverage with cargo-llvm-cov and Codecov (#511)
* ci: add code coverage with cargo-llvm-cov and Codecov Add a Coverage workflow that runs on PRs and pushes to main using cargo-llvm-cov with --all-features, uploading LCOV results to Codecov. Include codecov.yml config with project/patch targets and ignore rules for stub files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: switch Codecov upload to OIDC (tokenless) Use GitHub OIDC tokens instead of CODECOV_TOKEN secret so coverage uploads work for fork PRs where secrets are not available. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: fail coverage upload strictly on push, leniently on PRs Use a conditional so pushes to main fail if Codecov upload breaks (preventing silent reporting gaps) while PRs stay lenient to avoid blocking fork PRs where OIDC may not be available. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: disable Codecov auto-detection to suppress warnings We provide lcov.info explicitly, so disable auto-search for gcov, coverage.py, and Xcode formats that produce noisy warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: include channels-src and tools-src in coverage reporting These WASM source directories should be tracked for test coverage rather than ignored. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: remove stale ignore entries from codecov.yml The marketplace, ecommerce, taskrabbit, and restaurant stub files no longer exist in the codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: run coverage on push to main only Avoids running tests twice on PRs (once in test.yml, once for coverage). Coverage runs on merge to main instead. Simplify fail_ci_if_error to always true since it only runs on push now. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a181c8b commit a22d44f

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Code Coverage
2+
on:
3+
push:
4+
branches: [main]
5+
6+
permissions:
7+
id-token: write
8+
contents: read
9+
10+
jobs:
11+
coverage:
12+
name: Coverage
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
- uses: dtolnay/rust-toolchain@stable
17+
with:
18+
components: llvm-tools-preview
19+
- uses: Swatinem/rust-cache@v2
20+
with:
21+
key: coverage
22+
- name: Install cargo-llvm-cov
23+
uses: taiki-e/install-action@cargo-llvm-cov
24+
- name: Generate coverage
25+
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
26+
- name: Upload to Codecov
27+
uses: codecov/codecov-action@v5
28+
with:
29+
files: lcov.info
30+
disable_search: true
31+
use_oidc: true
32+
fail_ci_if_error: true

codecov.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: auto
6+
threshold: 1%
7+
patch:
8+
default:
9+
target: 80%
10+
threshold: 5%

0 commit comments

Comments
 (0)