From 6c2af88d7eaab471902c470046fcc5e136bdf0cf Mon Sep 17 00:00:00 2001 From: Tatsuro Furusawa <48310738+furusax0621@users.noreply.github.com> Date: Wed, 3 Mar 2021 17:40:13 +0900 Subject: [PATCH] Update tests.yaml to use build matrix (#364) * Update tests.yaml to use build matrix * send coverage report only latest version * fix syntax error --- .github/workflows/tests.yml | 70 ++++++++----------------------------- 1 file changed, 15 insertions(+), 55 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 18d58c02..d8276aa2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 @@ -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