-
Notifications
You must be signed in to change notification settings - Fork 23
Provide partial WebAssembly support #55
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
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
1cc9b16
Enable coverage reports and add ci step for the wasm build. The build…
pedrovgs 75cc280
Update workflow toolchain version
pedrovgs 8d1fa5d
Add test step
pedrovgs 7f855de
Merge pull request #1 from GoodNotes/wasm-compatibility-ci
pedrovgs 0c40e94
Fix iOS CI, update WASM CI for testing we will need later and provide…
pedrovgs 4ff93ea
Merge pull request #2 from GoodNotes/wasm-more-ci-improvements
pedrovgs d25725a
Update CI and swift version
pedrovgs 930c68a
Update CI
pedrovgs 0ddb743
Enable shared memory
pedrovgs 512f0f4
Do not use number formatter for wasm
pedrovgs 7af4032
Make mfarray compatible with wasm by disabling coreml features
pedrovgs 696ece5
Make mfadata compatible with wasm
pedrovgs 0685139
Get mftype compatible with wasm
pedrovgs bc7ab32
Provide now a mftype fallback types we when accelerate is not available
pedrovgs a755923
Get order now compatible with XP
pedrovgs 654b9ff
Get a fallback implementaiton if accelerate is not availbe in types.s…
pedrovgs 3ff8285
Get some extra wrappers for libraries we don't support
pedrovgs 86b934d
Get now method folder compatible with wasm
pedrovgs f9112a2
Get fallback implementation for static folder
pedrovgs b6a021d
Get library and wrapper compatible with WASM
pedrovgs fd1101b
Add support for complex testing scenarios
pedrovgs d2d85dd
Disable complex tests
pedrovgs 27f3c4b
Improve import usage
pedrovgs bda0fe7
Use the right param names
pedrovgs c1787d7
Add fallback implementations with fatal errors until we are able to i…
pedrovgs 2c510f8
Disable performance tests temporally
pedrovgs 3817487
Update random tests to reduce memory pressure
pedrovgs 7327253
Fix import
pedrovgs 48bda80
Update wrong import
pedrovgs acd15f4
Disable some other performance tests
pedrovgs 8e6d4f1
Enable back wasm fallback tests and revert a change made by mistake
pedrovgs 31c679f
Update clapack pacakge and add some guards to our code to prevent ten…
pedrovgs b0fbfa9
Use https for dependency instead of ssh
pedrovgs 89cb093
Disable some perf tests temporally for WASM
pedrovgs 9fec130
Fix CI by forcing the toolchain version we have to use
pedrovgs bab1f10
Merge pull request #3 from GoodNotes/code-wasm-compatibility
pedrovgs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| 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" | ||
| # Checksum for the WASM SDK (from SwiftWasm release page) | ||
| SWIFT_WASM_SDK_CHECKSUM: "879c08f24c36e20e0b3d1fadc37f4c34c089c72caa018aec726d9e0bf84ea6ff" | ||
|
|
||
| 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 swift.org, SDK comes from SwiftWasm | ||
| - name: Install Swift Toolchain | ||
| run: | | ||
| SWIFT_URL="https://download.swift.org/development/ubuntu2404/swift-${SWIFT_TOOLCHAIN_VERSION}/swift-${SWIFT_TOOLCHAIN_VERSION}-ubuntu24.04.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 from SwiftWasm | ||
| - 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" --checksum "$SWIFT_WASM_SDK_CHECKSUM" | ||
| 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 |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,35 @@ | ||
| // swift-tools-version:5.1 | ||
| // swift-tools-version:5.9 | ||
| // The swift-tools-version declares the minimum version of Swift required to build this package. | ||
|
|
||
| import PackageDescription | ||
|
|
||
| let package = Package( | ||
| name: "Matft", | ||
| products: [ | ||
| // Products define the executables and libraries produced by a package, and make them visible to other packages. | ||
| .library( | ||
| name: "Matft", | ||
| targets: ["Matft"]), | ||
| //.library(name: "ReleaseTest", targets: ["Matft "]) | ||
| ], | ||
| dependencies: [ | ||
| // Dependencies declare other packages that this package depends on. | ||
| // .package(url: /* package url */, from: "1.0.0"), | ||
| .package(url: "https://github.com/apple/swift-collections", from: "1.0.0"), | ||
|
|
||
| .package(url: "https://github.com/goodnotes/CLAPACK", branch: "eigen-support"), | ||
| ], | ||
| targets: [ | ||
| // Targets are the basic building blocks of a package. A target can define a module or a test suite. | ||
| // Targets can depend on other targets in this package, and on products in packages which this package depends on. | ||
| .target( | ||
| name: "pocketFFT" | ||
| ), | ||
| .target( | ||
| name: "Matft", | ||
| dependencies: ["Collections", "pocketFFT"]), | ||
| dependencies: [ | ||
| .product(name: "Collections", package: "swift-collections"), | ||
| "pocketFFT", | ||
| .product(name: "CLAPACK", package: "CLAPACK", condition: .when(platforms: [.wasi])), | ||
| ]), | ||
| .testTarget( | ||
| name: "MatftTests", | ||
| dependencies: ["Matft"]), | ||
| .testTarget( | ||
| name: "PerformanceTests", | ||
| dependencies: ["Matft"]), | ||
| ] | ||
| //cxxLanguageStandard: .gnucxx1z | ||
| ) |
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
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
This was fatal bug...