-
Notifications
You must be signed in to change notification settings - Fork 69
80 lines (66 loc) · 1.98 KB
/
ci.yaml
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Go
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
# This job aggregates all matrix results and is used for a GitHub required status check.
test_results:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Test Results
needs: [build_and_test]
steps:
- run: |
result="${{ needs.build_and_test.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi
build_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
go:
- "1.19"
- "1.20"
- "1.21"
- "1.22"
steps:
- uses: actions/checkout@v2
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Install dependencies
run: |
# The latest crlfmt requires go1.19.
go install github.com/cockroachdb/crlfmt@v0.1.0
go install github.com/kisielk/errcheck@v1.7.0
go install github.com/mdempsky/unconvert@latest
go install honnef.co/go/tools/cmd/staticcheck@2023.1.7
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
- name: Race
run: go test -p 1 -v ./...
- name: gofmt
run: gofmt -s -d -l .
- name: vet
run: |
! go vet -vettool=$(which shadow) ./... 2>&1 | \
grep -vF 'declaration of "err" shadows declaration at' | \
grep -vF "# github.com/cockroachdb/cockroach-go/v2/testserver" | \
grep -vF "# [github.com/cockroachdb/cockroach-go/v2/testserver_test]"
- name: License checks
run: |
! git grep -lE '^// Author' -- '*.go'
! git grep -LE '^// Copyright' -- '*.go'
- name: errchk
run: errcheck -ignore "Close|Init|AutoMigrate" ./...
- name: staticcheck
run: staticcheck ./...