WIP #67
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: wasm | |
| on: | |
| push: | |
| env: | |
| # Required Swift toolchain version for WASM builds | |
| # Must match REQUIRED_TOOLCHAIN_VERSION in scripts/build-and-test-wasm.sh | |
| SWIFT_TOOLCHAIN_VERSION: "DEVELOPMENT-SNAPSHOT-2025-11-03-a" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Install the specific Swift development snapshot required for WASM builds | |
| # Toolchain comes from SwiftWasm releases (includes WASM support) | |
| - name: Install Swift Toolchain | |
| run: | | |
| SWIFT_URL="https://github.com/swiftwasm/swift/releases/download/swift-wasm-${SWIFT_TOOLCHAIN_VERSION}/swift-wasm-${SWIFT_TOOLCHAIN_VERSION}-ubuntu24.04_x86_64.tar.gz" | |
| echo "Downloading Swift toolchain from: $SWIFT_URL" | |
| mkdir -p /opt/swift | |
| curl -sL "$SWIFT_URL" | tar xz --strip-components=1 -C /opt/swift | |
| echo "/opt/swift/usr/bin" >> $GITHUB_PATH | |
| - name: Verify Swift Installation | |
| run: swift --version | |
| # Install the matching WASM SDK | |
| - name: Install WASM SDK | |
| run: | | |
| SDK_URL="https://github.com/swiftwasm/swift/releases/download/swift-wasm-${SWIFT_TOOLCHAIN_VERSION}/swift-wasm-${SWIFT_TOOLCHAIN_VERSION}-wasm32-unknown-wasip1-threads.artifactbundle.zip" | |
| echo "Installing WASM SDK from: $SDK_URL" | |
| swift sdk install "$SDK_URL" || true | |
| echo "Installed SDKs:" | |
| swift sdk list | |
| # Set environment variable to signal the correct toolchain is installed | |
| - name: Set Toolchain Environment | |
| run: echo "SWIFT_WASM_TOOLCHAIN_VERIFIED=1" >> $GITHUB_ENV | |
| # Wasmtime is required because `swift test` doesn't work for WebAssembly targets. | |
| # For WASM, we must build tests separately and run them with a WASM runtime. | |
| # See: https://book.swiftwasm.org/getting-started/testing.html | |
| - name: Install Wasmtime | |
| uses: bytecodealliance/actions/wasmtime/setup@v1 | |
| with: | |
| version: "40.0.2" | |
| github_token: ${{ github.token }} | |
| - name: Build and Test | |
| run: ./scripts/build-and-test-wasm.sh |