name: Coverage Enforcement
on:
pull_request:
push:
branches: [main, master]
jobs:
coverage:
name: Enforce 85% Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Generate coverage
run: |
cargo llvm-cov --features "local,tokio-runtime,cli,mmap,http,hf-hub,shuffle,format-encryption,format-signing,format-streaming,repl" \
--fail-under-lines 85 \
--lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: lcov.info
fail_ci_if_error: false