name: tests on: [push, pull_request] jobs: build-linux: runs-on: ubuntu-latest timeout-minutes: 10 strategy: fail-fast: false matrix: compiler: [gcc, clang] flags: ["", "-m32"] build_type: ["-DCMAKE_BUILD_TYPE=Debug", ""] exclude: - compiler: clang build_type: "-DCMAKE_BUILD_TYPE=Debug" - compiler: gcc # TODO: fails on numeric operations flags: "-m32" steps: - uses: actions/checkout@v2 - name: Install multilib if: contains(matrix.flags, '-m32') run: | sudo apt update sudo apt install gcc-multilib - name: Run CMake env: CC: ${{ matrix.compiler }} CFLAGS: ${{ matrix.flags }} run: | mkdir build cd build cmake ${{ matrix.build_type }} .. - name: Build run: | cmake --build build - name: Run spec tests run: | cd test ./run-spec-test.py - name: Run WASI tests run: | cd test ./run-wasi-test.py build-mac: runs-on: macos-latest timeout-minutes: 10 steps: - uses: actions/checkout@v2 - name: Run CMake run: | mkdir build cd build cmake .. - name: Build run: | cmake --build build - name: Run spec tests run: | cd test ./run-spec-test.py - name: Run WASI tests run: | cd test ./run-wasi-test.py build-win: runs-on: windows-latest timeout-minutes: 10 strategy: fail-fast: false matrix: platform: ["-A Win32", "-A x64"] toolset: ["-T ClangCL", ""] steps: - uses: actions/checkout@v2 - name: Run CMake run: | mkdir build cd build cmake ${{ matrix.platform }} ${{ matrix.toolset }} .. - name: Build run: | cmake --build build --config Release cp ./build/Release/wasm3.exe ./build/ - name: Run spec tests run: | cd test python run-spec-test.py - name: Run WASI tests 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.15.0" run: curl https://get.wasmer.io -sSfL | sh - name: Run CMake run: | source $HOME/.wasienv/wasienv.sh mkdir build-wasi cd build-wasi wasimake cmake .. - name: Build run: | source $HOME/.wasienv/wasienv.sh cmake --build build-wasi - name: Run spec tests (in Wasmer) run: | source $HOME/.wasmer/wasmer.sh cd test ./run-spec-test.py --exec "wasmer run --dir=. ../build-wasi/wasm3.wasm -- --repl" - name: Run CMake (native) run: | mkdir build cd build cmake .. - name: Build (native) run: | cmake --build build - name: Run spec tests (in Wasm3, self-hosting) continue-on-error: true # TODO run: | cd test cp ../build-wasi/wasm3.wasm ./ ./run-spec-test.py --exec "../build/wasm3 ./wasm3.wasm --repl" 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: 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: 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, spec-fails: true } - {target: mips, toolchain: gcc-mips-linux-gnu, cc: mips-linux-gnu-gcc, qemu: qemu-mips-static, spec-fails: true } - {target: mips64, toolchain: gcc-mips64-linux-gnuabi64, cc: mips64-linux-gnuabi64-gcc, qemu: qemu-mips64-static, spec-fails: true } - {target: mipsel, toolchain: gcc-mipsel-linux-gnu, cc: mipsel-linux-gnu-gcc, qemu: qemu-mipsel-static, spec-fails: true } - {target: mips64el,toolchain: gcc-mips64el-linux-gnuabi64, cc: mips64el-linux-gnuabi64-gcc,qemu: qemu-mips64el-static, spec-fails: true } steps: - uses: actions/checkout@v2 - name: Install prerequisites run: | sudo apt update wget http://archive.ubuntu.com/ubuntu/pool/universe/q/qemu/qemu-user-static_4.2-3ubuntu4_amd64.deb sudo dpkg -i qemu-user-static_4.2-3ubuntu4_amd64.deb sudo apt install ${{ matrix.config.toolchain }} - name: Cross-compile 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: Run spec tests continue-on-error: ${{ matrix.config.spec-fails }} run: | cd test python3 run-spec-test.py --exec "${{ matrix.config.qemu }} ../build/wasm3 --repl" - name: Run WASI tests continue-on-error: true 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: Run CMake 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 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 -Dd_m3LogsDefined \ -Dd_m3EnableOpTracing \ -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 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