-
Notifications
You must be signed in to change notification settings - Fork 27
228 lines (197 loc) · 6.32 KB
/
Copy pathtest.yml
File metadata and controls
228 lines (197 loc) · 6.32 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
name: Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
env:
GO_VERSION: '1.26.4'
FREEBSD_RELEASE: '15.0'
NETBSD_RELEASE: '10.1'
OPENBSD_RELEASE: '7.9'
DRAGONFLYBSD_RELEASE: '6.4.1'
SOLARIS_RELEASE: '11.4-gcc' # use -gcc variant for cgo
jobs:
build-and-test:
strategy:
matrix:
# Latest two supported releases.
go-version: ['1.25', '1.26']
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, macos-14, macos-15, macos-26, windows-2025]
runs-on: ${{ matrix.os }}
steps:
- name: Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v5.0.2
with:
go-version: ${{ matrix.go-version }}
- name: Check formatting
if: ${{ matrix.go-version == '1.26' && matrix.os == 'ubuntu-24.04' }}
run: diff -u <(echo -n) <(gofmt -d .)
- name: Check Go modules
if: ${{ matrix.go-version == '1.26' && matrix.os == 'ubuntu-24.04' }}
run: |
go mod tidy -diff
- name: Generate
if: ${{ matrix.go-version == '1.26' }}
run: |
go generate
git diff --exit-code
- name: Build (native)
run: go build ./...
- name: Test (native)
run: go test -v ./...
build-and-test-freebsd:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Build and test on FreeBSD ${{ env.FREEBSD_RELEASE }}
uses: vmactions/freebsd-vm@f0552d3b69211736abd97f02ff3d4674c56b73b1 # v1.5.5
with:
release: ${{ env.FREEBSD_RELEASE }}
envs: 'GO_VERSION'
usesh: true
prepare: |
set -e
pkg install -y curl
archive=/tmp/go.tar.gz
curl -fsSL "https://go.dev/dl/go${GO_VERSION}.freebsd-amd64.tar.gz" -o "$archive"
rm -rf /usr/local/go
mkdir -p /usr/local
(cd /usr/local && gzip -dc "$archive" | tar -xf -)
run: |
set -e
export PATH="/usr/local/go/bin:$PATH"
go version
go generate
go build ./...
go test -v ./...
- name: Check diff in generated files
run:
git diff --exit-code
build-and-test-netbsd:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Build and test on NetBSD ${{ env.NETBSD_RELEASE }}
uses: vmactions/netbsd-vm@00081e82b14bc40114eb97f32b4455306828516b # v1.4.6
with:
release: ${{ env.NETBSD_RELEASE }}
envs: 'GO_VERSION'
usesh: true
prepare: |
set -e
/usr/sbin/pkg_add -u curl
archive=/tmp/go.tar.gz
curl -fsSL "https://go.dev/dl/go${GO_VERSION}.netbsd-amd64.tar.gz" -o "$archive"
rm -rf /usr/local/go
mkdir -p /usr/local
(cd /usr/local && gzip -dc "$archive" | tar -xf -)
run: |
set -e
export PATH="/usr/local/go/bin:$PATH"
go version
go test -v ./...
go build ./...
go test -v ./...
go generate
- name: Check diff in generated files
run:
git diff --exit-code
build-and-test-openbsd:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Build and test on OpenBSD ${{ env.OPENBSD_RELEASE }}
uses: vmactions/openbsd-vm@c941015845c0f0c429676840963dc63b226d4f69 # v1.4.5
with:
release: ${{ env.OPENBSD_RELEASE }}
envs: 'GO_VERSION'
usesh: true
prepare: |
set -e
archive=/tmp/go.tar.gz
ftp -o "$archive" "https://go.dev/dl/go${GO_VERSION}.openbsd-amd64.tar.gz"
rm -rf /usr/local/go
mkdir -p /usr/local
(cd /usr/local && gzip -dc "$archive" | tar -xf -)
run: |
set -e
export PATH="/usr/local/go/bin:$PATH"
go version
go build ./...
go test -v ./...
go generate
- name: Check diff in generated files
run:
git diff --exit-code
build-and-test-dragonflybsd:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Build and test on DragonFlyBSD ${{ env.DRAGONFLYBSD_RELEASE }}
uses: vmactions/dragonflybsd-vm@bc8ccbaa091ce3624c93f2dc328ae48129b07580 # v1.3.1
with:
release: ${{ env.DRAGONFLYBSD_RELEASE }}
envs: 'GO_VERSION'
usesh: true
prepare: |
set -e
pkg install -y curl
archive=/tmp/go.tar.gz
curl -fsSL "https://go.dev/dl/go${GO_VERSION}.dragonfly-amd64.tar.gz" -o "$archive"
rm -rf /usr/local/go
mkdir -p /usr/local
(cd /usr/local && gzip -dc "$archive" | tar -xf -)
run: |
set -e
export PATH="/usr/local/go/bin:$PATH"
go version
go build ./...
go test -v ./...
go generate
- name: Check diff in generated files
run:
git diff --exit-code
build-and-test-solaris:
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Check out code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Build and test on Solaris ${{ env.SOLARIS_RELEASE }}
uses: vmactions/solaris-vm@315163f088b66e55bbcc45928bd224d4973b2312 # v1.3.8
with:
release: ${{ env.SOLARIS_RELEASE }}
envs: 'GO_VERSION'
usesh: true
prepare: |
set -e
archive=/tmp/go.tar.gz
wget -q -O "$archive" "https://go.dev/dl/go${GO_VERSION}.solaris-amd64.tar.gz"
rm -rf /usr/local/go
mkdir -p /usr/local
(cd /usr/local && gzip -dc "$archive" | gtar -xf -)
run: |
set -e
export PATH="/usr/local/go/bin:$PATH"
go version
go build ./...
go test -v ./...
go generate
- name: Check diff in generated files
run:
git diff --exit-code