From 39ae1865653d05ace9d3685811141f812c433b52 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 28 Feb 2025 09:01:15 +0000 Subject: [PATCH 1/3] CI: Use Swift SDK by default In other words, drop toolchain-style installation support --- .github/workflows/compatibility.yml | 12 ++++----- .github/workflows/perf.yml | 10 +++++--- .github/workflows/test.yml | 38 +++-------------------------- Examples/Basic/build.sh | 3 ++- Makefile | 5 +--- 5 files changed, 18 insertions(+), 50 deletions(-) diff --git a/.github/workflows/compatibility.yml b/.github/workflows/compatibility.yml index 04e2aa0d3..8994b624b 100644 --- a/.github/workflows/compatibility.yml +++ b/.github/workflows/compatibility.yml @@ -6,17 +6,15 @@ on: jobs: test: name: Check source code compatibility - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest + container: swift:6.0.3 steps: - name: Checkout uses: actions/checkout@v4 - - uses: swiftwasm/setup-swiftwasm@v1 - with: - swift-version: wasm-6.0.3-RELEASE + - uses: swiftwasm/setup-swiftwasm@v2 - name: Run Test run: | set -eux - make bootstrap cd Examples/Basic - swift build --triple wasm32-unknown-wasi --static-swift-stdlib - swift build --triple wasm32-unknown-wasi -Xswiftc -DJAVASCRIPTKIT_WITHOUT_WEAKREFS --static-swift-stdlib + swift build --swift-sdk wasm32-unknown-wasi --static-swift-stdlib + swift build --swift-sdk wasm32-unknown-wasi -Xswiftc -DJAVASCRIPTKIT_WITHOUT_WEAKREFS --static-swift-stdlib diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index f2ffdcc5e..eb9178429 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -4,13 +4,15 @@ on: [pull_request] jobs: perf: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest + container: swift:6.0.3 steps: - name: Checkout uses: actions/checkout@v4 - - uses: swiftwasm/setup-swiftwasm@v1 - with: - swift-version: wasm-5.9.1-RELEASE + - uses: swiftwasm/setup-swiftwasm@v2 + - name: Install dependencies + run: | + apt-get update && apt-get install make nodejs npm -y - name: Run Benchmark run: | make bootstrap diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e2802fb6d..daac3c50f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,38 +9,17 @@ jobs: strategy: matrix: entry: - # Ensure that all host can install toolchain, build project, and run tests - - { os: macos-14, toolchain: wasm-5.9.1-RELEASE, wasi-backend: Node, xcode: Xcode_15.2.app } - - { os: ubuntu-22.04, toolchain: wasm-5.9.1-RELEASE, wasi-backend: Node } - - { os: ubuntu-22.04, toolchain: wasm-5.10.0-RELEASE, wasi-backend: Node } - - # Ensure that test succeeds with all toolchains and wasi backend combinations - - { os: ubuntu-20.04, toolchain: wasm-5.10.0-RELEASE, wasi-backend: Node } - - { os: ubuntu-20.04, toolchain: wasm-5.9.1-RELEASE, wasi-backend: MicroWASI } - - { os: ubuntu-20.04, toolchain: wasm-5.10.0-RELEASE, wasi-backend: MicroWASI } - 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 - swift-sdk: - id: 6.0.2-RELEASE-wasm32-unknown-wasi - download-url: "https://github.com/swiftwasm/swift/releases/download/swift-wasm-6.0.2-RELEASE/swift-wasm-6.0.2-RELEASE-wasm32-unknown-wasi.artifactbundle.zip" - checksum: "6ffedb055cb9956395d9f435d03d53ebe9f6a8d45106b979d1b7f53358e1dcb4" wasi-backend: Node - os: ubuntu-22.04 toolchain: download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2024-10-30-a/swift-DEVELOPMENT-SNAPSHOT-2024-10-30-a-ubuntu22.04.tar.gz - swift-sdk: - id: DEVELOPMENT-SNAPSHOT-2024-10-31-a-wasm32-unknown-wasi - download-url: "https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-31-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-31-a-wasm32-unknown-wasi.artifactbundle.zip" - checksum: "e42546397786ea6eaec2d9c07f9118a6f3428784cf3df3840a369f19700c1a69" wasi-backend: Node - os: ubuntu-22.04 toolchain: download-url: https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2024-10-30-a/swift-DEVELOPMENT-SNAPSHOT-2024-10-30-a-ubuntu22.04.tar.gz - swift-sdk: - id: DEVELOPMENT-SNAPSHOT-2024-10-31-a-wasm32-unknown-wasip1-threads - download-url: "https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-31-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2024-10-31-a-wasm32-unknown-wasip1-threads.artifactbundle.zip" - checksum: "17dbbe61af6ca09c92ee2d68a56d5716530428e28c4c8358aa860cc4fcdc91ae" wasi-backend: Node runs-on: ${{ matrix.entry.os }} @@ -49,22 +28,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Select SDKROOT - if: ${{ matrix.entry.xcode }} - run: sudo xcode-select -s /Applications/${{ matrix.entry.xcode }} - - uses: swiftwasm/setup-swiftwasm@v1 - if: ${{ matrix.entry.swift-sdk == null }} - with: - swift-version: ${{ matrix.entry.toolchain }} - uses: ./.github/actions/install-swift - if: ${{ matrix.entry.swift-sdk }} with: download-url: ${{ matrix.entry.toolchain.download-url }} - - name: Install Swift SDK - if: ${{ matrix.entry.swift-sdk }} - run: | - swift sdk install "${{ matrix.entry.swift-sdk.download-url }}" --checksum "${{ matrix.entry.swift-sdk.checksum }}" - echo "SWIFT_SDK_ID=${{ matrix.entry.swift-sdk.id }}" >> $GITHUB_ENV + - uses: swiftwasm/setup-swiftwasm@v2 + id: setup-swiftwasm + - name: Configure Swift SDK + run: echo "SWIFT_SDK_ID=${{ steps.setup-swiftwasm.outputs.swift-sdk-id }}" >> $GITHUB_ENV - run: make bootstrap - run: make test - run: make unittest diff --git a/Examples/Basic/build.sh b/Examples/Basic/build.sh index 2e4c3735b..0e5761ecf 100755 --- a/Examples/Basic/build.sh +++ b/Examples/Basic/build.sh @@ -1 +1,2 @@ -swift build --swift-sdk DEVELOPMENT-SNAPSHOT-2024-09-20-a-wasm32-unknown-wasi -Xswiftc -Xclang-linker -Xswiftc -mexec-model=reactor -Xlinker --export=__main_argc_argv +#!/bin/bash +swift build --swift-sdk "${SWIFT_SDK_ID:-wasm32-unknown-wasi}" -Xswiftc -Xclang-linker -Xswiftc -mexec-model=reactor -Xlinker --export=__main_argc_argv diff --git a/Makefile b/Makefile index 7108f3189..1b653315c 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,7 @@ MAKEFILE_DIR := $(dir $(lastword $(MAKEFILE_LIST))) -ifeq ($(SWIFT_SDK_ID),) -SWIFT_BUILD_FLAGS := --triple wasm32-unknown-wasi -else +SWIFT_SDK_ID ?= wasm32-unknown-wasi SWIFT_BUILD_FLAGS := --swift-sdk $(SWIFT_SDK_ID) -endif .PHONY: bootstrap bootstrap: From e6dd6d7fe3e959cb7960285e38ffb3de5c4104a7 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 28 Feb 2025 09:16:26 +0000 Subject: [PATCH 2/3] Fix package-lock.json --- IntegrationTests/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IntegrationTests/package-lock.json b/IntegrationTests/package-lock.json index d0b914f04..9ea81b961 100644 --- a/IntegrationTests/package-lock.json +++ b/IntegrationTests/package-lock.json @@ -11,7 +11,7 @@ }, "..": { "name": "javascript-kit-swift", - "version": "0.19.2", + "version": "0.0.0", "license": "MIT", "devDependencies": { "@rollup/plugin-typescript": "^8.3.1", From 7af3f7fbf2fa5cb295adce74d78637d1b90b955d Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Fri, 28 Feb 2025 09:21:52 +0000 Subject: [PATCH 3/3] Stop using container image for perf --- .github/workflows/perf.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/perf.yml b/.github/workflows/perf.yml index eb9178429..501b16099 100644 --- a/.github/workflows/perf.yml +++ b/.github/workflows/perf.yml @@ -4,15 +4,14 @@ on: [pull_request] jobs: perf: - runs-on: ubuntu-latest - container: swift:6.0.3 + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 + - uses: ./.github/actions/install-swift + with: + download-url: https://download.swift.org/swift-6.0.3-release/ubuntu2404/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-ubuntu24.04.tar.gz - uses: swiftwasm/setup-swiftwasm@v2 - - name: Install dependencies - run: | - apt-get update && apt-get install make nodejs npm -y - name: Run Benchmark run: | make bootstrap