Skip to content

Commit 6566476

Browse files
sdtttttlouyuting
andauthored
CI: Enhancement GithubActions. (alibaba#241)
* Enhancement Github Actions. Co-authored-by: louyuting <[email protected]>
1 parent 4841426 commit 6566476

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

.github/workflows/go.yml

+21-7
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,45 @@ name: CI
22

33
on:
44
push:
5-
branches: "master"
5+
branches: master
66
pull_request:
77
branches: "*"
88

99
jobs:
1010

1111
build:
12-
name: ubuntu-latest ${{ matrix.config.go_version }}
12+
name: ${{ matrix.os }} - Go ${{ matrix.go_version }}
1313
runs-on: ubuntu-latest
1414
strategy:
15+
# If you want to matrix build , you can append the following list.
1516
matrix:
16-
config:
17-
- go_version: 1.13
18-
- go_version: 1.14
17+
go_version:
18+
- 1.13
19+
- 1.14
20+
os:
21+
- ubuntu-latest
22+
1923
steps:
2024

21-
- name: Set up Go 1.x
25+
- name: Set up Go ${{ matrix.go_version }}
2226
uses: actions/setup-go@v2
2327
with:
24-
go-version: ${{ matrix.config.go_version }}
28+
go-version: ${{ matrix.go_version }}
2529
id: go
2630

2731
- name: Check out code into the Go module directory
2832
uses: actions/checkout@v2
2933

34+
- name: Cache build dependence
35+
uses: actions/cache@v2
36+
with:
37+
# Cache
38+
path: ~/go/pkg/mod
39+
# Cache key
40+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
41+
# An ordered list of keys to use for restoring the cache if no cache hit occurred for key
42+
restore-keys: ${{ runner.os }}-go-
43+
3044
- name: Install goimports
3145
run: go get golang.org/x/tools/cmd/goimports
3246

0 commit comments

Comments
 (0)