Skip to content

Commit a1aaa2f

Browse files
committed
publish coverage in github pull requests
1 parent a49296b commit a1aaa2f

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/tests.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,49 @@ jobs:
3131
- name: Run checks
3232
run: make get-deps check
3333

34+
- name: Upload coverage artifact
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: coverage-${{ matrix.go }}
38+
path: test/coverage.out
39+
40+
coverage:
41+
name: Publish Coverage
42+
needs: check
43+
runs-on: ubuntu-latest
44+
steps:
45+
steps:
46+
- name: Checkout code
47+
uses: actions/checkout@v4
48+
49+
- name: Download coverage artifact
50+
uses: actions/download-artifact@v4
51+
with:
52+
name: coverage-stable
53+
54+
- name: Setup go
55+
uses: actions/setup-go@v5
56+
with:
57+
go-version: 'stable'
58+
59+
- name: Convert go coverage to corbetura format
60+
run: |
61+
go install github.com/boumenot/gocover-cobertura@latest
62+
gocover-cobertura -by-files < coverage.out > coverage.xml
63+
64+
- name: Get PR number
65+
uses: jwalton/gh-find-current-pr@v1
66+
id: finder
67+
68+
- name: Add Coverage PR Comment
69+
uses: 5monkeys/cobertura-action@master
70+
with:
71+
path: coverage.xml
72+
skip_covered: false
73+
minimum_coverage: 75
74+
fail_below_threshold: false
75+
pull_request_number: ${{ steps.finder.outputs.pr }}
76+
3477
test:
3578
name: Docker tests
3679
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)