ci: Add WebAssembly compilation check#53
Open
krodak wants to merge 2 commits into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
At PassiveLogic we're adopting CI-level WebAssembly compilation checks across our Swift repositories, so that the WASM build is continuously verified as code evolves (WebAssembly is one of our deployment targets). This PR is a natural extension of that effort to
swift-differentiation, requested by @JaapWijnen, and follows the same approach we use elsewhere (e.g. in JavaScriptKit).It adds a CI job that builds the package for WebAssembly on every pull request, so a change that breaks the WASM build is caught here rather than downstream.
What this verifies
The open-source Swift toolchain's WebAssembly SDK ships the
_Differentiationmodule (_Differentiation.swiftmodule+libswift_Differentiation.a), so#if canImport(_Differentiation)is satisfied on WASM and the differentiation code actually compiles (it is not stubbed out). The existingswift-differentiation-stdlibxcframework dependency stays correctly scoped to macOS/iOS (xcframeworks are Apple-only, and Apple release toolchains do not bundle_Differentiation); on WASM/Linux the toolchain provides the module instead. NoPackage.swiftchange is required.What changed
.github/workflows/pull_request.yml- newtest-wasmjob. It runs in theswift:6.3container, installs the matching WebAssembly Swift SDK viaswiftwasm/setup-swiftwasm, and runsswift build --swift-sdk <id>forwasm32-unknown-wasip1.Tested
Differentiationtarget compiles clean, with the_Differentiation-guarded sources (e.g.Array+Update.swift,Dictionary+Update.swift,Differentiation.swift) actually compiling.Notes
["6.2", "6.3"]matrix to mirror the existing Ubuntu test jobs if preferred.