name: Coverage
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install Rust nightly
uses: dtolnay/rust-toolchain@be39649afda95dbf70f87cce95f68b8d5797b296 with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@ab4220e067fa624f7930084426dbfb7440a52829
- name: Cache cargo registry and build
uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6
- name: Generate main coverage report
run: cargo llvm-cov --all-features --workspace --branch --tests --benches --lcov --output-path lcov-main.info
- name: Generate diesel E2E Sqlite coverage report
run: cargo llvm-cov --manifest-path integration-tests/diesel-e2e/Cargo.toml --branch --test sqlite_e2e --lcov --output-path lcov-diesel-e2e.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 with:
files: lcov-main.info,lcov-diesel-e2e.info
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}