name: Coverage

on:
  workflow_call:
    secrets:
      CODECOV_TOKEN:
        required: false

jobs:
  coverage:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: dtolnay/rust-toolchain@stable
      - uses: taiki-e/install-action@cargo-llvm-cov
      - uses: taiki-e/install-action@cargo-nextest
      - uses: Swatinem/rust-cache@v2
        with:
          shared-key: ubuntu-latest-stable
          save-if: false
      - run: cargo llvm-cov --features "parallel,serde" --lcov --output-path lcov.info
      - uses: codecov/codecov-action@v5
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: lcov.info
          fail_ci_if_error: false
