Skip to content

comment

comment #544

Workflow file for this run

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:
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]
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
# exclude some more combinations to reduce the matrix
- TOYWASM_USE_SMALL_CELLS: ON
TOYWASM_USE_SEPARATE_LOCALS: 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
#- 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
- 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
- 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
- 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
- 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
#- 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
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_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_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
- 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
- name: Install dependencies (macOS)
if: startsWith(matrix.os, 'macos-')
run: |
brew install wabt
brew install cmocka
brew install virtualenv
brew install ninja
- uses: actions/checkout@v3
with:
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-focal-proposed.sh
sudo apt-get update && sudo apt-get install -y clang-13 lld-13
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-focal-proposed.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'
# install newer qemu from
# https://launchpad.net/%7Ecanonical-server/+archive/ubuntu/server-backports/
# https://github.com/yamt/toywasm/pull/53#issuecomment-1605899935
run: |
sudo apt-get update && sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:canonical-server/server-backports
sudo apt-get update && sudo apt-get install -y qemu-user-static
- name: toywasm --version
working-directory: ${{env.builddir}}
run: |
./toywasm --version
- 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: |
./toywasm --version
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.BUILD_TYPE == 'Release' && matrix.arch == 'native'
run: |
./test/test-example.sh app ${{env.builddir}}/toywasm-v*.tgz ${{env.builddir}}/spectest.wasm
- name: Test "runwasi" example with the library we built
if: matrix.BUILD_TYPE == 'Release' && matrix.arch == 'native'
run: |
wat2wasm wat/wasi/hello.wat
./test/test-example.sh runwasi ${{env.builddir}}/toywasm-v*.tgz $(pwd)/hello.wasm
- 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"
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
- 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}} ${{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: 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/*