Skip to content

ci: Add WebAssembly build step to CI workflow#232

Open
cbaker6 wants to merge 20 commits intomainfrom
cbaker6-patch-3
Open

ci: Add WebAssembly build step to CI workflow#232
cbaker6 wants to merge 20 commits intomainfrom
cbaker6-patch-3

Conversation

@cbaker6
Copy link
Member

@cbaker6 cbaker6 commented Jan 22, 2026

New Pull Request Checklist

Issue Description

We are currently not testing the build for WASM.

Closes: FILL_THIS_OUT

Approach

Enable the CI to see if ParseSwift builds for WASM.

There’s an issue as WASM currently doesn’t support the FoundationNetworking framework along with multi-threading, more here: https://book.swiftwasm.org/getting-started/porting.html

TODOs before merging

  • Add tests
  • Add entry to changelog
  • Add changes to documentation (guides, repository pages, in-code descriptions)

Copilot AI review requested due to automatic review settings January 22, 2026 05:56
@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Warning

Rate limit exceeded

@cbaker6 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 19 minutes and 50 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

A new wasm CI job was added to .github/workflows/ci.yml that runs on ubuntu-latest, installs SwiftWASM via swiftwasm/setup-swiftwasm@v2, targets wasm32-unknown-wasip1-threads, and runs swift build with the wasm SDK; job timeout is 10 minutes. Plus Ultra!

Changes

Cohort / File(s) Summary
CI Workflow: WebAssembly job
/.github/workflows/ci.yml
Added top-level wasm job on ubuntu-latest. Steps: actions/checkout@v4, swiftwasm/setup-swiftwasm@v2 (install SwiftWASM toolchain), and swift build targeting wasm32-unknown-wasip1-threads. Job timeout set to 10 minutes. No other jobs or workflow flow changed.

Sequence Diagram(s)

mermaid
sequenceDiagram
autonumber
participant GH as "GitHub Actions\nController"
participant RUN as "Runner\n(ubuntu-latest)"
participant CH as "Action\nactions/checkout@v4"
participant SWA as "Action\nswiftwasm/setup-swiftwasm@v2"
participant SDK as "SwiftWASM\nToolchain (wasm SDK)"
participant BL as "Build\nswift build --target wasm32-unknown-wasip1-threads"
GH->>RUN: trigger wasm job
RUN->>CH: run checkout
RUN->>SWA: run setup-swiftwasm
SWA->>SDK: install/configure wasm toolchain
RUN->>BL: execute swift build with wasm SDK
BL-->>RUN: produce wasm artifacts
RUN-->>GH: report job result

style GH fill:rgba(54,120,255,0.5)
style RUN fill:rgba(0,180,120,0.5)
style CH fill:rgba(255,180,0,0.5)
style SWA fill:rgba(255,140,0,0.5)
style SDK fill:rgba(180,0,200,0.5)
style BL fill:rgba(200,50,50,0.5)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A job takes flight on ubuntu's wing — Plus Ultra! 🚀
Checkout hums, the toolchain sings — Plus Ultra!
Build the wasm, the artifacts ring — Plus Ultra!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a WebAssembly build step to the CI workflow, which aligns perfectly with the changeset.
Description check ✅ Passed The description follows the template structure with Issue Description and Approach sections completed, though the 'Closes' field contains a placeholder and TODOs are incomplete.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cbaker6-patch-3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds WebAssembly build support to the CI workflow by introducing a new wasm job that builds the project using SwiftWasm.

