---
name: Coverage
"on":
pull_request:
push:
branches:
- main
permissions:
contents: read
concurrency:
group: coverage-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
coverage:
name: Test coverage
runs-on: ubuntu-26.04
timeout-minutes: 45
if: >-
github.event_name == 'push' ||
(github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.user.login != 'dependabot[bot]')
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
persist-credentials: false
- name: Cache cargo downloads
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: dl-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
dl-${{ runner.os }}-
- name: Install nightly with LLVM coverage
run: |
rustup toolchain install nightly \
--profile minimal \
--component llvm-tools-preview
- name: Install cargo-llvm-cov and cargo-nextest
uses: taiki-e/install-action@a4d3f3f761dcd95cce1b72cb61cb6d1963438177 with:
tool: cargo-llvm-cov,cargo-nextest
- name: Test coverage
env:
NEXTEST_PROFILE: coverage
run: |
cargo +nightly llvm-cov nextest --workspace --all-targets --locked --no-report
cargo +nightly llvm-cov --workspace --doc --locked --no-clean --lcov --output-path lcov.info
- name: Upload to Codecov
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true