-
-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (46 loc) · 1.66 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
name: coverage
on:
workflow_run:
workflows: ["ci"]
types:
- completed
pull_request:
types: [review_requested, ready_for_review]
push:
branches:
- main
workflow_dispatch:
jobs:
coverage:
name: coverage
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# at the time of writing workflow_run.head_commit.id appears to be
# the commit that triggered the CI workflow which then triggered us.
ref: ${{ github.event.workflow_run.head_commit.id }}
- name: Install cargo-tarpaulin if needed
run: cargo install --locked cargo-tarpaulin
- name: Generate cargo-tarpaulin code coverage reports
run: cargo tarpaulin --verbose --out Html --out Xml --timeout 300
- name: Upload HTML report to GH Actions workflow artifacts
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: tarpaulin-report.html
- name: Generate Markdown coverage report
uses: irongut/[email protected]
with:
filename: cobertura.xml
format: markdown
output: both
hide_complexity: true
indicators: false
- name: Add Markdown coverage report to workflow summary
run: |
cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
echo >> $GITHUB_STEP_SUMMARY
echo "See the HTML report for more details (see the code-coverage-report workflow artifact)">> $GITHUB_STEP_SUMMARY