Changes:

  • Added a new wasm job to the CI workflow that uses Swift 6.2.3 container and builds for the wasm32-unknown-wasi target

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.57%. Comparing base (d9e4453) to head (1cdee1c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #232   +/-   ##
=======================================
  Coverage   90.57%   90.57%           
=======================================
  Files         180      180           
  Lines       13620    13565   -55     
=======================================
- Hits        12336    12287   -49     
+ Misses       1284     1278    -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/ci.yml:
- Around line 178-184: The wasm job is missing the repository checkout step so
swift build has no source; add an actions/checkout@v6 step at the start of the
wasm job's steps list (before the swiftwasm/setup-swiftwasm@v2 and before the
run: swift build --swift-sdk wasm32-unknown-wasi) to ensure the source is
available for the build.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.github/workflows/ci.yml:
- Line 187: The CI step currently invoking the command "swift build" will
compile against the container's default SDK; update that command to include the
WebAssembly SDK flag by changing the invocation from "swift build" to "swift
build --swift-sdk wasm32-unknown-wasi" so the build targets the
wasm32-unknown-wasi SDK.
- Around line 184-186: The workflow uses the swiftwasm/setup-swiftwasm action
with a malformed/outdated tag value
"swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm"; update the tag to the correct
naming convention and a currently available snapshot by replacing the value with
"swift-wasm-DEVELOPMENT-SNAPSHOT-2026-01-19-a" (keep the action reference
swiftwasm/setup-swiftwasm@v2 and only change the tag string to use hyphens and
the newer snapshot).

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/ci.yml:
- Line 181: Update the container tag in the CI workflow from the broad
"swift:6.2" to the specific patch tag "swift:6.2.3" so the job uses the exact
same toolchain as the linux/windows jobs (matching the existing 6.2.3 toolchain
references); locate the container setting in the workflow (the line containing
container: swift:6.2) and replace it with container: swift:6.2.3 to pin the
patch version for reproducible builds.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/ci.yml:
- Around line 178-189: Replace the invalid swiftwasm/setup-swiftwasm input and
tag in the workflow: change the step using swiftwasm/setup-swiftwasm@v2 to
provide the input named tag (not swift-version) and set tag to a valid
swiftlang/swift tag such as "swift-6.2.3-RELEASE" instead of
"wasm-6.2.3-RELEASE"; also remove the dead comment "# container: swift:6.2.3"
since the setup action provides the toolchain.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @.github/workflows/ci.yml:
- Line 186: Replace the nightly-only target string
"wasm32-unknown-wasip1-threads" used in the CI job with the stable
"wasm32-unknown-wasi" target to ensure builds run on the stable Swift SDK; if
threading is required, add an inline comment near the target explaining why the
nightly "wasm32-unknown-wasip1-threads" is necessary and guard the job or add a
separate job for threaded/nightly builds instead of using the nightly target by
default.
- Around line 178-188: The wasm job uses the obsolete setup-swiftwasm@v2 action
and lacks an official Swift toolchain; replace that step by either (Path A)
installing Swift with swift-actions/setup-swift@v2 (set swift-version to 6.2.3)
and then add a step to install the Wasm SDK via `swift sdk install` for the
matching 6.2.3 Wasm artifact before running `swift build --swift-sdk
wasm32-unknown-wasip1-threads`, or (Path B) restore using a Swift container
(previously commented `container: swift:6.2.3`) to provide Swift in the
environment; also remove the dead comment `# container: swift:6.2.3` from the
workflow.

Comment on lines 178 to 188
wasm:
timeout-minutes: 10
runs-on: ubuntu-latest
# container: swift:6.2.3
steps:
- uses: actions/checkout@v6
- uses: swiftwasm/setup-swiftwasm@v2
with:
target: "wasm32-unknown-wasip1-threads"
- name: Build
run: swift build --swift-sdk wasm32-unknown-wasip1-threads
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

curl -s "https://raw.githubusercontent.com/swiftwasm/setup-swiftwasm/v2/action.yml" 2>/dev/null | head -60

Repository: netreconlab/Parse-Swift

Length of output: 900


🌐 Web query:

setup-swiftwasm v2 action Swift toolchain installation ubuntu

💡 Result:

setup-swiftwasm@v2 is effectively obsolete for modern SwiftWasm: since SwiftWasm 6.1, SwiftWasm moved to an SDK-only distribution, meant to be used with an official Swift toolchain (from swift.org) rather than a separate “SwiftWasm toolchain” action. [1]

On Ubuntu GitHub Actions, use:

  1. Install Swift toolchain (official) with swift-actions/setup-swift@v2 (this sets up Swift on Ubuntu runners). [2]
  2. Install the WebAssembly Swift SDK with swift sdk install ... (per Swift.org’s WebAssembly Swift SDK guide). [3]

Example workflow (Ubuntu):

jobs:
  wasm:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      # 1) Install Swift toolchain
      - uses: swift-actions/setup-swift@v2
        with:
          swift-version: "6.2.3"  # match the SDK version you install

      # 2) Install the Wasm Swift SDK
      - name: Install Wasm Swift SDK
        run: |
          swift sdk install \
            https://download.swift.org/swift-6.2.3-release/wasm-sdk/swift-6.2.3-RELEASE/swift-6.2.3-RELEASE_wasm.artifactbundle.tar.gz \
            --checksum 394040ecd5260e68bb02f6c20aeede733b9b90702c2204e178f3e42413edad2a
          swift sdk list

      # Build targeting Wasm
      - name: Build (Wasm)
        run: swift build --swift-sdk swift-6.2.3-RELEASE_wasm

Notes:

  • The Swift toolchain version must exactly match the Wasm SDK version you install. [3]
  • If you want the toolchain install commands outside Actions, Swift.org documents Ubuntu toolchain installs and provides “WebAssembly” SDK bundles too. [4]

Sources
[1] SwiftWasm 6.1 release notes (SDK-only distribution) https://blog.swiftwasm.org/posts/6-1-released/
[2] swift-actions/setup-swift@v2 README https://github.com/swift-actions/setup-swift
[3] Swift.org “Getting Started with Swift SDKs for WebAssembly” https://www.swift.org/documentation/articles/wasm-getting-started.html
[4] Swift.org Ubuntu install page (toolchains + WebAssembly SDK section) https://www.swift.org/install/linux/ubuntu/22_04/


