-
Notifications
You must be signed in to change notification settings - Fork 11
56 lines (54 loc) · 1.63 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
53
54
55
56
name: Go
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: true
max-parallel: 2
matrix:
go: ["stable", "oldstable"]
steps:
- name: Set up Go ${{matrix.go}}
uses: actions/setup-go@v3
with:
go-version: ${{matrix.go}}
check-latest: true
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Lint code
run: |
gofiles=$(find ./ -name '*.go') && [ -z "$gofiles" ] || unformatted=$(goimports -l $gofiles) && [ -z "$unformatted" ] || (echo >&2 "Go files must be formatted with gofmt. Following files has problem: $unformatted" && true);
diff <(echo -n) <(gofmt -s -d .)
export PATH=$PATH:$(go env GOPATH)/bin # temporary fix. See https://github.com/actions/setup-go/issues/14
go install golang.org/x/lint/golint@latest
golint ./...
- name: Static code check
run: |
export PATH=$PATH:$(go env GOPATH)/bin
go install github.com/gordonklaus/ineffassign@latest
ineffassign ./...
go vet ./...
- name: Build
run: go build -v .
test:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: true
max-parallel: 2
matrix:
go: ["stable", "oldstable"]
steps:
- name: Set up Go ${{matrix.go}}
uses: actions/setup-go@v3
with:
go-version: ${{matrix.go}}
check-latest: true
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Run Test
run: go test -v ./...