name: Coverage
on:
push:
branches: [ "main", "master" ]
pull_request:
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
- name: Set up Rust
uses: dtolnay/rust-toolchain@1.99.1
- name: Cache cargo
uses: Swatinem/rust-cache@v2.9.3
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov --locked
- name: Run coverage
run: |
set -euo pipefail
cargo llvm-cov --lcov --output-path coverage.out
cargo llvm-cov -q | awk '/^Filename/ { next } /^TOTAL/ { printf "total: (lines) %.2f%%\n", $10; next } NF > 0 { printf "✓ %s (lines: %.2f%%)\n", $1, $10 }'
total=$(cargo llvm-cov -q | awk '/^TOTAL/ { print $10 }')
total=${total%%%}
awk -v t="$total" 'BEGIN { exit (t + 0 < 90) }'