-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (41 loc) · 1.26 KB
/
go.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
name: Go
on:
push:
pull_request:
branches: [ develop, master ]
env:
LATEST_GO_VERSION: "1.16"
GO111MODULE: "on"
jobs:
test:
name: Test on go ${{ matrix.go_version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
go_version: ['1.16']
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version }}
- name: "Fetch dependencies"
run: go mod download
# Only run gofmt, vet & lint against the latest Go version
- name: "Run golint"
if: ${{ matrix.go_version == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest'}}
run: |
go install golang.org/x/lint/golint@latest
golint -set_exit_status $1 ./...
exit $1
- name: "Run gofmt"
if: ${{ matrix.go_version == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest'}}
run: diff -u <(echo -n) <(gofmt -d -e .)
- name: "Run go vet"
if: ${{ matrix.go_version == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest'}}
run: go vet -v ./...
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...