Merge pull request #227 from kkebo/wasmtime-29.0.1 #234
This file contains 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: | |
SWIFT_SDK_URL: https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2025-01-11-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2025-01-11-a-wasm32-unknown-wasi.artifactbundle.zip | |
SWIFT_SDK_CHECKSUM: c9b4f4c16015d196e565105a74bf39432f8ba8139c390052b221a5c12fcaf9be | |
TARGET_TRIPLE: wasm32-unknown-wasi | |
WASMTIME_VESRION: 29.0.1 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: swiftlang/swift:nightly-main-jammy@sha256:8ab66fcdb8adcf08228b94c52317cd6dc1e50b65f87d4cd99eacb641ce27880e | |
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 | |
- run: swift --version | |
- run: swift sdk install $SWIFT_SDK_URL --checksum $SWIFT_SDK_CHECKSUM | |
- name: Build | |
run: | | |
swift build --product swift-format --swift-sdk $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 .build/release/swift-format.wasm -o swift-format.wasm | |
- name: Upload swift-format.wasm | |
uses: actions/upload-artifact@v4 | |
with: | |
name: swift-format.wasm | |
path: swift-format.wasm | |
test-binary: | |
needs: build | |
runs-on: ubuntu-latest | |
container: swiftlang/swift:nightly-main-jammy@sha256:8ab66fcdb8adcf08228b94c52317cd6dc1e50b65f87d4cd99eacb641ce27880e | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: bytecodealliance/actions/wasmtime/setup@v1 | |
with: | |
version: ${{ env.WASMTIME_VERSION }} | |
- run: wasmtime -V | |
- name: Download swift-format.wasm | |
uses: actions/download-artifact@v4 | |
with: | |
name: swift-format.wasm | |
- run: wasmtime --dir . swift-format.wasm --version | |
- run: wasmtime --dir . swift-format.wasm lint -r . | |
test: | |
runs-on: ubuntu-latest | |
container: swiftlang/swift:nightly-main-jammy@sha256:8ab66fcdb8adcf08228b94c52317cd6dc1e50b65f87d4cd99eacb641ce27880e | |
env: | |
STACK_SIZE: 4194304 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: bytecodealliance/actions/wasmtime/setup@v1 | |
with: | |
version: ${{ env.WASMTIME_VERSION }} | |
- run: swift --version | |
- run: wasmtime -V | |
- run: swift sdk install $SWIFT_SDK_URL --checksum $SWIFT_SDK_CHECKSUM | |
- run: swift build -c release --build-tests --swift-sdk $TARGET_TRIPLE -Xlinker -z -Xlinker stack-size=$STACK_SIZE | |
- run: wasmtime --dir / --wasm max-wasm-stack=$STACK_SIZE .build/release/swift-formatPackageTests.wasm |