name: Code Coverage
on:
pull_request:
branches:
- "main"
push:
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
coverage:
strategy:
fail-fast: false
matrix:
info:
- { os: "macos-latest", target: "aarch64-apple-darwin", cross: false }
- {
os: "ubuntu-latest",
target: "x86_64-unknown-linux-gnu",
cross: false,
}
- {
os: "windows-latest",
target: "x86_64-pc-windows-msvc",
cross: false,
}
runs-on: ${{ matrix.info.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
targets: ${{ matrix.info.target }}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Enable Rust cache
uses: Swatinem/rust-cache@v2.7.3
with:
save-if: false
- name: Generate code coverage
run: cargo llvm-cov --release --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.6.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true