Skip to content

Commit 6c2af88

Browse files
authored
Update tests.yaml to use build matrix (#364)
* Update tests.yaml to use build matrix * send coverage report only latest version * fix syntax error
1 parent a8e138f commit 6c2af88

File tree

1 file changed

+15
-55
lines changed

1 file changed

+15
-55
lines changed

.github/workflows/tests.yml

+15-55
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,25 @@
11
name: tests
2-
on:
2+
on:
33
push:
44
pull_request:
55

66
jobs:
7-
87
test:
9-
name: run tests with go 1.16 and code coverage
8+
name: run tests with code coverage
109
runs-on: ubuntu-latest
11-
steps:
12-
- name: Set up Go 1.16
13-
uses: actions/setup-go@v1
14-
with:
15-
go-version: 1.16
16-
id: go
10+
strategy:
11+
matrix:
12+
go:
13+
- "1.16"
14+
- "1.15"
15+
- "1.14"
16+
- "1.13"
1717

18-
- name: Check out code into the Go module directory
19-
uses: actions/checkout@v1
20-
21-
- name: go test
22-
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
23-
24-
- name: Upload coverage to Codecov
25-
uses: codecov/codecov-action@v1
26-
with:
27-
file: ./coverage.txt
28-
29-
test-v115:
30-
name: run tests with go 1.15
31-
runs-on: ubuntu-latest
3218
steps:
33-
- name: Set up Go 1.15
19+
- name: Set up Go ${{ matrix.go }}
3420
uses: actions/setup-go@v1
3521
with:
36-
go-version: 1.15
22+
go-version: ${{ matrix.go }}
3723
id: go
3824

3925
- name: Check out code into the Go module directory
@@ -42,34 +28,8 @@ jobs:
4228
- name: go test
4329
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
4430

45-
test-v114:
46-
name: run tests with go 1.14
47-
runs-on: ubuntu-latest
48-
steps:
49-
- name: Set up Go 1.14
50-
uses: actions/setup-go@v1
51-
with:
52-
go-version: 1.14
53-
id: go
54-
55-
- name: Check out code into the Go module directory
56-
uses: actions/checkout@v1
57-
58-
- name: go test
59-
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
60-
61-
test-v113:
62-
name: run tests with go 1.13
63-
runs-on: ubuntu-latest
64-
steps:
65-
- name: Set up Go 1.13
66-
uses: actions/setup-go@v1
31+
- name: Upload coverage to Codecov
32+
uses: codecov/codecov-action@v1
33+
if: matrix.go == '1.16'
6734
with:
68-
go-version: 1.13
69-
id: go
70-
71-
- name: Check out code into the Go module directory
72-
uses: actions/checkout@v1
73-
74-
- name: go test
75-
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
35+
file: ./coverage.txt

0 commit comments

Comments
 (0)