@@ -2,165 +2,163 @@ name: CI
2
2
on : [push, pull_request]
3
3
4
4
concurrency :
5
- group : ${{ github.workflow }}-${{ github.event.pull_request.number }}
5
+ group : ${{ github.workflow }}-${{ github.ref }}
6
6
cancel-in-progress : true
7
7
8
+ defaults :
9
+ run :
10
+ shell : bash
11
+
8
12
jobs :
9
13
buildlibc :
10
- name : Build libc
14
+ name : ${{ matrix.name }}
11
15
runs-on : ${{ matrix.os }}
16
+ env : ${{ matrix.env || fromJSON('{}') }}
12
17
strategy :
18
+ fail-fast : false
13
19
matrix :
14
- os : [ubuntu-22.04, macos-15, windows-2025]
15
- clang_version : [10.0.0]
16
- # use different LLVM versions among oses because of the lack of
17
- # official assets on github.
18
20
include :
19
- - os : ubuntu-22.04
20
- clang_version : 10.0.0
21
- llvm_asset_suffix : x86_64-linux-gnu-ubuntu-18.04
22
- - os : macos-15
23
- clang_version : 10.0.0
24
- llvm_asset_suffix : x86_64-apple-darwin
25
- - os : windows-2025
26
- clang_version : 10.0.0
27
- - os : ubuntu-22.04
28
- clang_version : 16.0.0
29
- llvm_asset_suffix : x86_64-linux-gnu-ubuntu-18.04
30
- enable_pic : true
31
- - os : macos-15
21
+ # Test a number of operating systems and architectures to make sure
22
+ # wasi-libc builds on these platforms by default.
23
+ - name : Build on Linux x86_64
24
+ os : ubuntu-24.04
25
+ clang_version : 16
26
+ upload : linux-x86_64-clang-16
27
+ - name : Build on Linux aarch64
28
+ os : ubuntu-24.04-arm
29
+ clang_version : 16
30
+ upload : linux-aarch64-clang-16
31
+ - name : Build on macOS aarch64
32
+ os : macos-15
32
33
clang_version : 15.0.7
33
- llvm_asset_suffix : x86_64-apple-darwin21.0
34
- - os : windows-2025
35
- clang_version : 16.0.0
36
- enable_pic : true
37
- - os : ubuntu-24.04-arm
34
+ llvm_asset_suffix : arm64-apple-darwin22.0
35
+ upload : macos-clang-15
36
+ - name : Build on Windows x86_64
37
+ os : windows-2025
38
38
clang_version : 16.0.0
39
- llvm_asset_suffix : aarch64-linux-gnu
40
- enable_pic : true
41
-
39
+ upload : windows-clang-16
40
+
41
+ # Historical versions of LLVM (11.0.0 currently)
42
+ - name : Build with LLVM 11
43
+ os : ubuntu-22.04
44
+ clang_version : 11
45
+ upload : linux-x86_64-clang-11
46
+ env :
47
+ BUILD_LIBSETJMP : no
48
+
49
+ # Test various combinations of targets triples.
50
+ #
51
+ # Configuration here can happen through `env` which is inherited to
52
+ # jobs below. For now this only runs tests on Linux with Clang 16,
53
+ # but that can be expanded as necessary in the future too. Note that
54
+ # some targets run the build for the `libc_so` makefile target to
55
+ # ensure the PIC build works.
56
+ - name : Test wasm32-wasi
57
+ os : ubuntu-24.04
58
+ clang_version : 16
59
+ test : true
60
+ upload : wasm32-wasi
61
+ env :
62
+ TARGET_TRIPLE : wasm32-wasi
63
+ MAKE_TARGETS : " default libc_so"
64
+ - name : Test wasm32-wasip1
65
+ os : ubuntu-24.04
66
+ clang_version : 16
67
+ test : true
68
+ upload : wasm32-wasip1
69
+ env :
70
+ TARGET_TRIPLE : wasm32-wasip1
71
+ MAKE_TARGETS : " default libc_so"
72
+ - name : Test wasm32-wasip2
73
+ os : ubuntu-24.04
74
+ clang_version : 16
75
+ test : true
76
+ upload : wasm32-wasip2
77
+ env :
78
+ TARGET_TRIPLE : wasm32-wasip2
79
+ WASI_SNAPSHOT : p2
80
+ MAKE_TARGETS : " default libc_so"
81
+ - name : Test wasm32-wasi-threads
82
+ os : ubuntu-24.04
83
+ clang_version : 16
84
+ test : true
85
+ upload : wasm32-wasi-threads
86
+ env :
87
+ TARGET_TRIPLE : wasm32-wasi-threads
88
+ THREAD_MODEL : posix
89
+ - name : Test wasm32-wasip1-threads
90
+ os : ubuntu-24.04
91
+ clang_version : 16
92
+ test : true
93
+ upload : wasm32-wasip1-threads
94
+ env :
95
+ TARGET_TRIPLE : wasm32-wasip1-threads
96
+ THREAD_MODEL : posix
97
+ - name : Test wasm32-wasip1 in V8
98
+ os : ubuntu-24.04
99
+ clang_version : 16
100
+ test : true
101
+ test_with_v8 : true
102
+ env :
103
+ TARGET_TRIPLE : wasm32-wasip1
104
+ - name : Test wasm32-wasip1-threads in V8
105
+ os : ubuntu-24.04
106
+ clang_version : 16
107
+ test : true
108
+ test_with_v8 : true
109
+ env :
110
+ TARGET_TRIPLE : wasm32-wasip1-threads
111
+ THREAD_MODEL : posix
112
+
42
113
steps :
43
114
- uses : actions/checkout@v4.1.7
44
115
with :
45
116
submodules : true
46
117
47
- - name : Install libtinfo5
48
- run : |
49
- set -ex
50
- sudo apt-get update
51
- sudo apt-get install -y libtinfo5
52
- if : startsWith(matrix.os, 'ubuntu-22')
53
-
54
- - name : Install LLVM tools (Windows)
55
- shell : bash
56
- run : |
57
- curl -fsSLO https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.clang_version }}/LLVM-${{ matrix.clang_version }}-win64.exe
58
- 7z x LLVM-${{ matrix.clang_version }}-win64.exe -y -o"llvm"
59
- echo "$(pwd)/llvm/bin" >> $GITHUB_PATH
60
- echo "CC=$(pwd)/llvm/bin/clang.exe" >> $GITHUB_ENV
61
- echo "AR=$(pwd)/llvm/bin/llvm-ar.exe" >> $GITHUB_ENV
62
- echo "NM=$(pwd)/llvm/bin/llvm-nm.exe" >> $GITHUB_ENV
63
- if : matrix.os == 'windows-2025'
64
-
65
- - name : Override llvm-nm with one from rustup (Windows)
66
- run : |
67
- rustup update stable
68
- rustup default stable
69
- rustup component add llvm-tools-preview
70
- echo "NM=$(rustc --print sysroot|sed 's|C:|/c|'|sed 's|\\|/|g')/lib/rustlib/x86_64-pc-windows-msvc/bin/llvm-nm.exe" >> $GITHUB_ENV
71
- if : matrix.os == 'windows-2025'
72
-
73
- - name : Install LLVM tools (MacOS)
74
- shell : bash
75
- run : |
76
- curl -sSfL https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.clang_version }}/clang+llvm-${{ matrix.clang_version }}-${{ matrix.llvm_asset_suffix }}.tar.xz | tar xJf -
77
- export CLANG_DIR=`pwd`/clang+llvm-${{ matrix.clang_version }}-${{ matrix.llvm_asset_suffix }}/bin
78
- echo "$CLANG_DIR" >> $GITHUB_PATH
79
- echo "CC=$CLANG_DIR/clang" >> $GITHUB_ENV
80
- echo "AR=$CLANG_DIR/llvm-ar" >> $GITHUB_ENV
81
- echo "NM=$CLANG_DIR/llvm-nm" >> $GITHUB_ENV
82
- if : matrix.os == 'macos-15'
83
-
84
- - name : Install LLVM tools (Linux)
85
- shell : bash
86
- run : |
87
- curl -sSfL https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.clang_version }}/clang+llvm-${{ matrix.clang_version }}-${{ matrix.llvm_asset_suffix }}.tar.xz | tar xJf -
88
- export CLANG_DIR=`pwd`/clang+llvm-${{ matrix.clang_version }}-${{ matrix.llvm_asset_suffix }}/bin
89
- echo "$CLANG_DIR" >> $GITHUB_PATH
90
- echo "CLANG_DIR=$CLANG_DIR" >> $GITHUB_ENV
91
- echo "CC=$CLANG_DIR/clang" >> $GITHUB_ENV
92
- echo "AR=$CLANG_DIR/llvm-ar" >> $GITHUB_ENV
93
- echo "NM=$CLANG_DIR/llvm-nm" >> $GITHUB_ENV
94
- if : startsWith(matrix.os, 'ubuntu-')
95
-
96
- - name : Disable libsetjmp for old LLVM
97
- shell : bash
98
- run : |
99
- echo "BUILD_LIBSETJMP=no" >> $GITHUB_ENV
100
- if : matrix.clang_version == '10.0.0'
101
-
102
- - name : Enable PIC build for new LLVM
103
- shell : bash
104
- run : |
105
- echo "MAKE_TARGETS=default libc_so" >> $GITHUB_ENV
106
- if : matrix.enable_pic
118
+ - uses : ./.github/actions/setup
119
+ with :
120
+ clang_version : ${{ matrix.clang_version }}
121
+ llvm_asset_suffix : ${{ matrix.llvm_asset_suffix }}
107
122
108
123
- name : Build libc
109
- shell : bash
110
- run : |
111
- make -j4 TARGET_TRIPLE=wasm32-wasi $MAKE_TARGETS
112
- make -j4 TARGET_TRIPLE=wasm32-wasip1 $MAKE_TARGETS
113
- make -j4 TARGET_TRIPLE=wasm32-wasip2 WASI_SNAPSHOT=p2 $MAKE_TARGETS
124
+ run : make -j4 $MAKE_TARGETS
125
+
126
+ - name : Download Test dependencies
127
+ if : matrix.test
128
+ run : cd test && make download
114
129
115
- - name : Build libc + threads
116
- # Only build the thread-capable wasi-libc in the latest supported Clang
117
- # version; the earliest version does not have all necessary builtins
118
- # (e.g., `__builtin_wasm_memory_atomic_notify`).
119
- if : matrix.clang_version != '10.0.0'
120
- shell : bash
130
+ - name : Install V8 dependencies
131
+ if : matrix.test_with_v8
121
132
run : |
122
- make -j4 THREAD_MODEL=posix TARGET_TRIPLE=wasm32-wasi-threads
123
- make -j4 THREAD_MODEL=posix TARGET_TRIPLE=wasm32-wasip1-threads
133
+ npm -C test/scripts/browser-test install
134
+ npx -C test/scripts/browser-test playwright install chromium-headless-shell
135
+ echo ENGINE="$PWD/test/scripts/browser-test/harness.mjs" >> $GITHUB_ENV
124
136
125
137
- name : Test
126
- shell : bash
138
+ if : matrix.test
127
139
# For Clang linking to work correctly, we need to place Clang's runtime
128
140
# library for `wasm32-wasi` in the right location (i.e., the `mkdir` and
129
141
# `cp` below).
130
142
run : |
131
143
cd test
132
- make download
133
- export WASI_DIR=$(realpath $($CLANG_DIR/clang -print- resource-dir) /lib/wasi/)
134
- export WASIP1_DIR=$(realpath $($CLANG_DIR/clang -print- resource-dir) /lib/wasip1/)
135
- export WASIP2_DIR=$(realpath $($CLANG_DIR/clang -print- resource-dir) /lib/wasip2/)
144
+ mkdir resource-dir
145
+ export WASI_DIR=./ resource-dir/lib/wasi/
146
+ export WASIP1_DIR=./ resource-dir/lib/wasip1/
147
+ export WASIP2_DIR=./ resource-dir/lib/wasip2/
136
148
mkdir -p $WASI_DIR $WASIP1_DIR $WASIP2_DIR
137
149
cp build/download/libclang_rt.builtins-wasm32.a $WASI_DIR
138
150
cp build/download/libclang_rt.builtins-wasm32.a $WASIP1_DIR
139
151
cp build/download/libclang_rt.builtins-wasm32.a $WASIP2_DIR
140
- TARGET_TRIPLE=wasm32-wasi make test
141
- TARGET_TRIPLE=wasm32-wasip1 make test
142
- TARGET_TRIPLE=wasm32-wasip2 make test
143
- TARGET_TRIPLE=wasm32-wasi-threads make test
144
- TARGET_TRIPLE=wasm32-wasip1-threads make test
145
-
146
- npm -C scripts/browser-test install
147
- npx -C scripts/browser-test playwright install chromium-headless-shell
148
- ENGINE="$PWD/scripts/browser-test/harness.mjs" TARGET_TRIPLE=wasm32-wasip1 make test
149
- ENGINE="$PWD/scripts/browser-test/harness.mjs" TARGET_TRIPLE=wasm32-wasip1-threads make test
150
- # The older version of Clang does not provide the expected symbol for the
151
- # test entrypoints: `undefined symbol: __main_argc_argv`.
152
- # The older (<15.0.7) version of wasm-ld does not provide `__heap_end`,
153
- # which is required by our malloc implementation.
154
- if : startsWith(matrix.os, 'ubuntu-') && matrix.clang_version != '10.0.0'
152
+ export LDFLAGS="-resource-dir $(pwd)/resource-dir"
153
+ make test
155
154
156
155
- uses : actions/upload-artifact@v4.4.0
156
+ if : matrix.upload
157
157
with :
158
- # Upload the sysroot folder. To avoid action erros, we give it a unique
159
- # name using the OS it was built for and the Clang version it was built
160
- # with.
161
- name : ${{ format( 'sysroot-{0}-clang-{1}.tgz', matrix.os, matrix.clang_version) }}
158
+ name : ${{ format( 'sysroot-{0}.tgz', matrix.upload) }}
162
159
path : sysroot
163
160
161
+
164
162
# Disable the headerstest job for now, while WASI transitions from the
165
163
# witx snapshots to wit proposals, and we have a few manual edits to the
166
164
# generated header to make life easier for folks.
@@ -176,7 +174,6 @@ jobs:
176
174
with :
177
175
submodules : true
178
176
- name : Install Rust (rustup)
179
- shell : bash
180
177
run : rustup update stable --no-self-update && rustup default stable
181
178
if : matrix.os != 'macos-15'
182
179
- name : Install Rust (macos)
0 commit comments