2019-11-01 21:18:03 -05:00
|
|
|
on: [push, pull_request]
|
|
|
|
name: tests
|
|
|
|
env:
|
|
|
|
GO111MODULE: on
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-01-26 18:11:21 -05:00
|
|
|
go-version: [1.x, 1.12.x]
|
2020-01-26 14:56:40 -05:00
|
|
|
platform: [ubuntu-latest, windows-latest]
|
2019-11-01 21:18:03 -05:00
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/setup-go@v1
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
2020-01-26 14:56:40 -05:00
|
|
|
- uses: actions/checkout@v2
|
2019-11-01 21:18:03 -05:00
|
|
|
|
|
|
|
- name: Cache go modules
|
2020-01-26 18:11:21 -05:00
|
|
|
uses: actions/cache@v1
|
2019-11-01 21:18:03 -05:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
2020-01-26 14:56:40 -05:00
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
|
2020-01-26 18:11:21 -05:00
|
|
|
restore-keys: ${{ runner.os }}-go-
|
2019-11-01 21:18:03 -05:00
|
|
|
|
|
|
|
- name: Run go fmt
|
2020-01-26 14:56:40 -05:00
|
|
|
if: runner.os != 'Windows'
|
2019-11-01 21:18:03 -05:00
|
|
|
run: diff -u <(echo -n) <(gofmt -d -s .)
|
|
|
|
|
|
|
|
- name: Run go vet
|
|
|
|
run: go vet ./...
|
|
|
|
|
|
|
|
- name: Run go test
|
2020-01-26 14:56:40 -05:00
|
|
|
run: go test -v -race -coverprofile coverage.txt -covermode atomic ./...
|
2019-11-01 21:18:03 -05:00
|
|
|
|
|
|
|
- name: Upload coverage to Codecov
|
2020-01-26 14:56:40 -05:00
|
|
|
uses: codecov/codecov-action@v1
|
2019-11-01 21:18:03 -05:00
|
|
|
with:
|
2020-01-26 14:56:40 -05:00
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|