forked from WebAssembly/wabt
-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (188 loc) · 5.71 KB
/
build.yml
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: CI
on:
create:
tags:
push:
branches:
- main
pull_request:
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v1
- name: install tools
run: |
pip3 install flake8==3.7.8
sudo apt-get install clang-format
- run: flake8
- run: ./scripts/clang-format-diff.sh
env:
GITHUB_EVENT_BEFORE: ${{ github.event.before }}
build:
name: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v1
with:
submodules: true
- name: install ninja (linux)
run: sudo apt-get install ninja-build
if: matrix.os == 'ubuntu-latest'
- name: install ninja (osx)
run: brew install ninja
if: matrix.os == 'macos-12'
- name: install ninja (win)
run: choco install ninja
if: matrix.os == 'windows-latest'
- name: mkdir
run: mkdir -p out
- name: cmake
run: cmake .. -G Ninja -DWITH_WASI=ON -DWERROR=ON -Werror=dev -Wno-deprecated
working-directory: out
if: matrix.os != 'windows-latest'
- name: cmake (windows)
run: cmake .. -DWERROR=ON -Werror=dev
working-directory: out
if: matrix.os == 'windows-latest'
- name: build
run: cmake --build out
- name: check if generated files are up-to-date
run: python ./scripts/check_clean.py
- name: unittests
run: cmake --build out --target run-unittests
- name: c-api-tests
run: cmake --build out --target run-c-api-tests
- name: tests
run: cmake --build out --target run-tests
emscripten:
name: emscripten
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: build
run: |
docker run -di --name emscripten -v $(pwd):/src emscripten/emsdk:latest bash
docker exec emscripten emcc -v
docker exec emscripten emcmake cmake .
docker exec emscripten make -j 2 VERBOSE=1
wasi:
name: wasi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: build-tools
run: |
docker run -di --name wasi-sdk -v $(pwd):/src --workdir /src ghcr.io/webassembly/wasi-sdk:wasi-sdk-20 bash
docker exec wasi-sdk cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DBUILD_TESTS=0 -DBUILD_LIBWASM=0
docker exec wasi-sdk cmake --build out --config Release --target install
- uses: ./.github/actions/release-archive
with:
os: wasi
sanitize:
name: sanitize
runs-on: ubuntu-latest
env:
USE_NINJA: "1"
CC: "clang"
WASM2C_CFLAGS: "-march=x86-64-v2" # currently required for SIMDe to pass some tests on x86-64
strategy:
matrix:
sanitizer: [asan, ubsan, fuzz]
type: [debug, release]
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v1
with:
submodules: true
- run: sudo apt-get install ninja-build
- run: make clang-${{ matrix.type }}-${{ matrix.sanitizer }}
- if: ${{ matrix.sanitizer }} != fuzz
run: make test-clang-${{ matrix.type }}-${{ matrix.sanitizer }}
build-wasm2c-memchecked:
name: wasm2c-memchecked
runs-on: ubuntu-latest
env:
USE_NINJA: "1"
CC: "clang" # used by the wasm2c tests
WASM2C_CFLAGS: "-march=x86-64-v2 -fsanitize=address -DWASM_RT_USE_MMAP=0"
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v1
with:
submodules: true
- run: sudo apt-get install ninja-build
- run: make clang-debug-asan
- run: make test-clang-debug-asan
build-min-cmake:
name: min-cmake
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: true
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install Ninja
run: sudo apt-get install ninja-build
- name: Detect minimum CMake version
run: >
awk 'match($0, /cmake_minimum_required\(VERSION *([0-9]+\.[0-9]+)\)/, a)
{ print "WABT_CMAKE_VER=" a[1]; exit; }' CMakeLists.txt | tee $GITHUB_ENV
- name: Install minimum CMake
run: |
python -m pip install -U setuptools wheel pip
python -m pip install "cmake==${WABT_CMAKE_VER}.*"
cmake --version
- name: Configure WABT
run: cmake -G Ninja -S . -B out -DCMAKE_BUILD_TYPE=Release
- name: build
run: cmake --build out
- name: unittests
run: cmake --build out --target run-unittests
- name: c-api-tests
run: cmake --build out --target run-c-api-tests
- name: tests
run: cmake --build out --target run-tests
build-arch:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [s390x, i386]
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: ${{matrix.arch}}
- name: Build image
run: docker build --platform linux/${{matrix.arch}} -t wabt -f scripts/Dockerfile .
- name: Unit tests
run: docker run --rm -t wabt cmake --build build --target run-unittests
- name: C API tests
if: ${{ matrix.arch != 's390x' }}
run: docker run --rm -t wabt cmake --build build --target run-c-api-tests
- name: Tests
run: docker run --rm -t wabt cmake --build build --target run-tests