name: Coverage
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
code: ${{ github.event_name == 'push' || steps.filter.outputs.code == 'true' }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d id: filter
with:
filters: |
code:
- 'src/**'
- 'tests/**'
- 'Cargo.toml'
- 'Cargo.lock'
coverage:
name: Code Coverage
needs: [changes]
if: needs.changes.outputs.code == 'true' && github.event.pull_request.draft != true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - uses: tylerbutler/actions/setup-rust@c4c45a8284082163bc58623acfc4b3dc98633c3d with:
components: llvm-tools-preview
- uses: tylerbutler/actions/install-tools@c4c45a8284082163bc58623acfc4b3dc98633c3d with:
tools: cargo-llvm-cov,cargo-nextest
- name: Generate coverage
run: cargo llvm-cov nextest --all-features --lcov --output-path lcov.info
- uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false