-
Notifications
You must be signed in to change notification settings - Fork 4
59 lines (57 loc) · 1.61 KB
/
main.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
name: Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.21', '1.*' ]
name: Tests
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Get dependencies
run: go get -v -t -d ./...
- name: Test
run: CGO_ENABLED=1 go test -race ./...
static-checks:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.21' ] # go 1.22 issues with generation
name: Static checks
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Get dependencies
run: go get -v -t -d ./...
- name: Go Vet
run: go vet ./...
- name: Go Fmt
run: |
fmt=$(gofmt -l .)
test -z $fmt || (echo "please run gofmt" ; echo $fmt ; exit 1)
- name: Go Lint
run: go run golang.org/x/lint/golint@latest -set_exit_status $(go list ./...)
- name: Spelling
run: go run github.com/client9/misspell/cmd/misspell@latest -error .
- name: Ineffective assignments
run: go run github.com/gordonklaus/ineffassign@latest .
- name: Go Generate
run: |
go generate ./...
git diff --quiet || (echo 'generated go files are not up to date, check go generate, go.sum and go.mod' ; git diff ; exit 1)
- name: WriteGoList
run: go list -json -m all > go.list