🌐 Web query:

swiftwasm wasm32-unknown-wasip1-threads target support

💡 Result:

Yes—SwiftWasm supports the wasm32-unknown-wasip1-threads target, but it’s not part of the default/stable WASI target; it’s provided via a nightly Swift SDK for WebAssembly. This target enables threading using the (now-withdrawn) wasi-threads ABI as a stopgap while newer WASI threading work matures. To run binaries built for this target, you typically use Wasmtime with --wasi threads. [1]

Related: Swift’s WASI triple was renamed from wasm32-unknown-wasi to wasm32-unknown-wasip1 (Preview 1) in newer Swift-for-Wasm work, and the threads-enabled triple uses the same wasip1 naming. [2]

Sources: [1] [2]


My Young Hero, your workflow has fallen behind! The SwiftWasm approach must EVOLVE — Plus Ultra!

The setup-swiftwasm@v2 action is now obsolete. Since SwiftWasm 6.1, the project distributes SDKs only and requires an official Swift toolchain from swift.org. The current job fails on bare ubuntu-latest because:

  1. No Swift toolchain is installed
  2. The tag input defaults to detecting Swift from PATH, which doesn't exist on ubuntu-latest
  3. The setup-swiftwasm action cannot work without Swift already available

To unleash Plus Ultra power, choose ONE path:

  • Path A (Recommended): Install official Swift + Wasm SDK together:
    - uses: swift-actions/setup-swift@v2
      with:
        swift-version: "6.2.3"
    - name: Install Wasm SDK
      run: swift sdk install https://download.swift.org/swift-6.2.3-release/wasm-sdk/swift-6.2.3-RELEASE/swift-6.2.3-RELEASE_wasm.artifactbundle.tar.gz --checksum [hash]
  • Path B (Legacy): Restore the commented-out container: swift:6.2.3 to bring Swift into the environment.

Additionally, remove the dead comment # container: swift:6.2.3 from line 181—it no longer serves a purpose.

🤖 Prompt for AI Agents
In @.github/workflows/ci.yml around lines 178 - 188, The wasm job uses the
obsolete setup-swiftwasm@v2 action and lacks an official Swift toolchain;
replace that step by either (Path A) installing Swift with
swift-actions/setup-swift@v2 (set swift-version to 6.2.3) and then add a step to
install the Wasm SDK via `swift sdk install` for the matching 6.2.3 Wasm
artifact before running `swift build --swift-sdk wasm32-unknown-wasip1-threads`,
or (Path B) restore using a Swift container (previously commented `container:
swift:6.2.3`) to provide Swift in the environment; also remove the dead comment
`# container: swift:6.2.3` from the workflow.

- uses: actions/checkout@v6
- uses: swiftwasm/setup-swiftwasm@v2
with:
target: "wasm32-unknown-wasip1-threads"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Consider using the recommended wasm32-unknown-wasi target instead, PLUS ULTRA!

The wasm32-unknown-wasip1-threads target triple is only available in the nightly Swift SDK for WebAssembly. The recommended target is wasm32-unknown-wasi — "Choose wasm32-unknown-wasi if you are not sure which target to use."

Using the nightly-only threads target means this CI job depends on nightly SDK availability and may break with stable releases. Since the PR objective is to verify that Parse-Swift builds for WASM (not to exercise threading), the stable wasm32-unknown-wasi target would give you more reliable CI. If threads support is specifically needed, consider adding a comment explaining why.

💪 SMASH this into a stable target!
      - uses: swiftwasm/setup-swiftwasm@v2
        with:
-         target: "wasm32-unknown-wasip1-threads"
+         target: "wasm32-unknown-wasi"
      - name: Build
-       run: swift build --swift-sdk wasm32-unknown-wasip1-threads
+       run: swift build --swift-sdk wasm32-unknown-wasi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
target: "wasm32-unknown-wasip1-threads"
- uses: swiftwasm/setup-swiftwasm@v2
with:
tag: "swift-6.2.3-RELEASE"
target: "wasm32-unknown-wasi"
- name: Build
run: swift build --swift-sdk wasm32-unknown-wasi
🤖 Prompt for AI Agents
In @.github/workflows/ci.yml at line 186, Replace the nightly-only target string
"wasm32-unknown-wasip1-threads" used in the CI job with the stable
"wasm32-unknown-wasi" target to ensure builds run on the stable Swift SDK; if
threading is required, add an inline comment near the target explaining why the
nightly "wasm32-unknown-wasip1-threads" is necessary and guard the job or add a
separate job for threaded/nightly builds instead of using the nightly target by
default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments