Skip to content

Dev

Dev #6

Workflow file for this run

name: coverage
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
MIN_COVERAGE: 80
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-tarpaulin
uses: taiki-e/install-action@cargo-tarpaulin
- name: Run tests
run: cargo test
- name: Generate coverage report
run: |
# Clean any previous reports
rm -f tarpaulin-report.html
rm -f coverage.xml
# Run tarpaulin with coverage threshold
cargo tarpaulin --verbose \
--workspace \
--timeout 120 \
--out xml \
--out html \
--output-dir coverage \
--minimum-coverage $MIN_COVERAGE
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/coverage.xml
fail_ci_if_error: true
verbose: true
# Archive coverage reports as artifacts
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: coverage/
retention-days: 7