You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wasm3/.github/workflows/tests.yml

502 lines
16 KiB
YAML

name: tests
5 years ago
on: [push, pull_request]
5 years ago
jobs:
build-linux:
5 years ago
runs-on: ubuntu-latest
4 years ago
name: build-linux-${{ matrix.config.target }}
timeout-minutes: 10
5 years ago
strategy:
fail-fast: false
matrix:
4 years ago
config:
- {target: clang, cc: clang, }
- {target: clang-x86, cc: clang, flags: -DCMAKE_C_FLAGS="-m32", install: "gcc-multilib" }
- {target: gcc, cc: gcc, }
- {target: gcc-debug, cc: gcc, flags: -DCMAKE_BUILD_TYPE=Debug }
# TODO: fails on numeric operations
#- {target: gcc-x86, cc: gcc, flags: "-m32", install: "gcc-multilib" }
5 years ago
steps:
- uses: actions/checkout@v2
4 years ago
- name: Install ${{ matrix.config.install }}
if: ${{ matrix.config.install }}
4 years ago
run: |
sudo apt update
4 years ago
sudo apt install ${{ matrix.config.install }}
4 years ago
- name: Configure
env:
4 years ago
CC: ${{ matrix.config.cc }}
5 years ago
run: |
mkdir build
cd build
4 years ago
cmake ${{ matrix.config.flags }} ..
5 years ago
- name: Build
5 years ago
run: |
cmake --build build
4 years ago
- name: Test WebAssembly spec
4 years ago
run: cd test && python3 run-spec-test.py
4 years ago
- name: Test WASI apps
4 years ago
run: cd test && python3 run-wasi-test.py
4 years ago
build-linux-alpine:
runs-on: ubuntu-latest
container: alpine:3.10
steps:
- uses: actions/checkout@v2
4 years ago
- name: Prepare
run: apk add build-base cmake python3 git --update-cache
4 years ago
- name: Configure
4 years ago
run: |
mkdir build
cd build
cmake ..
4 years ago
- name: Build
run: cmake --build build
4 years ago
- name: Test WebAssembly spec
4 years ago
run: cd test && python3 run-spec-test.py
4 years ago
- name: Test WASI apps
4 years ago
run: cd test && python3 run-wasi-test.py
build-mac:
runs-on: macos-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
4 years ago
- name: Configure
run: |
mkdir build
cd build
cmake ..
5 years ago
- name: Build
run: |
cmake --build build
4 years ago
- name: Test WebAssembly spec
4 years ago
run: cd test && python3 run-spec-test.py
4 years ago
- name: Test WASI apps
4 years ago
run: cd test && python3 run-wasi-test.py
4 years ago
build-windows:
runs-on: windows-latest
4 years ago
name: build-windows-${{ matrix.config.target }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
4 years ago
config:
- {target: clang-x64, platform: "-A x64", toolset: "-T ClangCL" }
- {target: msvc-x64, platform: "-A x64", toolset: "" }
- {target: clang-x86, platform: "-A Win32", toolset: "-T ClangCL" }
- {target: msvc-x86, platform: "-A Win32", toolset: "" }
steps:
- uses: actions/checkout@v2
4 years ago
- name: Configure
run: |
mkdir build
cd build
4 years ago
cmake ${{ matrix.config.platform }} ${{ matrix.config.toolset }} ..
5 years ago
- name: Build
run: |
cmake --build build --config Release
cp ./build/Release/wasm3.exe ./build/
4 years ago
- name: Test WebAssembly spec
run: |
cd test
python run-spec-test.py
4 years ago
- name: Test WASI apps
run: |
cd test
python run-wasi-test.py
5 years ago
build-wasi:
runs-on: ubuntu-latest
timeout-minutes: 10
5 years ago
steps:
- uses: actions/checkout@v2
4 years ago
- name: Install Python dependencies
4 years ago
run: |
4 years ago
python3 -m pip install pip==20.1.1
4 years ago
python3 -m pip install --upgrade setuptools wheel
4 years ago
pip3 --version
5 years ago
- name: Install Wasmer
4 years ago
env:
4 years ago
WASMER_RELEASE_TAG: "0.17.1"
4 years ago
run: curl https://get.wasmer.io -sSfL | sh
- name: Install Wasienv
run: curl https://raw.githubusercontent.com/wasienv/wasienv/master/install.sh | sh
4 years ago
- name: Configure
5 years ago
run: |
source $HOME/.wasienv/wasienv.sh
mkdir build-wasi
cd build-wasi
4 years ago
wasimake cmake -DBUILD_WASI=metawasi ..
5 years ago
- name: Build
run: |
source $HOME/.wasienv/wasienv.sh
cmake --build build-wasi
4 years ago
- name: Test WebAssembly spec (in Wasmer)
run: |
5 years ago
source $HOME/.wasmer/wasmer.sh
cd test
python3 run-spec-test.py --exec "wasmer run --dir=. ../build-wasi/wasm3.wasm -- --repl"
# TODO: Test WASI apps in Wasmer
5 years ago
4 years ago
- name: Configure (native)
5 years ago
run: |
mkdir build
cd build
4 years ago
export CFLAGS="-Dd_m3LogOutput=0"
5 years ago
cmake ..
- name: Build (native)
run: |
cmake --build build
4 years ago
- name: Test WebAssembly spec (in Wasm3, self-hosting)
5 years ago
run: |
cd test
5 years ago
cp ../build-wasi/wasm3.wasm ./
4 years ago
python3 run-spec-test.py --exec "../build/wasm3 --stack-size 2097152 ../build-wasi/wasm3.wasm --repl"
- name: Test WASI apps (in Wasm3, self-hosting)
run: |
cd test
4 years ago
python3 run-wasi-test.py --fast --exec "../build/wasm3 --stack-size 2097152 ../build-wasi/wasm3.wasm"
5 years ago
5 years ago
build-ios:
runs-on: macos-latest
timeout-minutes: 10
5 years ago
steps:
- uses: actions/checkout@v2
5 years ago
- 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
5 years ago
xcodebuild build -scheme wasm3 -project wasm3.xcodeproj -configuration Release -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.3'
5 years ago
build-android:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
5 years ago
- 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
4 years ago
build-cross-qemu:
4 years ago
runs-on: ubuntu-latest
4 years ago
name: build-cross-qemu-${{ matrix.config.target }}
timeout-minutes: 10
4 years ago
4 years ago
strategy:
4 years ago
fail-fast: false
4 years ago
matrix:
4 years ago
config:
4 years ago
#- {target: i386, toolchain: gcc-multilib, cc: clang -m32, qemu: qemu-i386-static }
- {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 }
4 years ago
- {target: aarch64, toolchain: gcc-aarch64-linux-gnu, cc: aarch64-linux-gnu-gcc, qemu: qemu-aarch64-static }
4 years ago
- {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 }
4 years ago
- {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: mips, toolchain: gcc-mips-linux-gnu, cc: mips-linux-gnu-gcc, qemu: qemu-mips-static }
- {target: mips64, toolchain: gcc-mips64-linux-gnuabi64, cc: mips64-linux-gnuabi64-gcc, qemu: qemu-mips64-static }
- {target: mipsel, toolchain: gcc-mipsel-linux-gnu, cc: mipsel-linux-gnu-gcc, qemu: qemu-mipsel-static }
- {target: mips64el,toolchain: gcc-mips64el-linux-gnuabi64, cc: mips64el-linux-gnuabi64-gcc,qemu: qemu-mips64el-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, skip_wasi: true }
4 years ago
4 years ago
#- {target: i386 (u64 slots), toolchain: gcc-multilib, cc: clang -m32, qemu: qemu-i386-static, cflags: -Dd_m3Use32BitSlots=0 }
- {target: arm (u64 slots), toolchain: gcc-arm-linux-gnueabi, cc: arm-linux-gnueabi-gcc, qemu: qemu-arm-static, cflags: -Dd_m3Use32BitSlots=0 }
- {target: aarch64 (u64 slots), toolchain: gcc-aarch64-linux-gnu, cc: aarch64-linux-gnu-gcc, qemu: qemu-aarch64-static, cflags: -Dd_m3Use32BitSlots=0 }
- {target: ppc (u64 slots), toolchain: gcc-powerpc-linux-gnu, cc: powerpc-linux-gnu-gcc, qemu: qemu-ppc-static, cflags: -Dd_m3Use32BitSlots=0 }
- {target: ppc64 (u64 slots), toolchain: gcc-powerpc64-linux-gnu, cc: powerpc64-linux-gnu-gcc, qemu: qemu-ppc64-static, cflags: -Dd_m3Use32BitSlots=0 }
4 years ago
steps:
- uses: actions/checkout@v2
4 years ago
- name: Install QEMU
4 years ago
env:
QEMU_SRC: "http://archive.ubuntu.com/ubuntu/pool/universe/q/qemu"
4 years ago
QEMU_VER: "qemu-user-static_4\\.2-.*_amd64.deb$"
4 years ago
run: |
DEB=`curl -s $QEMU_SRC/ | grep -o -E 'href="([^"#]+)"' | cut -d'"' -f2 | grep $QEMU_VER | tail -1`
4 years ago
wget $QEMU_SRC/$DEB
sudo dpkg -i $DEB
4 years ago
- name: Install ${{ matrix.config.toolchain }}
run: |
sudo apt update
4 years ago
sudo apt install ${{ matrix.config.toolchain }}
4 years ago
- name: Build
4 years ago
run: |
mkdir build
cd build
${{ matrix.config.cc }} -DASSERTS -Dd_m3HasWASI \
4 years ago
-I../source ../source/*.c ../platforms/app/main.c \
-O3 -g0 -flto -lm -static \
4 years ago
-o wasm3
4 years ago
- name: Test WebAssembly spec
4 years ago
run: |
cd test
4 years ago
python3 run-spec-test.py --exec "${{ matrix.config.qemu }} ../build/wasm3 --repl"
4 years ago
- name: Test WASI apps
if: ${{ !matrix.config.skip_wasi }}
4 years ago
run: |
cd test
4 years ago
python3 run-wasi-test.py --fast --exec "${{ matrix.config.qemu }} ../build/wasm3"
4 years ago
build-platformio:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
5 years ago
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install PlatformIO
run: |
5 years ago
python -m pip install --upgrade pip
4 years ago
pip install -U platformio
- name: Build AVR ATmega1284
run: |
cd platforms/arduino
pio run -e mega1284
! nm .pio/build/mega1284/firmware.elf | grep printf
5 years ago
- name: Build ESP8266
run: |
cd platforms/esp8266
5 years ago
pio run
4 years ago
# TODO:
#- name: Build ESP32
# run: |
# cd platforms/esp32-pio
# pio run
5 years ago
build-platformio-arm:
runs-on: ubuntu-latest
timeout-minutes: 10
5 years ago
steps:
- uses: actions/checkout@v2
5 years ago
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install PlatformIO
5 years ago
run: |
5 years ago
python -m pip install --upgrade pip
4 years ago
pip install -U platformio
5 years ago
- name: Build Arduino MKR1000
run: |
cd platforms/arduino
pio run -e mkr1000
5 years ago
- 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
5 years ago
build-platformio-riscv:
runs-on: ubuntu-latest
timeout-minutes: 10
5 years ago
steps:
- uses: actions/checkout@v2
5 years ago
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
4 years ago
pip install -U platformio
5 years ago
- name: Build HiFive1
run: |
cd platforms/hifive1
pio run
- name: Build Sipeed MAIX
run: |
cd platforms/arduino
pio run -e maix
5 years ago
build-particle:
runs-on: ubuntu-latest
timeout-minutes: 10
5 years ago
if: "github.event_name == 'push'"
steps:
- uses: actions/checkout@v2
- name: Set up Particle CLI
5 years ago
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
4 years ago
- name: Configure
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
4 years ago
4 years ago
build-as-cpp:
name: maintenance (build as C++)
4 years ago
runs-on: ubuntu-latest
timeout-minutes: 10
4 years ago
steps:
- uses: actions/checkout@v2
4 years ago
- name: Build
4 years ago
run: |
mkdir build
cd build
g++ -xc++ -Dd_m3HasWASI \
-I../source ../source/*.c ../platforms/app/main.c \
-O3 -g0 -lm \
-o wasm3
4 years ago
- name: Test
run: ./build/wasm3 ./test/wasi/test.wasm
4 years ago
build-with-logs:
name: maintenance (debug logs)
runs-on: ubuntu-latest
timeout-minutes: 10
4 years ago
steps:
- uses: actions/checkout@v2
4 years ago
- name: Build
run: |
4 years ago
mkdir build
cd build
g++ -xc++ -Dd_m3HasWASI -DDEBUG \
-Dd_m3EnableOpTracing=1 \
-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
4 years ago
- name: Test
4 years ago
run: ./build/wasm3 ./test/wasi/test.wasm > /dev/null
4 years ago
build-preprocessed-ops:
name: maintenance (preprocess ops)
runs-on: ubuntu-latest
timeout-minutes: 10
4 years ago
steps:
- uses: actions/checkout@v2
4 years ago
- name: Install sponge
run: |
sudo apt update
sudo apt install moreutils
4 years ago
- name: Build
4 years ago
run: |
make -f extra/utils.mk preprocess
4 years ago
mkdir build
cd build
4 years ago
gcc -Dd_m3HasWASI \
-I../source ../source/*.c ../platforms/app/main.c \
-O3 -g0 -lm \
-o wasm3
4 years ago
- name: Test
run: ./build/wasm3 ./test/wasi/test.wasm
build-python:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Build python module
run: |
pip install .
- name: Test with pytest
run: |
pip install pytest
pytest platforms/python/test