updated sod (minor refactoring) #621
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
# CI workflow | |
name: test | |
on: [push, pull_request] | |
env: | |
# Rust equivalent of -Werror | |
RUSTFLAGS: --deny warnings | |
# used during LLVM installation | |
LLVM_VERSION: 12 | |
# URLs for WebAssembly libcs | |
WASMCEPTION_URL: https://github.com/gwsystems/wasmception/releases/download/v0.2.0/wasmception-linux-x86_64-0.2.0.tar.gz | |
WASI_SDK_URL: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz | |
LIBUV_URL: https://github.com/libuv/libuv/archive/refs/tags/v1.42.0.tar.gz | |
UVWASI_URL: https://github.com/nodejs/uvwasi/archive/refs/tags/v0.0.11.tar.gz | |
# Used by Makefiles that compile *.c to *.wasm | |
WASI_SDK_PATH: /opt/wasi-sdk/ | |
# job control | |
jobs: | |
format: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Clang Format | |
run: | | |
sudo apt install clang-format-12 --yes | |
find runtime example_code -type f -print | grep -v runtime/libuv | grep -v runtime/uvwasi | grep --exclude-dir -i -E '^*.(c|h|ld|s)$' | xargs clang-format-12 -Werror -n -ferror-limit=0 | |
- name: Cargo Format | |
run: cargo fmt -- --check | |
test: | |
runs-on: ubuntu-20.04 | |
if: always() | |
strategy: | |
matrix: | |
libc: [wasmception, wasi-sdk] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install | |
run: | | |
sudo apt install binaryen --yes | |
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" bash $LLVM_VERSION | |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$LLVM_VERSION 100 | |
sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-$LLVM_VERSION 100 | |
sudo apt install libc++-dev libc++abi-dev wabt --yes | |
# not really sure why we need to modify this | |
PATH=/usr/bin:$PATH | |
llvm-config --version | |
- name: Get wasmception | |
if: matrix.libc == 'wasmception' | |
run: | | |
wget $WASMCEPTION_URL -O wasmception.tar.gz | |
mkdir -p wasmception | |
tar xvfz wasmception.tar.gz -C wasmception | |
- name: Get wasi-sdk | |
if: matrix.libc == 'wasi-sdk' | |
run: | | |
wget $WASI_SDK_URL -O wasi-sdk.tar.gz | |
mkdir -p /opt/wasi-sdk | |
tar xvfz wasi-sdk.tar.gz --strip-components=1 -C /opt/wasi-sdk | |
- name: Install runtime dependencies (libuv, uvwasi) | |
if: matrix.libc == 'wasi-sdk' | |
run: | | |
make -C ./runtime/thirdparty install | |
- name: Compile | |
run: | | |
cargo build --release | |
- name: Preliminary tests | |
# note we skip code_benches; we run code_benches/run.py ourselves | |
# to pass explicit flags | |
run: | | |
cargo test -- --skip code_benches | |
# These tests assume WASI | |
- name: WebAssembly Specification Test Suite (uvwasi) | |
if: matrix.libc == 'wasi-sdk' | |
run: | | |
cd tests/wat && ./run.sh uvwasi | |
- name: WebAssembly Specification Test Suite (minimal) | |
if: matrix.libc == 'wasi-sdk' | |
run: | | |
cd tests/wat && ./run.sh minimal | |
- name: WebAssembly Specification Test Suite (wasmception) | |
if: matrix.libc == 'wasmception' | |
run: | | |
cd tests/wat && ./run.sh wasmception | |
- name: WASI Tests | |
if: matrix.libc == 'wasi-sdk' | |
run: | | |
make -C tests/wasi all | |
cd tests/wasi && bash ./run.sh | |
- name: Code benches | |
run: | | |
./code_benches/run.py --debug --${{matrix.libc}} -o benchmarks.csv | |
- name: Results | |
run: cat benchmarks.csv | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ${{matrix.libc}}-benchmarks | |
path: benchmarks.csv |