Merge pull request #43 from kkebo/swift-wasm-DEVELOPMENT-SNAPSHOT-202… #44
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: Swift | |
on: | |
push: | |
branches: ["wasm32-wasi"] | |
pull_request: | |
branches: ["wasm32-wasi"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: swiftlang/swift:nightly-main-jammy@sha256:2aa8810eb1c5e5f61582e7342b5f92c1f75fcbc1c23da2f08be8d307feb04165 | |
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 https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-05-25-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-05-25-a-wasm32-unknown-wasi.artifactbundle.zip | |
- name: Build | |
run: | | |
swift build --product swift-format --swift-sdk wasm32-unknown-wasi -c release -Xlinker -z -Xlinker stack-size=$STACK_SIZE | |
wasm-strip .build/release/swift-format.wasm | |
wasm-opt -Oz -all .build/release/swift-format.wasm -o swift-format.wasm | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: swift-format.wasm | |
path: swift-format.wasm | |
test: | |
runs-on: ubuntu-latest | |
container: swiftlang/swift:nightly-main-jammy@sha256:2aa8810eb1c5e5f61582e7342b5f92c1f75fcbc1c23da2f08be8d307feb04165 | |
env: | |
STACK_SIZE: 4194304 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: bytecodealliance/actions/wasmtime/setup@v1 | |
- run: swift --version | |
- run: wasmtime -V | |
- run: swift sdk install https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-05-25-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-05-25-a-wasm32-unknown-wasi.artifactbundle.zip | |
- run: swift build -c release --build-tests --swift-sdk wasm32-unknown-wasi -Xlinker -z -Xlinker stack-size=$STACK_SIZE | |
- run: wasmtime --dir / --wasm max-wasm-stack=$STACK_SIZE .build/release/swift-formatPackageTests.wasm |