Skip to content

Commit 3144da9

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

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/tests.yml

+42
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,48 @@ 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+
- name: Checkout code
46+
uses: actions/checkout@v4
47+
48+
- name: Download coverage artifact
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: coverage-stable
52+
53+
- name: Setup go
54+
uses: actions/setup-go@v5
55+
with:
56+
go-version: 'stable'
57+
58+
- name: Convert go coverage to corbetura format
59+
run: |
60+
go install github.com/boumenot/gocover-cobertura@latest
61+
gocover-cobertura -by-files < coverage.out > coverage.xml
62+
63+
- name: Get PR number
64+
uses: jwalton/gh-find-current-pr@v1
65+
id: finder
66+
67+
- name: Add Coverage PR Comment
68+
uses: 5monkeys/cobertura-action@master
69+
with:
70+
path: coverage.xml
71+
skip_covered: false
72+
minimum_coverage: 75
73+
fail_below_threshold: false
74+
pull_request_number: ${{ steps.finder.outputs.pr }}
75+
3476
test:
3577
name: Docker tests
3678
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)