Skip to content

test

test #635

Workflow file for this run

# CI workflow
name: test
on: [push, pull_request]
env:
# Rust equivalent of -Werror
RUSTFLAGS: --deny warnings
# used during LLVM installation
LLVM_VERSION: 12
WASI_SDK_VERSION: 12
CLANG_FORMAT_VERSION: 13
# URLs for WebAssembly libcs
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: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-$CLANG_FORMAT_VERSION main"
sudo apt update
sudo apt install clang-format-$CLANG_FORMAT_VERSION --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-$CLANG_FORMAT_VERSION -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: |
WASMCEPTION_URL=https://github.com/gwsystems/wasmception/releases/download/v0.2.0/wasmception-linux-x86_64-0.2.0.tar.gz
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: |
WASI_SDK_URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK_VERSION/wasi-sdk-$WASI_SDK_VERSION.0-linux.tar.gz
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