-
Notifications
You must be signed in to change notification settings - Fork 10
753 lines (674 loc) · 26.9 KB
/
ci.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
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
name: CI
on:
push:
branches: [ "master" ]
tags:
- "v*"
pull_request:
branches: [ "master" ]
concurrency:
group: cmake-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-windows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: cmake configure
run: |
cmake -B build -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/dist -DBUILD_TESTING=OFF -DTOYWASM_BUILD_CLI=OFF -DTOYWASM_BUILD_UNITTEST=OFF -DTOYWASM_ENABLE_WASI=OFF -DTOYWASM_ENABLE_TRACING=ON -DTOYWASM_ENABLE_TRACING_INSN=ON
- name: cmake -L
run: |
cmake -B build -L
- name: Build
run: cmake --build build
- name: Install
run: cmake --build build --target install
- name: Build examples/run
run: |
cmake -B build -DCMAKE_PREFIX_PATH=${{github.workspace}}/dist
cmake --build build
working-directory: ${{github.workspace}}/examples/run
- name: Run examples/run
run: |
.\build\Debug\run.exe ./wasm/fib.wasm test-all
working-directory: ${{github.workspace}}/examples/run
build:
env:
CC: ${{matrix.compiler}}
strategy:
fail-fast: false
matrix:
name: [noname]
os: [ubuntu-20.04, macos-13]
compiler: [clang, gcc]
arch: [native]
BUILD_TYPE: [Release, Debug]
TOYWASM_USE_SEPARATE_EXECUTE: [ON, OFF]
TOYWASM_USE_TAILCALL: [ON, OFF]
TOYWASM_ENABLE_TRACING: [ON, OFF]
TOYWASM_USE_SMALL_CELLS: [ON, OFF]
TOYWASM_USE_SEPARATE_LOCALS: [ON, OFF]
MISC_FEATURES: [ON, OFF]
TOYWASM_ENABLE_WASM_THREADS: [ON, OFF]
TOYWASM_ENABLE_WASI_THREADS: [ON, OFF]
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: [ON, OFF]
TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: [ON, OFF]
exclude:
# I haven't used gcc for macos
- os: macos-13
compiler: gcc
# tailcall doesn't make sense w/o separate execute
- TOYWASM_USE_SEPARATE_EXECUTE: OFF
TOYWASM_USE_TAILCALL: ON
# I don't remeber why i excluded this.
# Probably because it's tested in wasm-on-wasm jobs?
- TOYWASM_USE_SEPARATE_EXECUTE: ON
TOYWASM_USE_TAILCALL: OFF
# wasi-threads requires wasm threads
- TOYWASM_ENABLE_WASM_THREADS: OFF
TOYWASM_ENABLE_WASI_THREADS: ON
# Exclude some non default configs with threads
- TOYWASM_USE_SEPARATE_EXECUTE: OFF
TOYWASM_ENABLE_WASM_THREADS: ON
- TOYWASM_USE_TAILCALL: OFF
TOYWASM_ENABLE_WASM_THREADS: ON
- TOYWASM_USE_SMALL_CELLS: OFF
TOYWASM_ENABLE_WASM_THREADS: ON
# TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING right now
# requires TOYWASM_USE_SMALL_CELLS
- TOYWASM_USE_SMALL_CELLS: OFF
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: ON
# exclude some more combinations to reduce the matrix
- TOYWASM_USE_SMALL_CELLS: ON
TOYWASM_USE_SEPARATE_LOCALS: ON
- MISC_FEATURES: OFF
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: ON
- MISC_FEATURES: OFF
TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: ON
- os: ubuntu-20.04
compiler: clang
- BUILD_TYPE: Release
# how include works is not intuitive to me:
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations
include:
- name: noname
os: ubuntu-20.04
compiler: gcc
arch: native
BUILD_TYPE: Release
TOYWASM_USE_SEPARATE_EXECUTE: ON
TOYWASM_USE_TAILCALL: ON
TOYWASM_ENABLE_TRACING: OFF
TOYWASM_USE_SMALL_CELLS: ON
TOYWASM_USE_SEPARATE_LOCALS: ON
MISC_FEATURES: OFF
TOYWASM_ENABLE_WASM_THREADS: OFF
TOYWASM_ENABLE_WASI_THREADS: OFF
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: OFF
TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: OFF
- name: ubuntu-20.04-amd64
os: ubuntu-20.04
compiler: clang
arch: native
BUILD_TYPE: Release
TOYWASM_USE_SEPARATE_EXECUTE: ON
TOYWASM_USE_TAILCALL: ON
TOYWASM_ENABLE_TRACING: OFF
TOYWASM_USE_SMALL_CELLS: ON
TOYWASM_USE_SEPARATE_LOCALS: ON
MISC_FEATURES: OFF
TOYWASM_ENABLE_WASM_THREADS: OFF
TOYWASM_ENABLE_WASI_THREADS: OFF
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: OFF
TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: OFF
- name: full-ubuntu-20.04-amd64
os: ubuntu-20.04
compiler: clang
arch: native
BUILD_TYPE: Release
TOYWASM_USE_SEPARATE_EXECUTE: ON
TOYWASM_USE_TAILCALL: ON
TOYWASM_ENABLE_TRACING: OFF
TOYWASM_USE_SMALL_CELLS: ON
TOYWASM_USE_SEPARATE_LOCALS: ON
MISC_FEATURES: ON
TOYWASM_ENABLE_WASM_THREADS: ON
TOYWASM_ENABLE_WASI_THREADS: ON
TOYWASM_ENABLE_WASI_LITTLEFS: ON
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: ON
TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: ON
- name: macos-13.0
os: macos-13
compiler: clang
arch: native
BUILD_TYPE: Release
TOYWASM_USE_SEPARATE_EXECUTE: ON
TOYWASM_USE_TAILCALL: ON
TOYWASM_ENABLE_TRACING: OFF
TOYWASM_USE_SMALL_CELLS: ON
TOYWASM_USE_SEPARATE_LOCALS: ON
MISC_FEATURES: OFF
TOYWASM_ENABLE_WASM_THREADS: OFF
TOYWASM_ENABLE_WASI_THREADS: OFF
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: OFF
TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: OFF
- name: full-macos-13.0
os: macos-13
compiler: clang
arch: native
BUILD_TYPE: Release
TOYWASM_USE_SEPARATE_EXECUTE: ON
TOYWASM_USE_TAILCALL: ON
TOYWASM_ENABLE_TRACING: OFF
TOYWASM_USE_SMALL_CELLS: ON
TOYWASM_USE_SEPARATE_LOCALS: ON
MISC_FEATURES: ON
TOYWASM_ENABLE_WASM_THREADS: ON
TOYWASM_ENABLE_WASI_THREADS: ON
TOYWASM_ENABLE_WASI_LITTLEFS: ON
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: ON
TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: ON
- name: ubuntu-20.04-i386
os: ubuntu-20.04
compiler: clang
arch: i386
BUILD_TYPE: Release
TOYWASM_USE_SEPARATE_EXECUTE: ON
TOYWASM_USE_TAILCALL: ON
TOYWASM_ENABLE_TRACING: OFF
TOYWASM_USE_SMALL_CELLS: ON
TOYWASM_USE_SEPARATE_LOCALS: ON
MISC_FEATURES: OFF
TOYWASM_ENABLE_WASM_THREADS: OFF
TOYWASM_ENABLE_WASI_THREADS: OFF
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: OFF
TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: OFF
- name: ubuntu-20.04-arm64
os: ubuntu-20.04
compiler: clang
arch: arm64
BUILD_TYPE: Release
TOYWASM_USE_SEPARATE_EXECUTE: ON
TOYWASM_USE_TAILCALL: ON
TOYWASM_ENABLE_TRACING: OFF
TOYWASM_USE_SMALL_CELLS: ON
TOYWASM_USE_SEPARATE_LOCALS: ON
MISC_FEATURES: OFF
TOYWASM_ENABLE_WASM_THREADS: OFF
TOYWASM_ENABLE_WASI_THREADS: OFF
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: OFF
TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: OFF
#- name: ubuntu-20.04-armhf
# os: ubuntu-20.04
# compiler: clang
# arch: armhf
# BUILD_TYPE: Release
# TOYWASM_USE_SEPARATE_EXECUTE: ON
# TOYWASM_USE_TAILCALL: ON
# TOYWASM_ENABLE_TRACING: OFF
# TOYWASM_USE_SMALL_CELLS: ON
# TOYWASM_USE_SEPARATE_LOCALS: ON
# MISC_FEATURES: OFF
# TOYWASM_ENABLE_WASM_THREADS: OFF
# TOYWASM_ENABLE_WASI_THREADS: OFF
# TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: OFF
# TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: OFF
#- name: ubuntu-20.04-s390x
# os: ubuntu-20.04
# compiler: clang
# arch: s390x
# BUILD_TYPE: Release
# TOYWASM_USE_SEPARATE_EXECUTE: ON
# TOYWASM_USE_TAILCALL: ON
# TOYWASM_ENABLE_TRACING: OFF
# TOYWASM_USE_SMALL_CELLS: ON
# TOYWASM_USE_SEPARATE_LOCALS: ON
# MISC_FEATURES: OFF
# TOYWASM_ENABLE_WASM_THREADS: OFF
# TOYWASM_ENABLE_WASI_THREADS: OFF
# TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: OFF
# TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: OFF
- name: ubuntu-20.04-riscv64
os: ubuntu-20.04
compiler: clang
arch: riscv64
BUILD_TYPE: Release
TOYWASM_USE_SEPARATE_EXECUTE: ON
TOYWASM_USE_TAILCALL: ON
TOYWASM_ENABLE_TRACING: OFF
TOYWASM_USE_SMALL_CELLS: ON
TOYWASM_USE_SEPARATE_LOCALS: ON
MISC_FEATURES: OFF
TOYWASM_ENABLE_WASM_THREADS: OFF
TOYWASM_ENABLE_WASI_THREADS: OFF
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: OFF
TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: OFF
- name: full-ubuntu-20.04-i386
os: ubuntu-20.04
compiler: clang
arch: i386
BUILD_TYPE: Release
TOYWASM_USE_SEPARATE_EXECUTE: ON
TOYWASM_USE_TAILCALL: ON
TOYWASM_ENABLE_TRACING: OFF
TOYWASM_USE_SMALL_CELLS: ON
TOYWASM_USE_SEPARATE_LOCALS: ON
MISC_FEATURES: ON
TOYWASM_ENABLE_WASM_THREADS: ON
TOYWASM_ENABLE_WASI_THREADS: ON
TOYWASM_ENABLE_WASI_LITTLEFS: ON
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: ON
TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: ON
- name: full-ubuntu-20.04-arm64
os: ubuntu-20.04
compiler: clang
arch: arm64
BUILD_TYPE: Release
TOYWASM_USE_SEPARATE_EXECUTE: ON
TOYWASM_USE_TAILCALL: ON
TOYWASM_ENABLE_TRACING: OFF
TOYWASM_USE_SMALL_CELLS: ON
TOYWASM_USE_SEPARATE_LOCALS: ON
MISC_FEATURES: ON
TOYWASM_ENABLE_WASM_THREADS: ON
TOYWASM_ENABLE_WASI_THREADS: ON
TOYWASM_ENABLE_WASI_LITTLEFS: ON
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: ON
#- name: full-ubuntu-20.04-armhf
# os: ubuntu-20.04
# compiler: clang
# arch: armhf
# BUILD_TYPE: Release
# TOYWASM_USE_SEPARATE_EXECUTE: ON
# TOYWASM_USE_TAILCALL: ON
# TOYWASM_ENABLE_TRACING: OFF
# TOYWASM_USE_SMALL_CELLS: ON
# TOYWASM_USE_SEPARATE_LOCALS: ON
# MISC_FEATURES: ON
# TOYWASM_ENABLE_WASM_THREADS: ON
# TOYWASM_ENABLE_WASI_THREADS: ON
# TOYWASM_ENABLE_WASI_LITTLEFS: ON
# TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: ON
#- name: full-ubuntu-20.04-s390x
# os: ubuntu-20.04
# compiler: clang
# arch: s390x
# BUILD_TYPE: Release
# TOYWASM_USE_SEPARATE_EXECUTE: ON
# TOYWASM_USE_TAILCALL: ON
# TOYWASM_ENABLE_TRACING: OFF
# TOYWASM_USE_SMALL_CELLS: ON
# TOYWASM_USE_SEPARATE_LOCALS: ON
# MISC_FEATURES: ON
# TOYWASM_ENABLE_WASM_THREADS: ON
# TOYWASM_ENABLE_WASI_THREADS: ON
# TOYWASM_ENABLE_WASI_LITTLEFS: ON
# TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: ON
# TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: ON
- name: full-ubuntu-20.04-riscv64
os: ubuntu-20.04
compiler: clang
arch: riscv64
BUILD_TYPE: Release
TOYWASM_USE_SEPARATE_EXECUTE: ON
TOYWASM_USE_TAILCALL: ON
TOYWASM_ENABLE_TRACING: OFF
TOYWASM_USE_SMALL_CELLS: ON
TOYWASM_USE_SEPARATE_LOCALS: ON
MISC_FEATURES: ON
TOYWASM_ENABLE_WASM_THREADS: ON
TOYWASM_ENABLE_WASI_THREADS: ON
TOYWASM_ENABLE_WASI_LITTLEFS: ON
TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING: ON
TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES: ON
runs-on: ${{matrix.os}}
steps:
- name: Set environment
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
run: |
echo "builddir=${{github.workspace}}/build.cross.${{matrix.arch}}" >> ${GITHUB_ENV}
echo "extra_cmake_options<<EOF" >> ${GITHUB_ENV}
echo "-DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}}" >> ${GITHUB_ENV}
echo "-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/dist" >> ${GITHUB_ENV}
echo "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" >> ${GITHUB_ENV}
echo "-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0" >> ${GITHUB_ENV}
echo "-DTOYWASM_USE_SEPARATE_EXECUTE=${{matrix.TOYWASM_USE_SEPARATE_EXECUTE}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_USE_TAILCALL=${{matrix.TOYWASM_USE_TAILCALL}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_ENABLE_TRACING=${{matrix.TOYWASM_ENABLE_TRACING}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_ENABLE_TRACING_INSN=${{matrix.TOYWASM_ENABLE_TRACING}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_USE_SMALL_CELLS=${{matrix.TOYWASM_USE_SMALL_CELLS}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_USE_SEPARATE_LOCALS=${{matrix.TOYWASM_USE_SEPARATE_LOCALS}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_ENABLE_WASM_EXCEPTION_HANDLING=${{matrix.TOYWASM_ENABLE_WASM_EXCEPTION_HANDLING}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES=${{matrix.TOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_ENABLE_WASM_EXTENDED_CONST=${{matrix.MISC_FEATURES}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_ENABLE_WASM_MULTI_MEMORY=${{matrix.MISC_FEATURES}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_ENABLE_WASM_TAILCALL=${{matrix.MISC_FEATURES}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_ENABLE_WASM_THREADS=${{matrix.TOYWASM_ENABLE_WASM_THREADS}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_ENABLE_WASI_THREADS=${{matrix.TOYWASM_ENABLE_WASI_THREADS}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_ENABLE_WASI_LITTLEFS=${{matrix.TOYWASM_ENABLE_WASI_LITTLEFS}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_LITTLEFS_SOURCE_DIR=${{github.workspace}}/littlefs" >> ${GITHUB_ENV}
echo "-DTOYWASM_ENABLE_DYLD=${{matrix.MISC_FEATURES}}" >> ${GITHUB_ENV}
echo "-DTOYWASM_ENABLE_DYLD_DLFCN=${{matrix.MISC_FEATURES}}" >> ${GITHUB_ENV}
echo "EOF" >> ${GITHUB_ENV}
- name: Install dependencies (ubuntu)
if: startsWith(matrix.os, 'ubuntu-')
run: sudo apt-get update && sudo apt-get install -y pax virtualenv ninja-build
- name: Install dependencies (ubuntu native)
# for cross build, cross-setup.sh takes care of the toolchain
if: startsWith(matrix.os, 'ubuntu-') && matrix.arch == 'native'
run: sudo apt-get update && sudo apt-get install -y clang lld llvm-dev
# Note: jansson is for examples/callgraph
- name: Install dependencies (ubuntu native)
# for cross build, cross-setup.sh takes care of the toolchain
if: startsWith(matrix.os, 'ubuntu-') && matrix.arch == 'native'
run: sudo apt-get install -y wabt libcmocka-dev libjansson-dev
- name: Install dependencies (macOS)
if: startsWith(matrix.os, 'macos-')
run: |
brew install wabt
brew install cmocka
brew install virtualenv
brew install ninja
brew install jansson
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v3
with:
repository: littlefs-project/littlefs
path: littlefs
ref: v2.10.1
fetch-depth: 0
- name: Install dependencies (ubuntu native)
# for cross build, cross-setup.sh takes care of the toolchain
if: startsWith(matrix.os, 'ubuntu-') && matrix.arch == 'native'
run: |
sudo ./cross/setup-apt-llvm-org.sh
sudo apt-get update && sudo apt-get install -y clang-18 lld-18
sudo ./cross/setup-alternatives.sh
- name: Fix sources.list (cross)
if: matrix.arch != 'native'
run: |
curl -L -O https://raw.githubusercontent.com/yamt/garbage/master/myubuntu/apt/sources.list
sudo cp sources.list /etc/apt/
- name: cmake configure (cross)
if: matrix.arch != 'native'
env:
ARCH: ${{matrix.arch}}
EXTRA_CMAKE_OPTIONS: -G Ninja ${{env.extra_cmake_options}} -DTOYWASM_TARBALL_SUFFIX=-${{matrix.name}}
run: |
sudo ./cross/setup-apt-llvm-org.sh
sudo -E ./cross/cross-setup.sh
sudo ./cross/setup-alternatives.sh
./cross/cross-cmake-configure.sh
- name: cmake configure (native)
if: matrix.arch == 'native'
env:
EXTRA_CMAKE_OPTIONS: -G Ninja ${{env.extra_cmake_options}} -DTOYWASM_TARBALL_SUFFIX=-${{matrix.name}}
run: |
cmake -B ${{env.builddir}} ${EXTRA_CMAKE_OPTIONS}
- name: cmake -L
run: |
cmake -B ${{env.builddir}} -L
- name: Build
run: cmake --build ${{env.builddir}} --config ${{matrix.BUILD_TYPE}}
- name: Install QEMU
if: matrix.arch != 'native' && matrix.arch != 'i386'
run: |
sudo apt-get update && sudo apt-get install -y qemu-user-static
- name: toywasm --version
working-directory: ${{env.builddir}}
run: |
./toywasm --version
- name: toywasm --print-build-option
working-directory: ${{env.builddir}}
run: |
./toywasm --print-build-option
- name: Test
working-directory: ${{env.builddir}}
run: |
ctest -C ${{matrix.BUILD_TYPE}} -V -LE slow
- name: Test (slow)
# - for non-native, only runs slow tests on one job for each arch.
# - don't run it on s390x and riscv64 because it's too slow.
if: matrix.BUILD_TYPE == 'Release' && (matrix.arch == 'native' || (matrix.arch != 's390x' && matrix.arch != 'riscv64' && startsWith(matrix.name, 'full-')))
working-directory: ${{env.builddir}}
run: |
ctest -C ${{matrix.BUILD_TYPE}} -V -L slow
- name: Install
run: |
cmake --build ${{env.builddir}} --target install
- name: Tar
run: |
cmake --build ${{env.builddir}} --target tar
mkdir -p ${{github.workspace}}/artifacts
cp ${{env.builddir}}/*.tgz ${{github.workspace}}/artifacts/
- name: Test "app" example with the library we built
if: matrix.arch == 'native'
run: |
./test/build-example.sh app ${{env.builddir}}/toywasm-v*.tgz build
./examples/app/build/app ${{env.builddir}}/spectest.wasm
- name: Test "runwasi" example with the library we built
if: matrix.arch == 'native'
run: |
wat2wasm wat/wasi/hello.wat
./test/build-example.sh runwasi ${{env.builddir}}/toywasm-v*.tgz build
./examples/runwasi/build/runwasi $(pwd)/hello.wasm
- name: Test "hostfunc" example with the library we built
if: matrix.arch == 'native'
run: |
./test/build-example.sh hostfunc ${{env.builddir}}/toywasm-v*.tgz build
cd examples/hostfunc/wasm
pax -rvzf hostfunc-test-wasm.tgz
cd ..
BIN=./build/hostfunc ./run.sh
- name: Test "callgraph" example with the library we built
if: matrix.arch == 'native'
run: |
./test/build-example.sh callgraph ${{env.builddir}}/toywasm-v*.tgz build
wat2wasm --debug-names wat/wasi/recursive_hello_arg.wat
./examples/callgraph/build/callgraph $(pwd)/recursive_hello_arg.wasm
- name: Test "wasm2wasm" example with the library we built
if: matrix.arch == 'native'
run: |
./test/build-example.sh wasm2wasm ${{env.builddir}}/toywasm-v*.tgz build
wat2wasm --debug-names wat/wasi/recursive_hello_arg.wat
./examples/wasm2wasm/build/wasm2wasm $(pwd)/recursive_hello_arg.wasm out.wasm
./examples/wasm2wasm/build/wasm2wasm out.wasm out2.wasm
cmp out.wasm out2.wasm
# Note: the generated file (module.c) will be used by the next step
- name: Test "wasm2cstruct" example with the library we built
if: matrix.arch == 'native'
run: |
./test/build-example.sh wasm2cstruct ${{env.builddir}}/toywasm-v*.tgz build
wat2wasm --debug-names wat/wasi/recursive_hello_arg.wat
./examples/wasm2cstruct/build/wasm2cstruct g_wasm_module $(pwd)/recursive_hello_arg.wasm > ./examples/runwasi_cstruct/module.c
- name: Test "runwasi_cstruct" example with the library we built
if: matrix.arch == 'native'
run: |
./test/build-example.sh runwasi_cstruct ${{env.builddir}}/toywasm-v*.tgz build
./examples/runwasi_cstruct/build/runwasi_cstruct -- foo hello
- name: Upload artifacts
if: matrix.name != 'noname'
uses: actions/upload-artifact@v3
with:
name: ${{matrix.name}}
path: ${{github.workspace}}/artifacts
- name: Upload the build dir for post mortem investigation
if: always()
uses: actions/upload-artifact@v3
with:
name: builddir-${{github.run_id}}-${{strategy.job-index}}-${{matrix.name}}
path: ${{env.builddir}}
wasm-on-wasm:
env:
CC: ${{matrix.compiler}}
strategy:
fail-fast: false
matrix:
name: [wasm32-wasi, full-wasm32-wasi]
os: [ubuntu-20.04, macos-13]
compiler: [clang]
include:
- name: full-wasm32-wasi
extra: "-DTOYWASM_ENABLE_WASM_EXTENDED_CONST=ON -DTOYWASM_ENABLE_WASM_MULTI_MEMORY=ON -DTOYWASM_ENABLE_WASM_TAILCALL=ON -DTOYWASM_ENABLE_WASM_THREADS=ON -DTOYWASM_ENABLE_WASI_THREADS=ON -DTOYWASM_ENABLE_WASI_LITTLEFS=ON -DTOYWASM_ENABLE_WASM_EXCEPTION_HANDLING=ON -DTOYWASM_ENABLE_WASM_CUSTOM_PAGE_SIZES=ON TOYWASM_ENABLE_DYLD=ON -DTOYWASM_ENABLE_DYLD_DLFCN=ON"
runs-on: ${{matrix.os}}
steps:
- name: Set environment
run: |
echo "builddir=${{github.workspace}}/build.wasm" >> ${GITHUB_ENV}
echo "TOYWASM_NATIVE=${{github.workspace}}/build.native/toywasm" >> ${GITHUB_ENV}
- name: Install dependencies (ubuntu)
if: startsWith(matrix.os, 'ubuntu-')
run: sudo apt-get update && sudo apt-get install -y wabt pax virtualenv ninja-build
- name: Install dependencies (macOS)
if: startsWith(matrix.os, 'macos-')
run: |
brew install wabt
brew install virtualenv
brew install ninja
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/checkout@v3
with:
repository: littlefs-project/littlefs
path: littlefs
ref: v2.10.1
fetch-depth: 0
- name: Build and test
env:
# Note: we don't care about tarball suffix for native build here.
EXTRA_CMAKE_OPTIONS: -G Ninja -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/dist -DTOYWASM_TARBALL_SUFFIX=-${{matrix.name}} -DTOYWASM_LITTLEFS_SOURCE_DIR=${{github.workspace}}/littlefs ${{matrix.extra}}
run: ./wasm-on-wasm.sh
- name: toywasm --version
env:
TOYWASM_WASM: ${{env.builddir}}/toywasm
working-directory: ${{env.builddir}}
run: |
${{github.workspace}}/test/toywasm-on-toywasm.py --version
- name: toywasm --print-build-option
env:
TOYWASM_WASM: ${{env.builddir}}/toywasm
working-directory: ${{env.builddir}}
run: |
${{github.workspace}}/test/toywasm-on-toywasm.py --print-build-option
- name: Test
working-directory: ${{env.builddir}}
run: |
ctest -V -LE slow
- name: Test (slow)
if: false
working-directory: ${{env.builddir}}
run: |
ctest -V -L slow
- name: Install
run: |
cmake --build build.wasm --target install
- name: Tar
run: |
cmake --build build.wasm --target tar
mkdir -p ${{github.workspace}}/artifacts
cp build.wasm/*.tgz ${{github.workspace}}/artifacts/
- name: Upload artifacts
# wasm binary is same among OSes. Only upload one of them.
if: startsWith(matrix.os, 'ubuntu-')
uses: actions/upload-artifact@v3
with:
name: ${{matrix.name}}
path: ${{github.workspace}}/artifacts
- name: Upload the build dir for post mortem investigation
if: always()
uses: actions/upload-artifact@v3
with:
name: builddir-${{github.run_id}}-${{strategy.job-index}}-${{matrix.name}}
path: ${{env.builddir}}
release:
if: github.event_name != 'pull_request'
needs: [build, wasm-on-wasm]
runs-on: ubuntu-20.04
steps:
- uses: actions/download-artifact@v3
with:
name: macos-13.0
path: release_assets
- uses: actions/download-artifact@v3
with:
name: full-macos-13.0
path: release_assets
- uses: actions/download-artifact@v3
with:
name: ubuntu-20.04-amd64
path: release_assets
- uses: actions/download-artifact@v3
with:
name: full-ubuntu-20.04-amd64
path: release_assets
- uses: actions/download-artifact@v3
with:
name: ubuntu-20.04-i386
path: release_assets
- uses: actions/download-artifact@v3
with:
name: ubuntu-20.04-arm64
path: release_assets
#- uses: actions/download-artifact@v3
# with:
# name: ubuntu-20.04-armhf
# path: release_assets
#- uses: actions/download-artifact@v3
# with:
# name: ubuntu-20.04-s390x
# path: release_assets
- uses: actions/download-artifact@v3
with:
name: ubuntu-20.04-riscv64
path: release_assets
- uses: actions/download-artifact@v3
with:
name: full-ubuntu-20.04-i386
path: release_assets
- uses: actions/download-artifact@v3
with:
name: full-ubuntu-20.04-arm64
path: release_assets
#- uses: actions/download-artifact@v3
# with:
# name: full-ubuntu-20.04-armhf
# path: release_assets
#- uses: actions/download-artifact@v3
# with:
# name: full-ubuntu-20.04-s390x
# path: release_assets
- uses: actions/download-artifact@v3
with:
name: full-ubuntu-20.04-riscv64
path: release_assets
- uses: actions/download-artifact@v3
with:
name: wasm32-wasi
path: release_assets
- uses: actions/download-artifact@v3
with:
name: full-wasm32-wasi
path: release_assets
- name: Snapshot release
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
uses: marvinpinto/[email protected]
with:
repo_token: ${{secrets.GITHUB_TOKEN}}
automatic_release_tag: latest
title: "Latest snapshot"
files: |
release_assets/*
- name: Tagged release
if: startsWith(github.ref, 'refs/tags/v')
uses: marvinpinto/[email protected]
with:
repo_token: ${{secrets.GITHUB_TOKEN}}
prerelease: false
files: |
release_assets/*