name: Coverage

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  coverage:
    runs-on: macos-latest
    env:
      CARGO_TERM_COLOR: always
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/actions/setup-build
        with:
          cache: false
          components: llvm-tools
      - uses: SierraSoftworks/setup-grcov@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          version: latest
      - run: cargo make cov lcov
      - uses: codecov/codecov-action@v4
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: ./coverage
          disable_search: true
          fail_ci_if_error: true
