forked from WebAssembly/wasi-libc
-
Notifications
You must be signed in to change notification settings - Fork 0
267 lines (239 loc) · 8.31 KB
/
main.yml
File metadata and controls
267 lines (239 loc) · 8.31 KB
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
name: CI
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
buildlibc:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Test a number of operating systems and architectures to make sure
# wasi-libc builds on these platforms by default.
- name: Build on Linux x86_64
os: ubuntu-24.04
clang_version: 19
upload: linux-x86_64-clang-19
- name: Build on Linux aarch64
os: ubuntu-24.04-arm
clang_version: 19
upload: linux-aarch64-clang-19
- name: Build on macOS aarch64
os: macos-15
clang_version: 15.0.7
llvm_asset_suffix: arm64-apple-darwin22.0
upload: macos-clang-15
args: -DBUILD_SHARED=OFF -DCMAKE_C_COMPILER_WORKS=ON
- name: Build on Windows x86_64
os: windows-2025
clang_version: 20.1.8
upload: windows-clang-20
args: -DBUILD_SHARED=OFF
# Other versions of LLVM
- name: Build with LLVM 11
os: ubuntu-22.04
clang_version: 11
upload: linux-x86_64-clang-11
args: -DSETJMP=OFF -DBUILD_SHARED=OFF
- name: Build with LLVM 18
os: ubuntu-24.04
clang_version: 18
upload: linux-x86_64-clang-18
# Test various combinations of target triples.
#
# Configuration here can happen through `args` which are all passed
# to CMake. For now this only runs tests on Linux with Clang 16,
# but that can be expanded as necessary in the future too.
- name: Test wasm32-wasi
os: ubuntu-24.04
clang_version: 19
test: true
upload: wasm32-wasi
args: -DTARGET_TRIPLE=wasm32-wasi
- name: Test wasm32-wasip1
os: ubuntu-24.04
clang_version: 19
test: true
upload: wasm32-wasip1
args: -DTARGET_TRIPLE=wasm32-wasip1
- name: Test wasm32-wasip2
os: ubuntu-24.04
clang_version: 19
test: true
upload: wasm32-wasip2
args: -DTARGET_TRIPLE=wasm32-wasip2
- name: Test wasm32-wasip1-threads
os: ubuntu-24.04
clang_version: 19
test: true
upload: wasm32-wasip1-threads
args: -DTARGET_TRIPLE=wasm32-wasip1-threads
- name: Test wasm32-wasip1 in V8
os: ubuntu-24.04
clang_version: 19
test: true
test_with_v8: true
args: -DTARGET_TRIPLE=wasm32-wasip1
- name: Test wasm32-wasip1-threads in V8
os: ubuntu-24.04
clang_version: 19
test: true
test_with_v8: true
args: -DTARGET_TRIPLE=wasm32-wasip1-threads
- name: Test wasm32-wasi-simd
os: ubuntu-24.04
clang_version: 19
test: true
upload: wasm32-wasi-simd
args: -DSIMD=ON -DCHECK_SYMBOLS=OFF
- name: Test wasm32-wasip1 (debug)
os: ubuntu-24.04
clang_version: 19
test: true
args: -DCMAKE_BUILD_TYPE=Debug
- name: Test wasm32-wasip2 (debug)
os: ubuntu-24.04
clang_version: 19
test: true
args: -DCMAKE_BUILD_TYPE=Debug -DTARGET_TRIPLE=wasm32-wasip2
- name: Test wasm32-wasip1-threads (debug)
os: ubuntu-24.04
clang_version: 19
test: true
args: -DCMAKE_BUILD_TYPE=Debug -DTARGET_TRIPLE=wasm32-wasip1-threads
- name: Test emmalloc
os: ubuntu-24.04
clang_version: 19
test: true
args: -DMALLOC=emmalloc
steps:
- uses: actions/checkout@v4.1.7
with:
submodules: true
- uses: ./.github/actions/setup
with:
clang_version: ${{ matrix.clang_version }}
llvm_asset_suffix: ${{ matrix.llvm_asset_suffix }}
- name: Install V8 dependencies
if: matrix.test_with_v8
run: |
npm -C test/scripts/browser-test install
npx -C test/scripts/browser-test playwright install chromium-headless-shell
echo ENGINE="$PWD/test/scripts/browser-test/harness.mjs" >> $GITHUB_ENV
echo CTEST_ARGS="--label-exclude v8fail" >> $GITHUB_ENV
- name: Configure libc
run: |
cmake -G Ninja -S . -B build \
-DCHECK_SYMBOLS=ON \
${{ matrix.args }} \
-DCMAKE_LINK_DEPENDS_USE_LINKER=OFF
- name: Configure testing
if: matrix.test
run: cmake -S . -B build -DBUILD_TESTS=ON -DENGINE=${{ env.ENGINE }}
- name: Build
run: ninja -C build -v
- name: Test
if: matrix.test
run: ctest --test-dir build/test --output-on-failure -j4 $CTEST_ARGS
- uses: actions/upload-artifact@v4.4.0
if: matrix.upload
with:
name: ${{ format( 'sysroot-{0}.tgz', matrix.upload) }}
path: build/sysroot
# Disable the headerstest job for now, while WASI transitions from the
# witx snapshots to wit proposals, and we have a few manual edits to the
# generated header to make life easier for folks.
headerstest:
if: ${{ false }} # Disable the headers test for now.
name: wasi-headers test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-15, windows-2025]
steps:
- uses: actions/checkout@v4.1.7
with:
submodules: true
- name: Install Rust (rustup)
run: rustup update stable --no-self-update && rustup default stable
if: matrix.os != 'macos-15'
- name: Install Rust (macos)
run: |
curl https://sh.rustup.rs | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
if: matrix.os == 'macos-15'
- run: cargo fetch
working-directory: tools/wasi-headers
- run: cargo build
working-directory: tools/wasi-headers
- run: cargo test
working-directory: tools/wasi-headers
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.7
with:
submodules: true
- name: Install Rust
run: rustup update stable && rustup default stable && rustup component add rustfmt
- run: cargo fmt -- --check
working-directory: tools/wasi-headers
bindings:
name: Ensure wit-bingen bindings are up-to-date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.7
with:
submodules: true
- run: CC=clang cmake -S . -B build -G Ninja
- run: ninja -C build bindings
- run: git diff --exit-code
# Currently wasi-libc's test suite is pretty bare-bones. To try to increase
# test coverage build Python in CI as well with a fresh copy of wasi-libc.
# This involves a bit of configuration to get all the stars to align, but in
# the end this runs at least some Python tests against a from-source-built
# copy of wasi-libc.
python:
name: Test Python ${{ matrix.name }}
runs-on: ubuntu-24.04-arm
strategy:
fail-fast: false
matrix:
include:
- name: wasm32-wasip1
args: -DTARGET_TRIPLE=wasm32-wasip1
- name: emmalloc
args: -DTARGET_TRIPLE=wasm32-wasip1 -DMALLOC=emmalloc
- name: wasm32-wasip2
args: -DTARGET_TRIPLE=wasm32-wasip2
steps:
- uses: actions/checkout@v4.1.7
with:
submodules: true
- run: |
curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-arm64-linux.tar.gz -L | tar xzvf -
echo "WASI_SDK_PATH=`pwd`/wasi-sdk-25.0-arm64-linux" >> $GITHUB_ENV
if: runner.os == 'Linux'
shell: bash
working-directory: ${{ runner.tool_cache }}
- name: Setup `wasmtime`
uses: bytecodealliance/actions/wasmtime/setup@v1
with:
version: "38.0.3"
- name: Setup wasi-libc
run: |
cmake -S . -B build -G Ninja \
${{ matrix.args }} \
-DCMAKE_LINK_DEPENDS_USE_LINKER=OFF \
-DPYTHON_TESTS=ON \
-DBUILD_TESTS=ON \
-DCMAKE_C_COMPILER=$WASI_SDK_PATH/bin/clang
- name: Build and test python
run: ninja -C build -v python