-
Notifications
You must be signed in to change notification settings - Fork 808
51 lines (43 loc) · 1.25 KB
/
generate-code-coverage.yaml
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
name: Generate Code Coverage
on: [pull_request]
jobs:
cover-base:
name: Generate Base Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout base
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.ref }}
- name: Set up go
uses: actions/setup-go@v4
with:
go-version: '^1.20.2'
- name: Generate report
run: |
go test -coverprofile base-coverage.tmp ./cmd/... ./pkg/...
cat base-coverage.tmp | grep -v "mock_" > base-coverage.out
- name: Upload report
uses: actions/upload-artifact@v3
with:
name: base-coverage
path: base-coverage.out
cover-pr:
name: Generate PR Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v3
- name: Set up go
uses: actions/setup-go@v4
with:
go-version: '^1.20.2'
- name: Generate report
run: |
go test -coverprofile pr-coverage.tmp ./cmd/... ./pkg/...
cat pr-coverage.tmp | grep -v "mock_" > pr-coverage.out
- name: Upload report
uses: actions/upload-artifact@v3
with:
name: pr-coverage
path: pr-coverage.out