name: CI
on:
pull_request:
push:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
build-and-test:
name: Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build all targets
run: cargo build --all-targets --all-features
- name: Run tests
run: cargo test --all-features
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate coverage (lcov)
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Enforce coverage threshold
run: cargo llvm-cov --all-features --workspace --fail-under-lines 70
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: lcov.info
if-no-files-found: error