blob: c28674e3071ec1a4c4db448d6faa4b47ee9e0332 [file] [log] [blame]
on:
push:
branches:
- master
pull_request:
branches:
- master
name: tests
jobs:
test:
strategy:
matrix:
go-version: [1.x, 1.15.x]
platform: [ubuntu-latest]
include:
# only update test coverage stats with most recent go version on linux
- go-version: 1.x
platform: ubuntu-latest
update-coverage: true
runs-on: ${{ matrix.platform }}
steps:
- name: Cancel previous workflow runs
uses: styfle/cancel-workflow-action@89f242ee29e10c53a841bfe71cc0ce7b2f065abc #0.9.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- run: go version
- name: Cache go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Run go test
run: go test -v -race -coverprofile coverage.txt -covermode atomic ./...
- name: Upload coverage to Codecov
if: ${{ matrix.update-coverage }}
uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b #v2.1.0