1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Coverage
# Generates an lcov coverage report with `cargo-llvm-cov` and uploads it to
# Codecov for line-coverage tracking. Runs on PRs and pushes to `main` so
# the trend graph stays current and PRs can be reviewed with a coverage
# delta in the diff.
#
# ## Set-up checklist (one-time)
#
# 1. Sign in to https://codecov.io with the GitHub org and enable this repo.
# 2. Codecov for OSS public repos does not require a token; for private
# repos add a `CODECOV_TOKEN` secret from the project settings.
on:
push:
branches:
pull_request:
permissions:
contents: read
jobs:
coverage:
name: cargo-llvm-cov
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate coverage report
# `--workspace` covers every crate in the workspace (only one for now).
# `--all-features` exercises every feature flag — currently a no-op
# since we have no features, but future-proof.
# `--lcov` emits a format Codecov understands.
# `--ignore-filename-regex` hides perf_budgets.rs from the report; the
# `--skip` args below also prevent its tests from *running*, since
# they assert wall-clock budgets that llvm-cov's instrumentation
# overhead can blow on shared runners. Every perf_budgets test name
# contains `_under_` or `_target_`; no other test uses those tokens.
run: |
cargo llvm-cov --workspace --all-features --locked \
--ignore-filename-regex 'tests/perf_budgets\.rs' \
--lcov --output-path lcov.info \
-- --skip _under_ --skip _target_
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}