-
Notifications
You must be signed in to change notification settings - Fork 66
248 lines (246 loc) · 8.45 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
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
name: Go
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch:
- armv6
- armv7
- aarch64
- 386
- x64
go:
- '1.5'
- '1.6'
- '1.7'
- '1.8'
- '1.9'
- '1.10'
- '1.11'
- '1.12'
- '1.13'
- '1.14'
- '1.15'
- '1.16'
- '1.17'
- '1.18'
- '1.19'
- '1.20'
- '1.21'
# Race detector binaries crash with:
#
# FATAL: ThreadSanitizer: unsupported VMA range
#
# See https://github.com/golang/go/issues/29948.
arm64_unsupported_vma_range:
- true
include:
# Race builds are pretty much busted on Go 1.4 and below on systems
# with newer C compilers. A number of fixes were backported to
# go1.4-bootstrap but not any released version. See
# https://github.com/golang/go/compare/go1.4.3...release-branch.go1.4.
#
# Race builds aren't supported on linux/386.
#
# Cross-compilation became possible in go1.5 with the removal of C
# code from the compiler. See https://go.dev/doc/go1.5#c.
#
# Race builds aren't supported in gccgo.
#
# Cross-compilation isn't supported in gccgo.
- arch: x64
go: '1.3'
x64_race_broken: true
- arch: x64
go: '1.4'
x64_race_broken: true
- arch: x64
go: gccgo-9
x64_race_broken: true
- arch: x64
go: gccgo-10
x64_race_broken: true
- arch: x64
go: gccgo-11
x64_race_broken: true
- arch: x64
go: gccgo-12
x64_race_broken: true
- arch: x64
go: gccgo-13
x64_race_broken: true
# Go binaries built with Go 1.8 and below are incompatible with QEMU
# user-level emulation. See
# https://github.com/golang/go/commit/2673f9e.
- arch: armv6
go: '1.5'
qemu_emulation_broken: true
- arch: armv6
go: '1.6'
qemu_emulation_broken: true
- arch: armv6
go: '1.7'
qemu_emulation_broken: true
- arch: armv6
go: '1.8'
qemu_emulation_broken: true
- arch: armv7
go: '1.5'
qemu_emulation_broken: true
- arch: armv7
go: '1.6'
qemu_emulation_broken: true
- arch: armv7
go: '1.7'
qemu_emulation_broken: true
- arch: armv7
go: '1.8'
qemu_emulation_broken: true
- arch: aarch64
go: '1.5'
qemu_emulation_broken: true
- arch: aarch64
go: '1.6'
qemu_emulation_broken: true
- arch: aarch64
go: '1.7'
qemu_emulation_broken: true
- arch: aarch64
go: '1.8'
qemu_emulation_broken: true
# Race detector support on linux/arm64 was added in go1.12. See
# https://go.dev/doc/go1.12.
- arch: aarch64
go: '1.5'
arm64_race_unsupported: true
- arch: aarch64
go: '1.6'
arm64_race_unsupported: true
- arch: aarch64
go: '1.7'
arm64_race_unsupported: true
- arch: aarch64
go: '1.8'
arm64_race_unsupported: true
- arch: aarch64
go: '1.9'
arm64_race_unsupported: true
- arch: aarch64
go: '1.10'
arm64_race_unsupported: true
- arch: aarch64
go: '1.11'
arm64_race_unsupported: true
steps:
- uses: actions/checkout@v4
- name: Set up Go
if: ${{ !startsWith(matrix.go, 'gccgo-') }}
uses: actions/[email protected]
with:
go-version: ${{ matrix.go }}
- name: Set up gccgo
if: ${{ startsWith(matrix.go, 'gccgo-') }}
run: |
sudo apt update && \
sudo apt install -y ${{ matrix.go }} && \
echo ${{ matrix.go }} | sed 's/^gcc//' | xargs -I % ln -s /usr/bin/% /usr/local/bin/go && \
go version
- name: 'Build with ${{ matrix.go }}'
if: ${{ matrix.arch == 'x64' }}
run: go build -v ./...
- name: 'Build with ${{ matrix.go }}'
if: ${{ matrix.arch == '386' }}
env:
GOARCH: 386
run: go build -v ./...
- name: 'Check that Get is inlined with ${{ matrix.go }}'
if: ${{ !startsWith(matrix.go, 'gccgo-') && matrix.arch == 'x64' }}
run: |
if echo -e '${{ matrix.go }}\n1.12' | sort -V | head -n1 | xargs test 1.12 = ; then
go build -gcflags='-m' 2>&1 | grep 'can inline Get$' > /dev/null
fi
- name: 'Check that Get is inlined with ${{ matrix.go }}'
if: ${{ !startsWith(matrix.go, 'gccgo-') && matrix.arch == '386' }}
env:
GOARCH: 386
run: |
if echo -e '${{ matrix.go }}\n1.12' | sort -V | head -n1 | xargs test 1.12 = ; then
go build -gcflags='-m' 2>&1 | grep 'can inline Get$' > /dev/null
fi
- name: 'BuildRace with ${{ matrix.go }}'
if: ${{ matrix.arch == 'x64' && !matrix.x64_race_broken }}
run: go build -race -v ./...
- name: 'Test with ${{ matrix.go }}'
if: ${{ matrix.arch == 'x64' }}
run: go test -v ./...
- name: 'Test with ${{ matrix.go }}'
if: ${{ matrix.arch == '386' }}
env:
GOARCH: 386
run: go test -v ./...
- name: 'TestRace with ${{ matrix.go }}'
if: ${{ matrix.arch == 'x64' && !matrix.x64_race_broken }}
run: go test -race -v ./...
- name: 'Bench with ${{ matrix.go }}'
if: ${{ matrix.arch == 'x64' }}
run: go test -bench=. -benchmem -v ./...
- name: 'Bench with ${{ matrix.go }}'
if: ${{ matrix.arch == '386' }}
env:
GOARCH: 386
run: go test -bench=. -benchmem -v ./...
- name: 'BenchRace with ${{ matrix.go }}'
if: ${{ matrix.arch == 'x64' && !matrix.x64_race_broken }}
run: go test -bench=. -benchmem -race -v ./...
- name: 'BuildTest with ${{ matrix.go }} for armv6'
if: ${{ matrix.arch == 'armv6' }}
env:
GOARCH: arm
GOARM: 6
run: go test -c ./...
- name: 'BuildTest with ${{ matrix.go }} for armv7'
if: ${{ matrix.arch == 'armv7' }}
env:
GOARCH: arm
GOARM: 7
run: go test -c ./...
- name: 'BuildTest with ${{ matrix.go }} for aarch64'
if: ${{ matrix.arch == 'aarch64' }}
env:
GOARCH: arm64
run: go test -c ./...
- name: 'BuildTestRace with ${{ matrix.go }} for aarch64'
if: ${{ matrix.arch == 'aarch64' && !matrix.arm64_race_unsupported }}
env:
GOARCH: arm64
CGO_ENABLED: 1
run: |
# Non-host *.syso files are missing from the Go toolchains provided
# by setup-go. See https://github.com/actions/setup-go/issues/181.
curl --location --output $(go env GOROOT)/src/runtime/race/race_linux_arm64.syso \
https://github.com/golang/go/raw/release-branch.go${{ matrix.go }}/src/runtime/race/race_linux_arm64.syso && \
sudo apt update && \
sudo apt install gcc-aarch64-linux-gnu && \
CC=aarch64-linux-gnu-gcc CC_FOR_TARGET=gcc-aarch64-linux-gnu go test -c -race -o goid.race.test ./...
- name: 'DeleteTestRace with $$ {{ matrix.go}} for aarch64'
if: ${{ matrix.arch == 'aarch64' && !matrix.arm64_race_unsupported && matrix.arm64_unsupported_vma_range }}
run: rm goid.race.test
- name: 'Test and Bench with ${{ matrix.go }} on ${{ matrix.arch }}'
if: ${{ matrix.arch != '386' && matrix.arch != 'x64' && !matrix.qemu_emulation_broken }}
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.arch }}
distro: bullseye
dockerRunArgs: --mount type=bind,source="$(pwd)",target=/checkout,readonly
run: |
find /checkout -name '*.test' -type f -executable -print0 | \
xargs -t -0 -I '{}' sh -c '{} -test.v && {} -test.bench=. -test.benchmem -test.v'