-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (31 loc) · 983 Bytes
/
go-test-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
name: Go Test and Coverage
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
name: Run Tests and Upload Coverage to Codecov
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.22.x
- name: Run tests and get coverage
run: |
mkdir -p coverage
go test ./test/... -coverpkg=./pkg/... -coverprofile=coverage.out
go test -v -race -cover -covermode=atomic ./test/... -coverpkg=./pkg/... -coverprofile=coverage/coverage.out -shuffle=on
go tool cover -func=coverage/coverage.out
go tool cover -html=coverage/coverage.out -o coverage/coverage.html
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/coverage.out