name: Test Coverage
on:
push:
branches: [main, master]
pull_request:
permissions:
contents: read
concurrency:
group: coverage-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
coverage:
name: Test coverage
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@7e38f4b43b4db5c8dd498af069a4f6196df1d067 with:
toolchain: stable
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 - run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
- uses: taiki-e/install-action@83ac0ad63c0167e6f06796fab0fce28db1bf3db0 with:
tool: cargo-tarpaulin
- name: Run tests with coverage
run: cargo tarpaulin --all-features --workspace --timeout 120 --out Xml --out Html
- name: Upload coverage report
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 with:
name: coverage-report
path: |
cobertura.xml
tarpaulin-report.html
- name: Upload coverage to Codecov
if: github.event_name == 'push'
uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac with:
files: ./cobertura.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false