clang-format #1193
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-latest | |
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-latest, macos-latest] | |
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-latest | |
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-latest | |
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-11.0 | |
os: macos-latest | |
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-11.0 | |
os: macos-latest | |
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-latest native) | |
# for cross build, cross-setup.sh takes care of the toolchain | |
if: matrix.os == 'ubuntu-latest' && 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.9.0 | |
fetch-depth: 0 | |
- name: Install dependencies (ubuntu/focal native) | |
# for cross build, cross-setup.sh takes care of the toolchain | |
if: matrix.os == 'ubuntu-20.04' && 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-latest, macos-12] | |
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.9.0 | |
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-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: macos-11.0 | |
path: release_assets | |
- uses: actions/download-artifact@v3 | |
with: | |
name: full-macos-11.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/* |