8
8
- name : Setup go
9
9
uses : actions/setup-go@v2
10
10
with :
11
- go-version : ' ^1.16 '
11
+ go-version : ' ^1'
12
12
- name : Checkout repository
13
13
uses : actions/checkout@v2
14
14
- name : Setup golangci-lint
19
19
20
20
# Label of the container job
21
21
test :
22
- # You must use a Linux environment when using service containers or container jobs
23
- runs-on : ubuntu-latest
22
+ strategy :
23
+ matrix :
24
+ os : [ubuntu-latest]
25
+ go : [1.13, 1.14, 1.15, 1.16, 1.17]
26
+ include :
27
+ - os : ubuntu-latest
28
+ go-build : ~/.cache/go-build
29
+ name : ${{ matrix.os }} @ Go ${{ matrix.go }}
30
+ runs-on : ${{ matrix.os }}
31
+ env :
32
+ GO111MODULE : on
33
+ GOPROXY : https://proxy.golang.org
24
34
25
35
# Service containers to run with `container-job`
26
36
services :
@@ -29,21 +39,30 @@ jobs:
29
39
ports :
30
40
- 4222:4222
31
41
32
- env :
33
- GO111MODULE : on
34
- GOPROXY : https://proxy.golang.org
35
42
steps :
36
43
- name : Set up Go ${{ matrix.go }}
37
44
uses : actions/setup-go@v2
45
+ with :
46
+ go-version : ${{ matrix.go }}
38
47
39
48
- name : Checkout Code
40
49
uses : actions/checkout@v2
41
50
with :
42
51
ref : ${{ github.ref }}
43
52
53
+ - uses : actions/cache@v2
54
+ with :
55
+ path : |
56
+ ${{ matrix.go-build }}
57
+ ~/go/pkg/mod
58
+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
59
+ restore-keys : |
60
+ ${{ runner.os }}-go-
44
61
- name : Run Tests
45
62
run : |
46
- go test -v -covermode=atomic -coverprofile=coverage.out .
63
+ go test -v -covermode=atomic -coverprofile=coverage.out
47
64
48
65
- name : Upload coverage to Codecov
49
- uses : codecov/codecov-action@v1
66
+ uses : codecov/codecov-action@v2
67
+ with :
68
+ flags : ${{ matrix.os }},go-${{ matrix.go }}
0 commit comments