Merge pull request #355 from kkebo/wasmtime-32.0.0 #442
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SwiftWasm | |
on: | |
push: | |
branches: ["wasm32-wasi"] | |
pull_request: | |
branches: ["wasm32-wasi"] | |
env: | |
WASMTIME_VESRION: 32.0.0 | |
jobs: | |
build: | |
strategy: | |
matrix: | |
target: | |
- triple: wasm32-unknown-wasi | |
sdk: | |
url: https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2025-04-03-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2025-04-03-a-wasm32-unknown-wasi.artifactbundle.zip | |
checksum: 44c06fb80f9ec9f489982a118c5c8977fa73909479ae3725cf09c09a9506b326 | |
artifact-name: swift-format.wasm | |
other-wasmopt-flags: | |
- triple: wasm32-unknown-wasip1-threads | |
sdk: | |
url: https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2025-04-03-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2025-04-03-a-wasm32-unknown-wasip1-threads.artifactbundle.zip | |
checksum: 1bc46ee00a9e0c23feaba085533b83903a5fe3991596689928efd9df1de757ea | |
artifact-name: swift-format-threads.wasm | |
other-wasmopt-flags: --enable-threads | |
runs-on: ubuntu-24.04-arm | |
container: swiftlang/swift:nightly-main-noble@sha256:2d76e55473e8f2295137027de5aa0e0f8032bd60484f033d3e958cf588b00d4c | |
env: | |
STACK_SIZE: 524288 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install tools | |
run: apt-get update && apt-get install --no-install-recommends -y wabt binaryen unzip | |
- run: swift --version | |
- run: swift sdk install ${{ matrix.target.sdk.url }} --checksum ${{ matrix.target.sdk.checksum }} | |
- name: Build | |
run: | | |
swift build --product swift-format --swift-sdk ${{ matrix.target.triple }} -c release -Xlinker -z -Xlinker stack-size=$STACK_SIZE | |
wasm-strip .build/release/swift-format.wasm | |
wasm-opt -Oz --enable-bulk-memory --enable-sign-ext ${{ matrix.target.other-wasmopt-flags }} .build/release/swift-format.wasm -o ${{ matrix.target.artifact-name }} | |
- name: Upload ${{ matrix.target.artifact-name }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target.artifact-name }} | |
path: ${{ matrix.target.artifact-name }} | |
test-binary: | |
needs: build | |
strategy: | |
matrix: | |
target: | |
- artifact-name: swift-format.wasm | |
other-wasmtime-flags: | |
- artifact-name: swift-format-threads.wasm | |
other-wasmtime-flags: --wasi threads | |
runs-on: ubuntu-24.04-arm | |
container: swiftlang/swift:nightly-main-noble@sha256:2d76e55473e8f2295137027de5aa0e0f8032bd60484f033d3e958cf588b00d4c | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install tools | |
run: apt-get update && apt-get install --no-install-recommends -y xz-utils | |
- uses: bytecodealliance/actions/wasmtime/setup@v1 | |
with: | |
version: ${{ env.WASMTIME_VERSION }} | |
- run: wasmtime -V | |
- name: Download ${{ matrix.target.artifact-name }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ matrix.target.artifact-name }} | |
- run: wasmtime --dir . ${{ matrix.target.other-wasmtime-flags }} ${{ matrix.target.artifact-name }} --version | |
- run: wasmtime --dir . ${{ matrix.target.other-wasmtime-flags }} ${{ matrix.target.artifact-name }} lint -r . | |
test: | |
strategy: | |
matrix: | |
target: | |
- triple: wasm32-unknown-wasi | |
sdk: | |
url: https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2025-04-03-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2025-04-03-a-wasm32-unknown-wasi.artifactbundle.zip | |
checksum: 44c06fb80f9ec9f489982a118c5c8977fa73909479ae3725cf09c09a9506b326 | |
other-wasmtime-flags: | |
- triple: wasm32-unknown-wasip1-threads | |
sdk: | |
url: https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2025-04-03-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2025-04-03-a-wasm32-unknown-wasip1-threads.artifactbundle.zip | |
checksum: 1bc46ee00a9e0c23feaba085533b83903a5fe3991596689928efd9df1de757ea | |
other-wasmtime-flags: --wasi threads | |
runs-on: ubuntu-24.04-arm | |
container: swiftlang/swift:nightly-main-noble@sha256:2d76e55473e8f2295137027de5aa0e0f8032bd60484f033d3e958cf588b00d4c | |
env: | |
STACK_SIZE: 4194304 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install tools | |
run: apt-get update && apt-get install --no-install-recommends -y xz-utils unzip | |
- uses: bytecodealliance/actions/wasmtime/setup@v1 | |
with: | |
version: ${{ env.WASMTIME_VERSION }} | |
- run: swift --version | |
- run: wasmtime -V | |
- run: swift sdk install ${{ matrix.target.sdk.url }} --checksum ${{ matrix.target.sdk.checksum }} | |
- run: swift build -c release --build-tests --swift-sdk ${{ matrix.target.triple }} -Xlinker -z -Xlinker stack-size=$STACK_SIZE | |
- run: wasmtime --dir / --wasm max-wasm-stack=$STACK_SIZE ${{ matrix.target.other-wasmtime-flags }} .build/release/swift-formatPackageTests.xctest |