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@v1 - name: Install multilib if: contains(matrix.flags, '-m32') run: sudo apt-get 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@v1 - 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@v1 - 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@v1 - name: Install Wasienv run: curl https://raw.githubusercontent.com/wasienv/wasienv/master/install.sh | sh - name: Install Wasmer 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 -DWASIENV=1 .. - 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@v1 - 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@v1 - 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-raspberry: runs-on: [self-hosted, linux, ARM] if: "false" # TODO: implement QEMU-based RPi build/test environment timeout-minutes: 10 strategy: fail-fast: false matrix: compiler: [gcc, clang] steps: - uses: actions/checkout@v1 - name: Run CMake env: CC: ${{ matrix.compiler }} run: | mkdir build cd build cmake .. - name: Build run: | cmake --build build - name: Run spec tests run: | cd test python3 run-spec-test.py - name: Run WASI tests run: | cd test ./run-wasi-test.py build-platformio: runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@v1 - 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 - name: Build ESP32 run: | cd platforms/esp32-pio pio run build-platformio-arm: runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@v1 - 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@v1 - 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@v1 - 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@v1 - 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