name: Coverage
on:
pull_request:
push:
branches: [main]
jobs:
llvm-cov:
name: llvm-cov (ubuntu)
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust (stable)
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Run coverage (LCOV)
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Run coverage (HTML)
run: cargo llvm-cov --all-features --workspace --html --output-dir target/llvm-cov/html
- name: Upload LCOV to Codecov
if: ${{ success() && vars.USE_CODECOV == 'true' }}
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: true
- name: Upload HTML coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: target/llvm-cov/html
if-no-files-found: error