Skip to content

BridgeJS: Add throws(JSException) to imported methods #1563

BridgeJS: Add throws(JSException) to imported methods

BridgeJS: Add throws(JSException) to imported methods #1563

Workflow file for this run

name: Run unit tests
on:
pull_request:
push:
branches: [main]
jobs:
test:
name: Build and Test
strategy:
matrix:
entry:
- os: ubuntu-22.04
toolchain:
download-url: https://download.swift.org/swift-6.0.2-release/ubuntu2204/swift-6.0.2-RELEASE/swift-6.0.2-RELEASE-ubuntu22.04.tar.gz
wasi-backend: Node
target: "wasm32-unknown-wasi"
- os: ubuntu-22.04
toolchain:
download-url: https://download.swift.org/swift-6.1-release/ubuntu2204/swift-6.1-RELEASE/swift-6.1-RELEASE-ubuntu22.04.tar.gz
wasi-backend: Node
target: "wasm32-unknown-wasi"
- os: ubuntu-22.04
toolchain:
download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-06-12-a/swift-DEVELOPMENT-SNAPSHOT-2025-06-12-a-ubuntu22.04.tar.gz
wasi-backend: Node
target: "wasm32-unknown-wasi"
- os: ubuntu-22.04
toolchain:
download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-06-12-a/swift-DEVELOPMENT-SNAPSHOT-2025-06-12-a-ubuntu22.04.tar.gz
wasi-backend: Node
target: "wasm32-unknown-wasip1-threads"
runs-on: ${{ matrix.entry.os }}
env:
JAVASCRIPTKIT_WASI_BACKEND: ${{ matrix.entry.wasi-backend }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/install-swift
with:
download-url: ${{ matrix.entry.toolchain.download-url }}
- uses: swiftwasm/setup-swiftwasm@v2
id: setup-swiftwasm
with:
target: ${{ matrix.entry.target }}
- name: Configure environment variables
run: |
echo "SWIFT_SDK_ID=${{ steps.setup-swiftwasm.outputs.swift-sdk-id }}" >> $GITHUB_ENV
echo "SWIFT_PATH=$(dirname $(which swiftc))" >> $GITHUB_ENV
- run: make bootstrap
- run: make unittest
# Skip unit tests with uwasi because its proc_exit throws
# unhandled promise rejection.
if: ${{ matrix.entry.wasi-backend != 'MicroWASI' }}
- name: Check if SwiftPM resources are stale
run: |
make regenerate_swiftpm_resources
git diff --exit-code Sources/JavaScriptKit/Runtime
- run: swift test --package-path ./Plugins/PackageToJS
- run: swift test --package-path ./Plugins/BridgeJS
native-build:
# Check native build to make it easy to develop applications by Xcode
name: Build for native target
strategy:
matrix:
include:
- os: macos-15
xcode: Xcode_16
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: swift build --package-path ./Examples/Basic
env:
DEVELOPER_DIR: /Applications/${{ matrix.xcode }}.app/Contents/Developer/
format:
runs-on: ubuntu-latest
container:
image: swift:6.0.3
steps:
- uses: actions/checkout@v4
- run: ./Utilities/format.swift
- name: Check for formatting changes
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git diff --exit-code || {
echo "::error::The formatting changed some files. Please run \`./Utilities/format.swift\` and commit the changes."
exit 1
}
build-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-swift
with:
download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2025-06-12-a/swift-DEVELOPMENT-SNAPSHOT-2025-06-12-a-ubuntu22.04.tar.gz
- uses: swiftwasm/setup-swiftwasm@v2
id: setup-wasm32-unknown-wasi
with: { target: wasm32-unknown-wasi }
- uses: swiftwasm/setup-swiftwasm@v2
id: setup-wasm32-unknown-wasip1-threads
with: { target: wasm32-unknown-wasip1-threads }
- run: ./Utilities/build-examples.sh
env:
SWIFT_SDK_ID_wasm32_unknown_wasip1_threads: ${{ steps.setup-wasm32-unknown-wasip1-threads.outputs.swift-sdk-id }}
SWIFT_SDK_ID_wasm32_unknown_wasi: ${{ steps.setup-wasm32-unknown-wasi.outputs.swift-sdk-id }}
- name: Upload static files as artifact
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: Examples/
deploy-examples:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build-examples
permissions:
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4