Skip to content

Commit 01e56a4

Browse files
committed
only publish coverage in pull requests
1 parent a7b49a5 commit 01e56a4

File tree

2 files changed

+40
-36
lines changed

2 files changed

+40
-36
lines changed

.github/workflows/coverage.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: coverage
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
coverage:
7+
name: Publish Coverage
8+
needs: check
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
14+
- name: Download coverage artifact
15+
uses: actions/download-artifact@v4
16+
with:
17+
name: coverage-stable
18+
19+
- name: Setup go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: 'stable'
23+
24+
- name: Convert go coverage to cobertura format
25+
run: |
26+
go install github.com/boumenot/gocover-cobertura@latest
27+
gocover-cobertura -by-files < coverage.out > coverage.xml
28+
29+
- name: Get PR number
30+
uses: jwalton/gh-find-current-pr@v1
31+
id: finder
32+
33+
- name: Add Coverage PR Comment
34+
uses: 5monkeys/cobertura-action@master
35+
with:
36+
path: coverage.xml
37+
skip_covered: false
38+
minimum_coverage: 0
39+
fail_below_threshold: true
40+
pull_request_number: ${{ steps.finder.outputs.pr }}

.github/workflows/tests.yml

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -37,42 +37,6 @@ jobs:
3737
name: coverage-${{ matrix.go }}
3838
path: test/coverage.out
3939

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: 0
73-
fail_below_threshold: true
74-
pull_request_number: ${{ steps.finder.outputs.pr }}
75-
7640
test:
7741
name: Docker tests
7842
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)