Skip to content

CI: Add build check for WebAssembly SDK #3159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kateinoigakukun
Copy link
Contributor

@kateinoigakukun kateinoigakukun commented Mar 27, 2025

Add build check CI for WebAssembly SDK

Motivation:

It's very difficult to keep the code with WebAssembly/WASI compatible, and we need to apply some fixes sometimes #3156

Modifications:

Added a job to check if swift build --swift-sdk wasm32-unknown-wasi passes.

Result:

Setting up the CI job makes it easier to detect such incompatibility before merging.

@kateinoigakukun kateinoigakukun marked this pull request as ready for review March 27, 2025 10:19
Copy link
Member

@FranzBusch FranzBusch left a comment

Choose a reason for hiding this comment

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

We sadly cannot accept this PR at this time. Currently WASM is not an officially supported platform by Swift and there is no official toolchain for it. This is something for the Platforms Steering Group to address. Once both issues have been solved we would love to add CI for WASM. cc @al45tair

@kateinoigakukun
Copy link
Contributor Author

Thanks for sharing! That's a good motivation to make it official :)

@@ -88,3 +88,8 @@ jobs:
name: Static SDK
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/static_sdk.yml@main

wasm-sdk:
name: WebAssembly SDK
Copy link
Contributor

Choose a reason for hiding this comment

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

We sadly cannot accept this PR at this time. Currently WASM is not an officially supported platform by Swift…

@FranzBusch Curious what your thoughts are about allowing wasm builds into swif-nio, but as optional actions rather than required?

This would improve visibility on wasm breakages without imposing a requirement for official support. Right now, contributors are likely a bit blind to any wasm breakages. If there is a way to improve awareness without imposing extra burden on contributors, feels like a win-win.

I believe we could make it optional by adding the following config to wasm-sdk here.

continue-on-error: true

Copy link
Contributor

@scottmarchant scottmarchant Mar 27, 2025

Choose a reason for hiding this comment

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

cc @MaxDesiatov in case you have any insight on this as well.

Copy link
Member

Choose a reason for hiding this comment

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

@FranzBusch Curious what your thoughts are about allowing wasm builds into swif-nio, but as optional actions rather than required?

I'm fully empathetic on making sure we are not breaking WASM support. However, at this point we just can't use an externally produced toolchain here. That's why I would like to push the Platforms Steering Group on considering WASM as an official platform so that we can start producing official toolchains that we can use in our CI.

Copy link
Contributor

Choose a reason for hiding this comment

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

One more data point on this topic, currently swiftlang/swift has at least some wasm CI visibility. It doesn't look like it is a requirement in Pull Requests. But the wasm build status for swift is reported prominently on the repository welcome page.

CleanShot 2025-03-27 at 10 53 20

Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't look like it is a requirement in Pull Requests.

It might not look like it, but actually the Linux PR tests do do some WASM testing, and it is required to pass.

Copy link
Member

Choose a reason for hiding this comment

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

6.2 and main snapshots now have corresponding Swift SDKs distributed on swift.org https://www.swift.org/install/

@scottmarchant
Copy link
Contributor

@kateinoigakukun This is awesome, thanks so much!

@kateinoigakukun
Copy link
Contributor Author

I updated the workflow to use Swift SDK for WebAssembly distributed from swift.org. Here is a successful job in my fork: https://github.com/kateinoigakukun/swift-nio/actions/runs/16553038350/job/46810622526

Copy link
Contributor

@rnro rnro left a comment

Choose a reason for hiding this comment

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

This change looks good in general thank you! I'd like to see Max's suggestions merged but other than that it looks good. Apologies, I spotted far too late that the testing changes I commented on were in a separate PR; nevertheless that does need to be backed out before we can merge this.

Co-authored-by: Max Desiatov <[email protected]>
@kateinoigakukun
Copy link
Contributor Author

Ok, I applied the wording suggestions and reverted the test commit

@rnro
Copy link
Contributor

rnro commented Jul 29, 2025

@FranzBusch Do you continue to have reservations about this PR?

Copy link
Member

@FranzBusch FranzBusch left a comment

Choose a reason for hiding this comment

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

Nope this looks awesome to me! Thanks for the work

@rnro rnro added the semver/none No version bump required. label Jul 29, 2025
@rnro
Copy link
Contributor

rnro commented Jul 29, 2025

Invalid workflow file: .github/workflows/pull_request.yml#L96
error parsing called workflow
".github/workflows/pull_request.yml"
-> "apple/swift-nio/.github/workflows/wasm_sdk.yml@main"
: failed to fetch workflow: workflow was not found.

I think we'll have to merge the re-usable workflow in one PR and then enable it in pull_request.yml and main.yml in a separate one sorry. Thanks so much for contributing this.

@kateinoigakukun
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/none No version bump required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants