-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (49 loc) · 1.51 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
on: [push, pull_request]
name: tests
jobs:
test:
strategy:
matrix:
go-version: [1.x]
platform: [ubuntu-latest]
include:
# Upload coverage only on this combination.
- go-version: 1.x
platform: ubuntu-latest
upload-coverage: true
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Download go modules
run: go mod download
- 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: Mod verify
run: go mod verify
- name: Run gofmt
if: runner.os != 'Windows'
run: '[ -z $(gofmt -s -l .) ] || (gofmt -s -d . && exit 1)'
- name: Run go vet
run: go vet ./...
- name: Run golint
run: |
go install golang.org/x/lint/golint
golint `go list ./... | grep -v /vendor/`
- name: Run go test
run: go test -v -race -covermode=atomic -coverprofile=coverage.out ./...
- name: Upload test coverage to Coveralls
if: ${{ matrix.upload-coverage }}
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
GO111MODULE=off go get github.com/mattn/goveralls
$(go env GOPATH)/bin/goveralls -coverprofile=coverage.out -service=github