-
Notifications
You must be signed in to change notification settings - Fork 18
131 lines (116 loc) · 4.44 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# CI workflow
name: test
on: [push, pull_request]
env:
# Rust equivalent of -Werror
RUSTFLAGS: --deny warnings
# used during LLVM installation
LLVM_VERSION: 13
WASI_SDK_VERSION: 12
# 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: Install Rust 1.56.0
run: |
rustup default 1.56.0
rustup component add rustfmt
rustup update
cargo --version
- name: Install 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-$LLVM_VERSION main"
sudo apt update
sudo apt install clang-format-$LLVM_VERSION --yes
sudo update-alternatives --remove-all clang-format
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-$LLVM_VERSION 100
- name: Run Clang Format check
run: ./format.sh -d
- name: Run Cargo Format check
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 Rust 1.56.0
run: |
rustup default 1.56.0
rustup update
cargo --version
- name: Install LLVM
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 update-alternatives --install /usr/bin/llvm-dis llvm-dis /usr/bin/llvm-dis-$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 awsm
run: |
cargo --version
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