forked from wasm3/wasm3
-
Notifications
You must be signed in to change notification settings - Fork 0
496 lines (455 loc) · 15.5 KB
/
tests.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
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
name: tests
on: [push, pull_request]
jobs:
build-linux:
runs-on: ubuntu-latest
name: build-linux-${{ matrix.config.target }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
config:
- {target: clang, cc: clang, }
- {target: clang-x86, cc: clang, flags: -DCMAKE_C_FLAGS="-m32", install: "gcc-multilib" }
- {target: gcc, cc: gcc, }
- {target: gcc-debug, cc: gcc, flags: -DCMAKE_BUILD_TYPE=Debug }
# TODO: fails on numeric operations
#- {target: gcc-x86, cc: gcc, flags: "-m32", install: "gcc-multilib" }
steps:
- uses: actions/checkout@v2
- name: Install ${{ matrix.config.install }}
if: ${{ matrix.config.install }}
run: |
sudo apt update
sudo apt install ${{ matrix.config.install }}
- name: Configure
env:
CC: ${{ matrix.config.cc }}
run: |
mkdir build
cd build
cmake ${{ matrix.config.flags }} ..
- name: Build
run: |
cmake --build build
- name: Test WebAssembly spec
run: cd test && python3 run-spec-test.py
- name: Test WASI apps
run: cd test && python3 run-wasi-test.py
build-linux-alpine:
runs-on: ubuntu-latest
container: alpine:3.10
steps:
- uses: actions/checkout@v2
- name: Prepare
run: apk add build-base cmake python3 git --update-cache
- name: Configure
run: |
mkdir build
cd build
cmake ..
- name: Build
run: cmake --build build
- name: Test WebAssembly spec
run: cd test && python3 run-spec-test.py
- name: Test WASI apps
run: cd test && python3 run-wasi-test.py
build-mac:
runs-on: macos-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Configure
run: |
mkdir build
cd build
cmake ..
- name: Build
run: |
cmake --build build
- name: Test WebAssembly spec
run: cd test && python3 run-spec-test.py
- name: Test WASI apps
run: cd test && python3 run-wasi-test.py
build-windows:
runs-on: windows-latest
name: build-windows-${{ matrix.config.target }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
config:
- {target: clang-x64, platform: "-A x64", toolset: "-T ClangCL" }
- {target: msvc-x64, platform: "-A x64", toolset: "" }
- {target: clang-x86, platform: "-A Win32", toolset: "-T ClangCL" }
- {target: msvc-x86, platform: "-A Win32", toolset: "" }
steps:
- uses: actions/checkout@v2
- name: Configure
run: |
mkdir build
cd build
cmake ${{ matrix.config.platform }} ${{ matrix.config.toolset }} ..
- name: Build
run: |
cmake --build build --config Release
cp ./build/Release/wasm3.exe ./build/
- name: Test WebAssembly spec
run: |
cd test
python run-spec-test.py
- name: Test WASI apps
run: |
cd test
python run-wasi-test.py
build-wasi:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Install Wasienv
run: curl https://raw.githubusercontent.com/wasienv/wasienv/master/install.sh | sh
- name: Install Wasmer
env:
WASMER_RELEASE_TAG: "0.16.2"
run: curl https://get.wasmer.io -sSfL | sh
- name: Configure
run: |
source $HOME/.wasienv/wasienv.sh
mkdir build-wasi
cd build-wasi
wasimake cmake -DBUILD_WASI=metawasi ..
- name: Build
run: |
source $HOME/.wasienv/wasienv.sh
cmake --build build-wasi
- name: Test WebAssembly spec (in Wasmer)
run: |
source $HOME/.wasmer/wasmer.sh
cd test
python3 run-spec-test.py --exec "wasmer run --dir=. ../build-wasi/wasm3.wasm -- --repl"
# TODO: Test WASI apps in Wasmer
- name: Configure (native)
run: |
mkdir build
cd build
export CFLAGS="-Dd_m3LogOutput=0"
cmake ..
- name: Build (native)
run: |
cmake --build build
- name: Test WebAssembly spec (in Wasm3, self-hosting)
run: |
cd test
cp ../build-wasi/wasm3.wasm ./
python3 run-spec-test.py --exec "../build/wasm3 --stack-size 2097152 ../build-wasi/wasm3.wasm --repl"
- name: Test WASI apps (in Wasm3, self-hosting)
run: |
cd test
python3 run-wasi-test.py --fast --exec "../build/wasm3 --stack-size 2097152 ../build-wasi/wasm3.wasm"
build-ios:
runs-on: macos-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: List Xcode versions
run: ls /Applications | grep Xcode
- name: Select Xcode 11
run: sudo xcode-select -switch /Applications/Xcode_11.3.app
- name: Build (iPhone 11)
run: |
cd platforms/ios
xcodebuild build -scheme wasm3 -project wasm3.xcodeproj -configuration Release -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.3'
build-android:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build
run: |
cd platforms/android
./gradlew build
build-cross-qemu:
runs-on: ubuntu-latest
name: build-cross-qemu-${{ matrix.config.target }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
config:
#- {target: i386, toolchain: gcc-multilib, cc: clang -m32, qemu: qemu-i386-static }
- {target: arm, toolchain: gcc-arm-linux-gnueabi, cc: arm-linux-gnueabi-gcc, qemu: qemu-arm-static }
- {target: armhf, toolchain: gcc-arm-linux-gnueabihf, cc: arm-linux-gnueabihf-gcc, qemu: qemu-arm-static }
- {target: aarch64, toolchain: gcc-aarch64-linux-gnu, cc: aarch64-linux-gnu-gcc, qemu: qemu-aarch64-static }
- {target: riscv64, toolchain: gcc-riscv64-linux-gnu, cc: riscv64-linux-gnu-gcc, qemu: qemu-riscv64-static }
- {target: ppc, toolchain: gcc-powerpc-linux-gnu, cc: powerpc-linux-gnu-gcc, qemu: qemu-ppc-static }
- {target: ppc64, toolchain: gcc-powerpc64-linux-gnu, cc: powerpc64-linux-gnu-gcc, qemu: qemu-ppc64-static }
- {target: ppc64le, toolchain: gcc-powerpc64le-linux-gnu, cc: powerpc64le-linux-gnu-gcc, qemu: qemu-ppc64le-static }
- {target: s390x, toolchain: gcc-s390x-linux-gnu, cc: s390x-linux-gnu-gcc, qemu: qemu-s390x-static }
- {target: mips, toolchain: gcc-mips-linux-gnu, cc: mips-linux-gnu-gcc, qemu: qemu-mips-static }
- {target: mips64, toolchain: gcc-mips64-linux-gnuabi64, cc: mips64-linux-gnuabi64-gcc, qemu: qemu-mips64-static }
- {target: mipsel, toolchain: gcc-mipsel-linux-gnu, cc: mipsel-linux-gnu-gcc, qemu: qemu-mipsel-static }
- {target: mips64el,toolchain: gcc-mips64el-linux-gnuabi64, cc: mips64el-linux-gnuabi64-gcc,qemu: qemu-mips64el-static }
- {target: alpha, toolchain: gcc-alpha-linux-gnu, cc: alpha-linux-gnu-gcc, qemu: qemu-alpha-static }
- {target: sparc64, toolchain: gcc-sparc64-linux-gnu, cc: sparc64-linux-gnu-gcc, qemu: qemu-sparc64-static, skip_wasi: true }
#- {target: i386 (u64 slots), toolchain: gcc-multilib, cc: clang -m32, qemu: qemu-i386-static, cflags: -Dd_m3Use32BitSlots=0 }
- {target: arm (u64 slots), toolchain: gcc-arm-linux-gnueabi, cc: arm-linux-gnueabi-gcc, qemu: qemu-arm-static, cflags: -Dd_m3Use32BitSlots=0 }
- {target: aarch64 (u64 slots), toolchain: gcc-aarch64-linux-gnu, cc: aarch64-linux-gnu-gcc, qemu: qemu-aarch64-static, cflags: -Dd_m3Use32BitSlots=0 }
- {target: ppc (u64 slots), toolchain: gcc-powerpc-linux-gnu, cc: powerpc-linux-gnu-gcc, qemu: qemu-ppc-static, cflags: -Dd_m3Use32BitSlots=0 }
- {target: ppc64 (u64 slots), toolchain: gcc-powerpc64-linux-gnu, cc: powerpc64-linux-gnu-gcc, qemu: qemu-ppc64-static, cflags: -Dd_m3Use32BitSlots=0 }
steps:
- uses: actions/checkout@v2
- name: Install QEMU
env:
QEMU_SRC: "http://archive.ubuntu.com/ubuntu/pool/universe/q/qemu"
QEMU_VER: "qemu-user-static_4\\.2-.*_amd64.deb$"
run: |
DEB=`curl -s $QEMU_SRC/ | grep -o -E 'href="([^"#]+)"' | cut -d'"' -f2 | grep $QEMU_VER | tail -1`
wget $QEMU_SRC/$DEB
sudo dpkg -i $DEB
- name: Install ${{ matrix.config.toolchain }}
run: |
sudo apt update
sudo apt install ${{ matrix.config.toolchain }}
- name: Build
run: |
mkdir build
cd build
${{ matrix.config.cc }} -DASSERTS -Dd_m3HasWASI \
-I../source ../source/*.c ../platforms/app/main.c \
-O3 -g0 -flto -lm -static \
-o wasm3
- name: Test WebAssembly spec
run: |
cd test
python3 run-spec-test.py --exec "${{ matrix.config.qemu }} ../build/wasm3 --repl"
- name: Test WASI apps
if: ${{ !matrix.config.skip_wasi }}
run: |
cd test
python3 run-wasi-test.py --fast --exec "${{ matrix.config.qemu }} ../build/wasm3"
build-platformio:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install -U platformio
- name: Build AVR ATmega1284
run: |
cd platforms/arduino
pio run -e mega1284
! nm .pio/build/mega1284/firmware.elf | grep printf
- name: Build ESP8266
run: |
cd platforms/esp8266
pio run
# TODO:
#- name: Build ESP32
# run: |
# cd platforms/esp32-pio
# pio run
build-platformio-arm:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install -U platformio
- name: Build Arduino MKR1000
run: |
cd platforms/arduino
pio run -e mkr1000
- name: Build Blue Pill (JeeH)
run: |
cd platforms/bluepill
pio run
- name: Build TinyBLE
run: |
cd platforms/arduino
pio run -e tinyBLE
- name: Build MXChip AZ3166
run: |
cd platforms/arduino
pio run -e az3166
build-platformio-riscv:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install -U platformio
- name: Build HiFive1
run: |
cd platforms/hifive1
pio run
- name: Build Sipeed MAIX
run: |
cd platforms/arduino
pio run -e maix
build-particle:
runs-on: ubuntu-latest
timeout-minutes: 10
if: "github.event_name == 'push'"
steps:
- uses: actions/checkout@v2
- name: Set up Particle CLI
run: sudo npm install -g particle-cli
- name: Log in
env:
PARTICLE_TOKEN: ${{ secrets.PARTICLE_TOKEN }}
run: particle login --token $PARTICLE_TOKEN
- name: Build Photon
run: |
cd platforms/particle
particle compile --followSymlinks photon
build-esp32-idf:
runs-on: ubuntu-latest
container: igrr/idf-qemu:release-v4.0-esp-develop-20191228
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Build for ESP32 (IDF v4.0)
run: |
. $IDF_PATH/export.sh
cd platforms/esp32-idf
export EXTRA_CFLAGS="-Werror"
idf.py build
shell: bash
- name: Test for ESP32 in QEMU
run: |
cd platforms/esp32-idf
make-flash-img.sh wasm3 flash_img.bin
qemu-system-xtensa -machine esp32 -nographic -drive file=flash_img.bin,if=mtd,format=raw -no-reboot | tee out.txt
grep "Result: 46368" out.txt
grep "Elapsed: " out.txt
grep "Restarting..." out.txt
test $(($(grep "ets Jun 8 2016" out.txt | wc -l))) -eq 1
- name: Check that IDF and PIO examples are in sync
run: |
diff -q platforms/esp32-idf/main/main.cpp platforms/esp32-pio/src/main.cpp
# TODO: also check that the build flags are in sync
build-cpp:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Configure
run: |
cd platforms/cpp
mkdir build
cd build
cmake ..
- name: Build
run: |
cd platforms/cpp
cmake --build build
- name: Run
run: |
cd platforms/cpp/build
./wasm3_cpp_example
build-as-cpp:
name: maintenance (build as C++)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Build
run: |
mkdir build
cd build
g++ -xc++ -Dd_m3HasWASI \
-I../source ../source/*.c ../platforms/app/main.c \
-O3 -g0 -lm \
-o wasm3
- name: Test
run: ./build/wasm3 ./test/wasi/test.wasm
build-with-logs:
name: maintenance (debug logs)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Build
run: |
mkdir build
cd build
g++ -xc++ -Dd_m3HasWASI -DDEBUG \
-Dd_m3EnableOpTracing=1 \
-Dd_m3LogParse=1 \
-Dd_m3LogModule=1 \
-Dd_m3LogCompile=1 \
-Dd_m3LogWasmStack=1 \
-Dd_m3LogEmit=1 \
-Dd_m3LogCodePages=1 \
-Dd_m3LogExec=1 \
-Dd_m3LogRuntime=1 \
-Dd_m3LogStackTrace=1 \
-Dd_m3LogNativeStack=1 \
-I../source ../source/*.c ../platforms/app/main.c \
-O3 -g0 -lm \
-o wasm3
- name: Test
run: ./build/wasm3 ./test/wasi/test.wasm > /dev/null
build-preprocessed-ops:
name: maintenance (preprocess ops)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- name: Install sponge
run: |
sudo apt update
sudo apt install moreutils
- name: Build
run: |
make -f extra/utils.mk preprocess
mkdir build
cd build
gcc -Dd_m3HasWASI \
-I../source ../source/*.c ../platforms/app/main.c \
-O3 -g0 -lm \
-o wasm3
- name: Test
run: ./build/wasm3 ./test/wasi/test.wasm
build-python:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Build python module
run: |
pip install .
- name: Test with pytest
run: |
pip install pytest
pytest platforms/python/test