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
name: Coverage
on:
push:
branches:
pull_request:
branches:
permissions:
contents: read
jobs:
coverage:
name: Test coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
# Nightly is the canonical accurate-coverage toolchain: the crate's
# 26 `#[cfg_attr(coverage_nightly, coverage(off))]` annotations
# (host-, network-, env-, and platform-dependent code) only take
# effect under the `coverage_nightly` cfg cargo-llvm-cov sets on
# nightly. On stable those exclusions compile to nothing, so the
# gate would measure untestable code and drift with the host GPU.
- uses: dtolnay/rust-toolchain@nightly
with:
components: llvm-tools-preview
- uses: swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
# Measure the headless core. The `ui` feature (now on by default)
# is egui rendering + OS tray glue that isn't unit-testable, so we
# gate coverage on `--no-default-features` to keep the number
# meaningful (the UI still gets clippy + tests in checks.yml).
- name: Run coverage
run: |
cargo +nightly llvm-cov --workspace --no-default-features \
--ignore-filename-regex 'src/main\.rs$|src/engine/sdcpp\.rs$|src/ws/session\.rs$' \
--fail-under-lines 90 \
--summary-only
- name: Upload lcov to Codecov
if: success()
run: |
cargo +nightly llvm-cov --workspace --no-default-features \
--ignore-filename-regex 'src/main\.rs$|src/engine/sdcpp\.rs$|src/ws/session\.rs$' \
--lcov --output-path lcov.info
continue-on-error: true