add coverage ci #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Coverage | |
on: | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
components: rustfmt, clippy | |
- name: Install Tarpaulin | |
run: cargo install cargo-tarpaulin | |
- name: Run Tarpaulin and Save Output | |
run: cargo tarpaulin > tarpaulin-output.txt | |
- name: Upload Tarpaulin Output as Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tarpaulin-output | |
path: tarpaulin-output.txt | |
- name: Check Coverage | |
run: | | |
if ! grep -q "100% coverage" tarpaulin-output.txt; then | |
echo "Coverage is below 100%" | |
exit 1 | |
fi |