9
9
pull_request :
10
10
11
11
jobs :
12
+ lint :
13
+ name : Lint
14
+ runs-on : ubuntu-latest
15
+ steps :
16
+ - name : Check out code into the Go module directory
17
+ uses : actions/checkout@v2
18
+ - name : Set up Go
19
+ uses : actions/setup-go@v2
20
+ with :
21
+ go-version : 1.16
22
+ - name : Lint
23
+ uses : golangci/golangci-lint-action@v2
24
+ with :
25
+ version : v1.42
26
+ args : --verbose
12
27
unit-tests :
13
28
strategy :
14
29
matrix :
15
- go-version : [ 1.16 ]
16
- os : [ ubuntu-latest, macos-latest, windows-latest ]
30
+ go-version : [1.16]
31
+ os : [ubuntu-latest, macos-latest, windows-latest]
17
32
runs-on : ${{ matrix.os }}
18
33
steps :
19
- -
20
- name : Checkout
34
+ - name : Checkout
21
35
uses : actions/checkout@v2
22
36
with :
23
37
fetch-depth : 0
24
- -
25
- name : Set up Go
38
+ - name : Set up Go
26
39
uses : actions/setup-go@v2
27
40
with :
28
41
go-version : ${{ matrix.go-version }}
29
- -
30
- name : Cache Go modules
31
- uses : actions/cache@v1
42
+ - name : Cache Go modules
43
+ uses : actions/cache@v2
32
44
with :
33
- path : ~/go/pkg/mod
45
+ path : |
46
+ ~/.cache/go-build
47
+ ~/go/pkg/mod
34
48
key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
35
49
restore-keys : |
36
50
${{ runner.os }}-go-
37
- -
38
- name : Setup
51
+ - name : Setup
39
52
run : make setup
40
- -
41
- name : Make Unit Tests
53
+ - name : Make Unit Tests
42
54
run : make test
43
- -
44
- name : Diff
55
+ - name : Upload Code Coverage
56
+ uses : codecov/codecov-action@v2
57
+ with :
58
+ flags : unit-tests,${{ matrix.os }}
59
+ token : ${{ secrets.CODECOV_TOKEN }}
60
+ - name : Diff
45
61
run : git diff
46
62
goreleaser :
47
63
strategy :
48
64
matrix :
49
- go-version : [ 1.16 ]
65
+ go-version : [1.16]
50
66
runs-on : ubuntu-latest
51
67
if : startsWith(github.ref, 'refs/tags/')
52
68
needs :
@@ -61,17 +77,18 @@ jobs:
61
77
with :
62
78
go-version : ${{ matrix.go-version }}
63
79
- name : Cache Go modules
64
- uses : actions/cache@v1
80
+ uses : actions/cache@v2
65
81
with :
66
- path : ~/go/pkg/mod
82
+ path : |
83
+ ~/.cache/go-build
84
+ ~/go/pkg/mod
67
85
key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
68
86
restore-keys : |
69
87
${{ runner.os }}-go-
70
88
- name : Setup
71
89
run : make setup
72
90
- name : Make build
73
- run : make build
74
-
91
+ run : make build
75
92
- name : Run GoReleaser
76
93
uses : goreleaser/goreleaser-action@v2
77
94
if : success()
80
97
args : release --rm-dist
81
98
env :
82
99
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
83
-
0 commit comments