1
1
name : Go
2
2
on :
3
3
push :
4
- branches : [master]
4
+ branches : [ master ]
5
+ paths :
6
+ - ' **.go'
7
+ - ' go.mod'
8
+ - ' .golangci.yml'
9
+ - ' .github/workflows/go.yml'
5
10
pull_request :
11
+ paths :
12
+ - ' **.go'
13
+ - ' go.mod'
14
+ - ' .golangci.yml'
15
+ - ' .github/workflows/go.yml'
6
16
env :
7
17
GOPROXY : " https://proxy.golang.org"
8
18
@@ -18,32 +28,34 @@ jobs:
18
28
with :
19
29
version : latest
20
30
args : --timeout=30m
31
+ - name : Check Go module tidiness
32
+ shell : bash
33
+ run : |
34
+ go mod tidy
35
+ STATUS=$(git status --porcelain go.mod go.sum)
36
+ if [ ! -z "$STATUS" ]; then
37
+ echo "Running go mod tidy modified go.mod and/or go.sum"
38
+ exit 1
39
+ fi
21
40
22
41
test :
23
42
name : Test
24
43
strategy :
25
44
matrix :
26
- go-version : [1.14 .x, 1.15 .x, 1.16.x ]
27
- platform : [ubuntu-latest, macos-latest, windows-latest]
45
+ go-version : [ 1.16 .x, 1.17 .x, 1.18.x ]
46
+ platform : [ ubuntu-latest, macos-latest, windows-latest ]
28
47
runs-on : ${{ matrix.platform }}
29
48
steps :
30
49
- name : Install Go
31
- uses : actions/setup-go@v1
50
+ uses : actions/setup-go@v2
32
51
with :
33
52
go-version : ${{ matrix.go-version }}
34
53
- name : Checkout code
35
54
uses : actions/checkout@v2
36
- - name : Run unit tests
55
+ - name : Run tests with coverage
37
56
run : go test -v -race -coverprofile=coverage -covermode=atomic ./...
38
57
- name : Upload coverage report to Codecov
39
- uses : codecov/codecov-action@v1.0.6
58
+ uses : codecov/codecov-action@v1.5.0
40
59
with :
41
60
file : ./coverage
42
61
flags : unittests
43
- - name : Cache downloaded modules
44
- uses : actions/cache@v1
45
- with :
46
- path : ~/go/pkg/mod
47
- key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
48
- restore-keys : |
49
- ${{ runner.os }}-go-
0 commit comments