Skip to content

Commit 14e21e6

Browse files
committed
chore(CI): testing in multiple go version
Signed-off-by: Bo-Yi Wu <[email protected]>
1 parent 9bdb838 commit 14e21e6

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

.github/workflows/go.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
- name: Setup go
99
uses: actions/setup-go@v2
1010
with:
11-
go-version: '^1.16'
11+
go-version: '^1'
1212
- name: Checkout repository
1313
uses: actions/checkout@v2
1414
- name: Setup golangci-lint
@@ -19,8 +19,18 @@ jobs:
1919

2020
# Label of the container job
2121
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
2434

2535
# Service containers to run with `container-job`
2636
services:
@@ -29,21 +39,30 @@ jobs:
2939
ports:
3040
- 4222:4222
3141

32-
env:
33-
GO111MODULE: on
34-
GOPROXY: https://proxy.golang.org
3542
steps:
3643
- name: Set up Go ${{ matrix.go }}
3744
uses: actions/setup-go@v2
45+
with:
46+
go-version: ${{ matrix.go }}
3847

3948
- name: Checkout Code
4049
uses: actions/checkout@v2
4150
with:
4251
ref: ${{ github.ref }}
4352

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-
4461
- name: Run Tests
4562
run: |
46-
go test -v -covermode=atomic -coverprofile=coverage.out .
63+
go test -v -covermode=atomic -coverprofile=coverage.out
4764
4865
- 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

Comments
 (0)