Skip to content

Commit

Permalink
Update tests.yaml to use build matrix (#364)
Browse files Browse the repository at this point in the history
* Update tests.yaml to use build matrix

* send coverage report only latest version

* fix syntax error
  • Loading branch information
furusax0621 authored Mar 3, 2021
1 parent a8e138f commit 6c2af88
Showing 1 changed file with 15 additions and 55 deletions.
70 changes: 15 additions & 55 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,25 @@
name: tests
on:
on:
push:
pull_request:

jobs:

test:
name: run tests with go 1.16 and code coverage
name: run tests with code coverage
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v1
with:
go-version: 1.16
id: go
strategy:
matrix:
go:
- "1.16"
- "1.15"
- "1.14"
- "1.13"

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: go test
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./coverage.txt

test-v115:
name: run tests with go 1.15
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.15
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v1
with:
go-version: 1.15
go-version: ${{ matrix.go }}
id: go

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

test-v114:
name: run tests with go 1.14
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: go test
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...

test-v113:
name: run tests with go 1.13
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: matrix.go == '1.16'
with:
go-version: 1.13
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: go test
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
file: ./coverage.txt

0 comments on commit 6c2af88

Please sign in to comment.