name: Code Coverage
on:
push:
branches: [main]
paths-ignore:
- '**.md'
- 'LICENSE'
- '.gitignore'
- 'docs/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
coverage:
name: Generate Coverage Report
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
components: llvm-tools-preview
- name: Install tools
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov,twiggy,wasm-bindgen-cli@0.2.108
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Generate coverage reports (lcov + html)
run: |
cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
cargo llvm-cov report --html
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: coverage
path: |
lcov.info
target/llvm-cov/html
retention-days: 30