-
Notifications
You must be signed in to change notification settings - Fork 20
117 lines (93 loc) · 2.33 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Go
on:
push:
branches:
- main
- 'support/*'
pull_request: {}
jobs:
build-test:
strategy:
matrix:
os: [ macos-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.x
- run: go build ./...
- run: go test -v -race ./...
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.x
- uses: dominikh/staticcheck-action@fe1dd0c3658873b46f8c9bb3291096a617310ca6 # v1.3.1
with:
install-go: false
- uses: golangci/golangci-lint-action@v6
with:
version: latest
only-new-issues: true
# Enable the gosec linter w/o having to create a .golangci.yml config
args: -E gosec
vet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.x
- run: go vet ./...
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.x
- name: Run gofmt -d .
run: |
fmtvar="$(gofmt -d .)"
echo "$fmtvar"
test -z "$fmtvar"
modtidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.x
- name: Run go mod tidy
run: |
go mod tidy
gitdiff="$(git diff -U0)"
echo "$gitdiff"
test -z "$gitdiff"
vendor-diff:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.x
- name: Checkout base commit
uses: actions/checkout@v4
with:
path: a
ref: ${{ github.base_ref }}
- name: Download dependencies of base commit
run: go mod vendor
working-directory: a
- name: Checkout PR
uses: actions/checkout@v4
with:
path: b
- name: Download dependencies of PR
run: go mod vendor
working-directory: b
- name: Diff of dependencies
run: diff -ur --color=always a/vendor b/vendor || true