# Coverage workflow - generates coverage report and uploads to Coveralls
name: Coverage
on:
  push:
    branches:
      - master
  pull_request:
permissions:
  contents: read
env:
  CARGO_TERM_COLOR: always
jobs:
  coverage:
    name: Coverage
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Install Rust toolchain
        uses: actions-rust-lang/setup-rust-toolchain@v1
        with:
          toolchain: stable
          components: llvm-tools
      - name: Install cargo-llvm-cov
        uses: taiki-e/install-action@v2
        with:
          tool: cargo-llvm-cov
      - name: Generate coverage report
        run: cargo llvm-cov --workspace --lcov --output-path lcov.info
      - name: Upload to Coveralls
        uses: coverallsapp/github-action@v2
        with:
          files: lcov.info
          format: lcov
