name: Coverage
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
rust-coverage:
name: Rust coverage (cargo llvm-cov → Codecov)
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Set up Rust
uses: dtolnay/rust-toolchain@2c7215f132e9ebf062739d9130488b56d53c060c with:
toolchain: stable
components: llvm-tools-preview
- name: Cache cargo build
uses: Swatinem/rust-cache@c8037a86dde8214a8310e9f54a8fc61ab362aa31
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@c509219cf42fba86913069efd0ade2458c59337b with:
tool: cargo-llvm-cov
- name: Generate coverage report
run: cargo llvm-cov --all-targets --lcov --output-path lcov.info
- name: Upload to Codecov
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 with:
files: lcov.info
flags: rust
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false