-
Notifications
You must be signed in to change notification settings - Fork 27
344 lines (317 loc) · 17.4 KB
/
main.yml
File metadata and controls
344 lines (317 loc) · 17.4 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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
name: Build and test
on:
pull_request:
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
check-autogen-diff:
runs-on: ubuntu-latest
container:
image: swift:6.2-noble
steps:
- uses: actions/checkout@v6
- name: Re-generate auto-generated code checks
run: |
swift run -q --package-path Utilities WasmKitDevUtils
- name: Check for changes
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git diff --exit-code || {
echo "::error::The auto-generated code utilities changed some files. Please see \`Utilities/README.md\`, re-run the tools, and commit the changes."
exit 1
}
build-macos-snapshots:
runs-on: macos-26
strategy:
matrix:
include:
- toolchain: "6.3"
test-args: ""
# - toolchain: main-snapshot
# test-args: "-Xswiftc -DWASMKIT_CI_TOOLCHAIN_MAIN_NIGHTLY"
steps:
- uses: actions/checkout@v6
- id: setup-development
run: |
brew install wabt jemalloc
curl -O https://download.swift.org/swiftly/darwin/swiftly.pkg && \
installer -pkg swiftly.pkg -target CurrentUserHomeDirectory
- name: Build with selected toolchain
run: |
~/.swiftly/bin/swiftly init --quiet-shell-followup --skip-install && \
. "${SWIFTLY_HOME_DIR:-$HOME/.swiftly}/env.sh" && \
hash -r
swiftly install ${{ matrix.toolchain }}
swiftly use ${{ matrix.toolchain }}
./Vendor/checkout-dependency --category benchmark --category component-model
swift --version
swift test --sanitize address --traits ComponentModel,WasmDebuggingSupport ${{ matrix.test-args }}
cd Benchmarks && swift package benchmark
build-macos:
strategy:
matrix:
include:
# Swift 6.1
- os: macos-15
xcode: Xcode_16.4
development-toolchain-tag: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
test-args: "--sanitize address --traits ComponentModel,WasmDebuggingSupport"
# Swift 6.2
- os: macos-15
xcode: Xcode_26.1
development-toolchain-tag: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
test-args: "--sanitize address --traits ComponentModel,WasmDebuggingSupport"
# Swift 6.2.4
- os: macos-26
xcode: Xcode_26.3
development-toolchain-tag: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
test-args: "--sanitize address --traits ComponentModel,WasmDebuggingSupport"
runs-on: ${{ matrix.os }}
name: "build-macos (${{ matrix.xcode }})"
steps:
- uses: actions/checkout@v6
- id: setup-development
run: |
toolchain_path="/Library/Developer/Toolchains/${{ matrix.development-toolchain-tag }}.xctoolchain"
pkg="$(mktemp -d)/InstallMe.pkg"
development_toolchain_download="https://download.swift.org/development/xcode/${{ matrix.development-toolchain-tag }}/${{ matrix.development-toolchain-tag }}-osx.pkg"
curl -L "$development_toolchain_download" -o $pkg
sudo installer -pkg $pkg -target /
echo "toolchain-path=$toolchain_path" >> $GITHUB_OUTPUT
"$toolchain_path/usr/bin/swift" sdk install "${{ matrix.wasi-swift-sdk-download }}" --checksum "${{ matrix.wasi-swift-sdk-checksum }}"
wasi_sdk_path=$("$toolchain_path/usr/bin/swift" sdk configure --show-configuration "${{ matrix.wasi-swift-sdk-id }}" wasm32-unknown-wasi | grep sdkRootPath: | cut -d: -f2)
echo "wasi-swift-sdk-path=$(dirname $wasi_sdk_path)" >> $GITHUB_OUTPUT
- name: Select Xcode version
run: sudo xcode-select -switch /Applications/${{ matrix.xcode }}.app
- name: Configure Tests/default.json
run: |
cat <<EOS > Tests/default.json
{
"swiftExecutablePath": "${{ steps.setup-development.outputs.toolchain-path }}/usr/bin/swift",
"wasiSwiftSDKPath": "${{ steps.setup-development.outputs.wasi-swift-sdk-path }}",
"hostSwiftExecutablePath": "$(xcrun --find swift)",
"hostSdkRootPath": "$(xcrun --show-sdk-path --sdk macosx)"
}
EOS
- run: ./Vendor/checkout-dependency --category default --category component-model
- run: swift test ${{ matrix.test-args }}
build-xcode:
runs-on: macos-26
steps:
- uses: actions/checkout@v6
- name: Prepare Xcode platforms
run: |
set -euxo pipefail
sudo xcode-select -s /Applications/Xcode_26.3.app
sudo xcodebuild -runFirstLaunch || true
for PLAT in iOS tvOS watchOS visionOS; do
if ! xcodebuild -showsdks | grep -q "$PLAT"; then
echo "Downloading $PLAT platform..."
sudo xcodebuild -downloadPlatform "$PLAT"
fi
done
xcodebuild -showsdks
xcodebuild -scheme WasmKit-Package -showdestinations || true
- run: xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme WasmKit-Package -destination generic/platform=macOS
- run: xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme WasmKit-Package -destination generic/platform=iOS
- run: xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme WasmKit-Package -destination generic/platform=watchOS
- run: xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme WasmKit-Package -destination generic/platform=tvOS
- run: xcrun xcodebuild -skipMacroValidation -skipPackagePluginValidation build -scheme WasmKit-Package -destination generic/platform=visionOS
build-linux:
strategy:
matrix:
include:
- swift: "swift:6.1-noble"
development-toolchain-download: "https://download.swift.org/development/ubuntu2404/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a-ubuntu24.04.tar.gz"
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
test-args: "--traits ComponentModel,WasmDebuggingSupport"
build-benchmarks: true
- swift: "swift:6.2-amazonlinux2"
development-toolchain-download: "https://download.swift.org/development/amazonlinux2/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a-amazonlinux2.tar.gz"
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
test-args: "--traits ComponentModel,WasmDebuggingSupport"
- swift: "swift:6.2-noble"
development-toolchain-download: "https://download.swift.org/development/ubuntu2404/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a-ubuntu24.04.tar.gz"
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
test-args: "--traits ComponentModel,WasmDebuggingSupport --enable-code-coverage"
build-benchmarks: true
build-dev-dashboard: true
- swift: "swiftlang/swift:nightly-6.3-noble"
development-toolchain-download: "https://download.swift.org/development/ubuntu2404/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a-ubuntu24.04.tar.gz"
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
test-args: "--traits ComponentModel,WasmDebuggingSupport -Xswiftc -DWASMKIT_CI_TOOLCHAIN_NIGHTLY"
build-benchmarks: true
# - swift: "swiftlang/swift:nightly-main-noble"
# development-toolchain-download: "https://download.swift.org/development/ubuntu2404/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a-ubuntu24.04.tar.gz"
# wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
# wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
# wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
# test-args: "--traits ComponentModel,WasmDebuggingSupport -Xswiftc -DWASMKIT_CI_TOOLCHAIN_NIGHTLY -Xswiftc -DWASMKIT_CI_TOOLCHAIN_MAIN_NIGHTLY"
# build-benchmarks: true
runs-on: ubuntu-24.04
name: "build-linux (${{ matrix.swift }}${{ matrix.label }})"
steps:
- uses: actions/checkout@v6
- name: Configure container
run: |
docker run -dit --name build-container -v $PWD:/workspace -w /workspace ${{ matrix.swift }}
echo 'docker exec -i build-container "$@"' > ./build-exec
chmod +x ./build-exec
- name: Install Development toolchain
id: setup-development
run: |
toolchain_path="/opt/swiftwasm"
./build-exec mkdir -p "$toolchain_path"
curl -L ${{ matrix.development-toolchain-download }} | ./build-exec tar xz --strip-component 1 -C "$toolchain_path"
echo "toolchain-path=$toolchain_path" >> $GITHUB_OUTPUT
./build-exec "$toolchain_path/usr/bin/swift" sdk install "${{ matrix.wasi-swift-sdk-download }}" --checksum "${{ matrix.wasi-swift-sdk-checksum }}"
wasi_sdk_path=$(./build-exec "$toolchain_path/usr/bin/swift" sdk configure --show-configuration "${{ matrix.wasi-swift-sdk-id }}" wasm32-unknown-wasi | grep sdkRootPath: | cut -d: -f2)
echo "wasi-swift-sdk-path=$(dirname $wasi_sdk_path)" >> $GITHUB_OUTPUT
- name: Configure Tests/default.json
run: |
cat <<EOS > Tests/default.json
{
"swiftExecutablePath": "${{ steps.setup-development.outputs.toolchain-path }}/usr/bin/swift",
"wasiSwiftSDKPath": "${{ steps.setup-development.outputs.wasi-swift-sdk-path }}",
"hostSwiftExecutablePath": "/usr/bin/swift"
}
EOS
- run: ./build-exec ./CI/install-wabt.sh
- run: ./Vendor/checkout-dependency --category benchmark --category component-model
- run: ./build-exec swift test ${{ matrix.test-args }}
- if: matrix.build-benchmarks
run: |
./build-exec apt-get update
./build-exec apt-get install -y libjemalloc-dev
./build-exec swift package --package-path Benchmarks benchmark
- if: matrix.build-dev-dashboard
run: ./build-exec ./CI/build-dev-dashboard.sh
- if: matrix.build-dev-dashboard
name: Relax artifact permissions
run: sudo chown -R $USER .build/html
- if: matrix.build-dev-dashboard
id: deployment
uses: actions/upload-pages-artifact@v5
with:
path: .build/html
deploy-dev-dashboard:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs: build-linux
permissions:
id-token: write
pages: write
steps:
- id: deployment
uses: actions/deploy-pages@v5
build-musl:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- swift: 6.2-noble
musl-swift-sdk-download: "https://download.swift.org/swift-6.2.3-release/static-sdk/swift-6.2.3-RELEASE/swift-6.2.3-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz"
musl-swift-sdk-checksum: "f30ec724d824ef43b5546e02ca06a8682dafab4b26a99fbb0e858c347e507a2c"
steps:
- uses: actions/checkout@v6
- name: Configure container
run: |
docker run -dit --name build-container -v $PWD:/workspace -w /workspace swift:${{ matrix.swift }}
echo 'docker exec -i build-container "$@"' > ./build-exec
chmod +x ./build-exec
- name: Install Static Linux SDK
run: ./build-exec swift sdk install "${{ matrix.musl-swift-sdk-download }}" --checksum "${{ matrix.musl-swift-sdk-checksum }}"
- name: Build (x86_64-swift-linux-musl)
run: ./build-exec swift build --swift-sdk x86_64-swift-linux-musl --traits ComponentModel,WasmDebuggingSupport --explicit-target-dependency-import-check error
- name: Build (aarch64-swift-linux-musl)
run: ./build-exec swift build --swift-sdk aarch64-swift-linux-musl --traits ComponentModel,WasmDebuggingSupport --explicit-target-dependency-import-check error
build-android:
runs-on: ubuntu-24.04
timeout-minutes: 10
strategy:
matrix:
include:
- swift-version: "6.2"
- swift-version: "6.3"
# Regressed since `swift-DEVELOPMENT-SNAPSHOT-2026-04-01-a`
# - swift-version: nightly-main
steps:
- uses: actions/checkout@v6
- name: Free up disk space
run: ./CI/gha-free-disk-space.sh
- name: Run Tests on Android emulator
uses: skiptools/swift-android-action@v2
with:
android-api-level: 30
swift-version: "${{ matrix.swift-version }}"
build-windows:
runs-on: windows-latest
steps:
- uses: compnerd/gha-setup-swift@main
with:
swift-version: swift-6.2-release
swift-build: 6.2-RELEASE
- uses: actions/checkout@v6
- run: python3 ./Vendor/checkout-dependency --category default
# FIXME: CMake build is failing on CI due to "link: extra operand '/OUT:lib\\libXXXX.a'" error
# # Check Windows build with CMake
# - uses: Cyberboss/install-winget@v1
# - run: winget install Ninja-build.Ninja Kitware.CMake --disable-interactivity --accept-source-agreements
# - run: |
# echo "$env:LOCALAPPDATA\Microsoft\WinGet\Links" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# echo "$env:ProgramFiles\CMake\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# - run: cmake -G Ninja -B .build/cmake
# - run: cmake --build .build/cmake
# Run tests with SwiftPM
- name: Run tests with SwiftPM
run: swift test
build-cmake:
runs-on: ubuntu-24.04
container:
image: swift:6.2-noble
steps:
- uses: actions/checkout@v6
- name: Install Ninja
run: apt-get update && apt-get install -y ninja-build
- name: Install CMake
run: |
apt-get install -y curl
curl -L https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-linux-x86_64.tar.gz | tar xz --strip-component 1 -C /usr/local/
- run: cmake -G Ninja -B ./build
- run: cmake --build ./build
- run: ./build/bin/wasmkit --version
build-wasi:
runs-on: ubuntu-24.04
container:
image: swift:6.2-noble
steps:
- uses: actions/checkout@v6
- name: Install jq
run: apt-get update && apt-get install -y jq
- name: Install Swift SDK
run: swift sdk install https://download.swift.org/swift-6.2.4-release/wasm-sdk/swift-6.2.4-RELEASE/swift-6.2.4-RELEASE_wasm.artifactbundle.tar.gz --checksum 32fdb8772d73bb174f77b5c59bc88a0d55003d75712832129394d3465158fb43
- name: Build with the Swift SDK
run: swift build --swift-sdk "$(swiftc -print-target-info | jq -r '.swiftCompilerTag')_wasm" --traits ComponentModel --explicit-target-dependency-import-check error --product wasmkit-cli