covrs 0.2.4

Code coverage ingestion and reporting
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:

env:
  CARGO_TERM_COLOR: always

jobs:
  ci:
    name: Build/lint/test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - uses: Swatinem/rust-cache@v2

      - name: Run CI checks
        run: bash scripts/ci.sh

  fuzz:
    needs: ci
    name: Fuzz
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@nightly

      - uses: Swatinem/rust-cache@v2
        with:
          workspaces: tests/fuzz -> target

      - name: Install cargo-fuzz
        run: cargo install cargo-fuzz

      - name: Fuzz lcov parser
        run: cargo fuzz run --fuzz-dir tests/fuzz fuzz_lcov -- -max_total_time=10

      - name: Fuzz cobertura parser
        run: cargo fuzz run --fuzz-dir tests/fuzz fuzz_cobertura -- -max_total_time=10

      - name: Fuzz diff parser
        run: cargo fuzz run --fuzz-dir tests/fuzz fuzz_diff -- -max_total_time=10

  coverage:
    if: github.event_name == 'pull_request'
    needs: ci
    name: Coverage
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@stable
        with:
          components: llvm-tools

      - uses: Swatinem/rust-cache@v2

      - name: Install cargo-llvm-cov
        uses: taiki-e/install-action@cargo-llvm-cov

      - name: Run tests with coverage
        run: cargo llvm-cov test --lcov --output-path coverage.lcov

      - name: Coverage report
        uses: ./
        with:
          coverage-files: coverage.lcov