forked from tetratelabs/wazero
-
Notifications
You must be signed in to change notification settings - Fork 0
361 lines (320 loc) · 12.1 KB
/
integration.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
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
name: Standard Library Integration Tests
on:
pull_request:
branches: [main]
paths-ignore: # ignore docs as they are built with Netlify.
- '**/*.md'
- 'site/**'
- 'netlify.toml'
push:
branches: [main]
paths-ignore: # ignore docs as they are built with Netlify.
- '**/*.md'
- 'site/**'
- 'netlify.toml'
defaults:
run: # use bash for all operating systems unless overridden
shell: bash
env: # Update this prior to requiring a higher minor version in go.mod
GO_VERSION: "1.21" # 1.xx == latest patch of 1.xx
TINYGO_VERSION: "0.30.0"
ZIG_VERSION: "0.11.0"
BINARYEN_VERSION: "116"
STDLIB_TESTS: "internal/integration_test/stdlibs"
concurrency:
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.actor }}
cancel-in-progress: true
jobs:
build_zig_test_binary:
name: Build Zig test binary
runs-on: ubuntu-22.04
env:
ZIG_INSTALL: ~/zig-install
ZIG_SOURCE: ~/zig-source
BINARYEN_INSTALL: ~/binaryen-install
steps:
- name: Checkout wazero
uses: actions/checkout@v3
- uses: actions/cache@v3
id: binary-cache
with:
# Use share the cache containing archives across OSes.
enableCrossOsArchive: true
key: zig-stdlib-test-binary-${{ env.ZIG_VERSION }}
path:
${{ env.STDLIB_TESTS }}/testdata/zig
- name: Install Zig build
if: steps.binary-cache.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.ZIG_INSTALL }}
curl -sSL https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz | tar -xJ --strip-components=1 -C ${{ env.ZIG_INSTALL }}
- name: Download Zig source code
if: steps.binary-cache.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.ZIG_SOURCE }}
curl -sSL https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-${{ env.ZIG_VERSION }}.tar.xz | tar -xJ --strip-components=1 -C ${{ env.ZIG_SOURCE }}
- name: Install Binaryen build
if: steps.binary-cache.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.BINARYEN_INSTALL }}
curl -sSL https://github.com/WebAssembly/binaryen/releases/download/version_${{ env.BINARYEN_VERSION }}/binaryen-version_${{ env.BINARYEN_VERSION }}-x86_64-linux.tar.gz | tar -xz --strip-components=1 -C ${{ env.BINARYEN_INSTALL }}
- name: Build Stdlib test binary
if: steps.binary-cache.outputs.cache-hit != 'true'
run: |
PATH=${{ env.ZIG_INSTALL }}:${{ env.BINARYEN_INSTALL }}/bin:$PATH
cd ${{ env.STDLIB_TESTS }}
make build.zig zigroot=${{ env.ZIG_SOURCE }}
zig:
needs: build_zig_test_binary
name: Zig (${{ matrix.os.name }}, ${{ matrix.arch }}, ${{ matrix.compiler }})
runs-on: ${{ matrix.os.version }}
strategy:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix:
# version is too verbose to be present in the name, so we use the name instead.
# Note that it'd be better to use runner.os in the name, but the runner context is not available in the name field.
os:
- version: ubuntu-22.04
name: Ubuntu
- version: macos-12
name: macOS
- version: windows-2022
name: Windows
compiler: [baseline]
arch: [amd64]
include:
- os:
version: macos-14
name: macOS
compiler: optimizing
arch: "arm64"
- os:
version: ubuntu-22.04
name: Ubuntu
compiler: optimizing
arch: "amd64"
go-version: "1.21"
steps:
- name: Checkout wazero
uses: actions/checkout@v3
- uses: actions/cache@v3
id: binary-cache
with:
# Use share the cache containing archives across OSes.
enableCrossOsArchive: true
# We need this cache to run tests.
fail-on-cache-miss: true
key: zig-stdlib-test-binary-${{ env.ZIG_VERSION }}
path:
${{ env.STDLIB_TESTS }}/testdata/zig
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Run built test binaries
run: |
cd ${{ env.STDLIB_TESTS }}
go test -bench='BenchmarkZig/${{ matrix.compiler }}'
build_tinygo_test_binary:
name: Build TinyGo test binary
runs-on: ubuntu-22.04
steps:
- name: Checkout wazero
uses: actions/checkout@v3
- uses: actions/cache@v3
id: binary-cache
with:
# Use share the cache containing archives across OSes.
enableCrossOsArchive: true
key: tinygo-test-binaries-${{ env.TINYGO_VERSION }}
path:
${{ env.STDLIB_TESTS }}/testdata/tinygo
- name: Install TinyGo
if: steps.binary-cache.outputs.cache-hit != 'true'
run: | # installing via curl so commands are similar on OS/x
tinygo_version=${{ env.TINYGO_VERSION }}
curl -sSL https://github.com/tinygo-org/tinygo/releases/download/v${tinygo_version}/tinygo${tinygo_version}.linux-amd64.tar.gz | sudo tar -C /usr/local -xzf -
echo "TINYGOROOT=/usr/local/tinygo" >> $GITHUB_ENV
echo "/usr/local/tinygo/bin" >> $GITHUB_PATH
- uses: actions/setup-go@v4
if: steps.binary-cache.outputs.cache-hit != 'true'
with:
go-version: ${{ env.GO_VERSION }}
- name: Build Test Binaries
if: steps.binary-cache.outputs.cache-hit != 'true'
run: |
cd ${{ env.STDLIB_TESTS }}
make build.tinygo
tinygo:
needs: build_tinygo_test_binary
name: TinyGo (${{ matrix.os.name }}, ${{ matrix.arch }}, ${{ matrix.compiler }})
runs-on: ${{ matrix.os.version }}
strategy:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix:
# version is too verbose to be present in the name, so we use the name instead.
# Note that it'd be better to use runner.os in the name, but the runner context is not available in the name field.
os:
- version: ubuntu-22.04
name: Ubuntu
- version: macos-12
name: macOS
- version: windows-2022
name: Windows
compiler: [baseline]
arch: [amd64]
include:
- os:
version: macos-14
name: macOS
compiler: optimizing
arch: "arm64"
- os:
version: ubuntu-22.04
name: Ubuntu
compiler: optimizing
arch: "amd64"
go-version: "1.21"
steps:
- name: Checkout wazero
uses: actions/checkout@v3
- uses: actions/cache@v3
id: binary-cache
with:
# Use share the cache containing archives across OSes.
enableCrossOsArchive: true
# We need this cache to run tests.
fail-on-cache-miss: true
key: tinygo-test-binaries-${{ env.TINYGO_VERSION }}
path:
${{ env.STDLIB_TESTS }}/testdata/tinygo
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Run test binaries
run: |
cd ${{ env.STDLIB_TESTS }}
go test -bench='BenchmarkTinyGo/${{ matrix.compiler }}'
wasi-testsuite:
name: wasi-testsuite
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix:
os: [ubuntu-22.04, macos-12, windows-2022]
steps:
- uses: actions/cache@v3
id: cache
with:
path:
~/go/pkg/mod
key: integration-test-wasi-testsuite-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout wazero
uses: actions/checkout@v3
- name: Install wazero
run: go install ./cmd/wazero
- name: Checkout wasi-testsuite
uses: actions/checkout@v3
with:
repository: WebAssembly/wasi-testsuite
# prod/testsuite-base branch, as of May 12, 2023.
# TODO: once the wasi-testsuite is stable, we should use the latest tag instead of a branch.
ref: c9c751586fd86b321d595bbef13f2c7403cfdbc5
path: wasi-testsuite
- name: Initialize Python environment
uses: actions/setup-python@v4
with:
python-version: '3.11' # latest version of python 3
cache: pip
- name: Install dependencies
working-directory: wasi-testsuite/test-runner
run: |
python3 -m pip install -r requirements.txt
- name: Run all wasi-testsuite
working-directory: wasi-testsuite
run: |
python3 test-runner/wasi_test_runner.py \
-t ./tests/assemblyscript/testsuite/ \
./tests/c/testsuite/ \
./tests/rust/testsuite/ \
-f ../.github/wasi_testsuite_skip.json \
-r ../.github/wasi_testsuite_adapter.py
go_tests:
# Due to the embedding of the GOROOT of the building env(https://github.com/golang/go/blob/3c59639b902fada0a2e5a6a35bafd10fc9183b89/src/os/os_test.go#L112),
# we have to build and cache on each OS unlike others in this file.
name: Go-${{ matrix.go-version }} (${{ matrix.os.name }}, ${{ matrix.arch }}, ${{ matrix.compiler }})
runs-on: ${{ matrix.os.version }}
strategy:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix:
# version is too verbose to be present in the name, so we use the name instead.
# Note that it'd be better to use runner.os in the name, but the runner context is not available in the name field.
os:
- version: ubuntu-22.04
name: Ubuntu
- version: macos-12
name: macOS
- version: windows-2022
name: Windows
compiler: [baseline]
arch: [amd64]
go-version:
- "1.21"
- "1.22"
include:
- os:
version: macos-14
name: macOS
compiler: optimizing
arch: "arm64"
go-version: "1.21"
- os:
version: macos-14
name: macOS
compiler: optimizing
arch: "arm64"
go-version: "1.22"
- os:
version: ubuntu-22.04
name: Ubuntu
compiler: optimizing
arch: "amd64"
go-version: "1.21"
- os:
version: ubuntu-22.04
name: Ubuntu
compiler: optimizing
arch: "amd64"
go-version: "1.22"
steps:
- id: setup-go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Checkout wazero
uses: actions/checkout@v3
- name: Cache Go test binaries
id: cache-go-test-binaries
uses: actions/cache@v3
with:
path:
${{ env.STDLIB_TESTS }}/testdata/go
# Use precise Go version from setup-go as patch version differences can effect tests.
key: go-wasip1-binaries-${{ matrix.os.version }}-${{ steps.setup-go.outputs.go-version }}-${{ matrix.arch }}
- if: ${{ steps.cache-go-test-binaries.outputs.cache-hit != 'true' }}
name: Build Test Binaries
run: |
cd ${{ env.STDLIB_TESTS }}
make build.gowasip1
# The wasip1 stdlib tests are really path sensitive, so they expect a writeable /tmp directory to be available.
# We create it at the root of `C:`. This is normally only necessary on GHA Windows runners.
- if: ${{ matrix.os.name == 'Windows' }}
run: |
mkdir /c/tmp
- name: Run built test binaries
run: |
cd ${{ env.STDLIB_TESTS }}
go test -bench='BenchmarkWasip1/${{ matrix.compiler }}'