-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (48 loc) · 1.39 KB
/
coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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