-
Notifications
You must be signed in to change notification settings - Fork 72
49 lines (49 loc) · 1.8 KB
/
ci.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
name: golang/static
on: [push, pull_request]
jobs:
build:
name: build
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.22.x]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- run: go mod download
- run: go build -v .
tests:
name: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22
- run: go mod download
- run: go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
- run: go install golang.org/x/tools/cmd/goimports@latest
- run: go install honnef.co/go/tools/cmd/staticcheck@latest
- run: go install golang.org/x/lint/golint@latest
- run: go install github.com/nishanths/exhaustive/...@latest
- run: go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
- name: vet
run: go vet ./...
- name: shadow
run: go vet -vettool=$HOME/go/bin/shadow ./...
- name: imports
run: d="$($HOME/go/bin/goimports -d ./)" && if [ -n "$d" ]; then echo "goimports generated output:" ; echo "$d"; exit 1; fi
- name: staticheck
run: $HOME/go/bin/staticcheck ./...
- name: lint
run: set +e ; d="$($HOME/go/bin/golint -min_confidence 1 ./... | grep -v comment)" ; if [ -z "$d" ]; then exit 0 ; else echo "golint check output:" ; echo "$d" ; exit 1 ; fi ; set -e
- name: exhaustive
run: $HOME/go/bin/exhaustive -default-signifies-exhaustive ./...
- name: cyclo
run: $HOME/go/bin/gocyclo -over 19 $(find . -iname '*.go' -type f)
- name: fmt
run: test -z $(gofmt -s -l $(find . -iname '*.go' -type f))
- name: test
run: go test ./...