From 26e60cf84b1cf62b9a0972a4df2780f39a90a444 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 3 Dec 2025 11:11:19 -0800 Subject: [PATCH 1/4] Add support for Windows on ARM --- .github/workflows/pull_request.yml | 1 + .github/workflows/scripts/windows/install-vsb.ps1 | 3 ++- .../scripts/windows/swift/install-swift-6.0.ps1 | 9 +++++++-- .../scripts/windows/swift/install-swift-6.1.ps1 | 9 +++++++-- .../scripts/windows/swift/install-swift-6.2.ps1 | 9 +++++++-- .../windows/swift/install-swift-nightly-6.2.ps1 | 12 ++++++++++-- .../scripts/windows/swift/install-swift-nightly.ps1 | 10 ++++++++-- .github/workflows/swift_package_test.yml | 9 +++++++-- 8 files changed, 49 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 7c06909f..5357b9ec 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -77,6 +77,7 @@ jobs: Invoke-Program swift package init --type library Invoke-Program swift build enable_windows_docker: false + windows_os_versions: '["windows-2022", "windows-11-arm"]' tests_macos: name: Test diff --git a/.github/workflows/scripts/windows/install-vsb.ps1 b/.github/workflows/scripts/windows/install-vsb.ps1 index 931cbbbc..d251bf4a 100644 --- a/.github/workflows/scripts/windows/install-vsb.ps1 +++ b/.github/workflows/scripts/windows/install-vsb.ps1 @@ -32,7 +32,8 @@ $Process = '--norestart', '--nocache', '--add', 'Microsoft.VisualStudio.Component.Windows11SDK.22000', - '--add', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64' + '--add', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', + '--add', 'Microsoft.VisualStudio.Component.VC.Tools.ARM64' ) if ($Process.ExitCode -eq 0 -or $Process.ExitCode -eq 3010) { Write-Host 'SUCCESS' diff --git a/.github/workflows/scripts/windows/swift/install-swift-6.0.ps1 b/.github/workflows/scripts/windows/swift/install-swift-6.0.ps1 index 1a6a432a..fcc53486 100644 --- a/.github/workflows/scripts/windows/swift/install-swift-6.0.ps1 +++ b/.github/workflows/scripts/windows/swift/install-swift-6.0.ps1 @@ -11,7 +11,12 @@ ##===----------------------------------------------------------------------===## . $PSScriptRoot\install-swift.ps1 -$SWIFT='https://download.swift.org/swift-6.0.3-release/windows10/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-windows10.exe' -$SWIFT_SHA256='AB205D83A38047882DB80E6A88C7D33B651F3BAC96D4515D7CBA5335F37999D3' +if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm64") { + $SWIFT='https://download.swift.org/swift-6.0.3-release/windows10-arm64/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-windows10-arm64.exe' + $SWIFT_SHA256='81474651e59a9955c9e6a389ef53abd61631ffc62c63a2a02977271019e7c722' +} else { + $SWIFT='https://download.swift.org/swift-6.0.3-release/windows10/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-windows10.exe' + $SWIFT_SHA256='AB205D83A38047882DB80E6A88C7D33B651F3BAC96D4515D7CBA5335F37999D3' +} Install-Swift -Url $SWIFT -Sha256 $SWIFT_SHA256 \ No newline at end of file diff --git a/.github/workflows/scripts/windows/swift/install-swift-6.1.ps1 b/.github/workflows/scripts/windows/swift/install-swift-6.1.ps1 index 035d3371..426d9d6c 100644 --- a/.github/workflows/scripts/windows/swift/install-swift-6.1.ps1 +++ b/.github/workflows/scripts/windows/swift/install-swift-6.1.ps1 @@ -11,7 +11,12 @@ ##===----------------------------------------------------------------------===## . $PSScriptRoot\install-swift.ps1 -$SWIFT='https://download.swift.org/swift-6.1.2-release/windows10/swift-6.1.2-RELEASE/swift-6.1.2-RELEASE-windows10.exe' -$SWIFT_SHA256='92a0323ed7dd333c3b05e6e0e428f3a91c77d159f6ccfc8626a996f2ace09a0b' +if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm64") { + $SWIFT='https://download.swift.org/swift-6.1.2-release/windows10-arm64/swift-6.1.2-RELEASE/swift-6.1.2-RELEASE-windows10-arm64.exe' + $SWIFT_SHA256='121fb407e578178f82dccf39a4d03527873d8f7611a801a8fc26da52503a0c5c' +} else { + $SWIFT='https://download.swift.org/swift-6.1.2-release/windows10/swift-6.1.2-RELEASE/swift-6.1.2-RELEASE-windows10.exe' + $SWIFT_SHA256='92a0323ed7dd333c3b05e6e0e428f3a91c77d159f6ccfc8626a996f2ace09a0b' +} Install-Swift -Url $SWIFT -Sha256 $SWIFT_SHA256 diff --git a/.github/workflows/scripts/windows/swift/install-swift-6.2.ps1 b/.github/workflows/scripts/windows/swift/install-swift-6.2.ps1 index 2827cb9d..ede6cfac 100644 --- a/.github/workflows/scripts/windows/swift/install-swift-6.2.ps1 +++ b/.github/workflows/scripts/windows/swift/install-swift-6.2.ps1 @@ -11,7 +11,12 @@ ##===----------------------------------------------------------------------===## . $PSScriptRoot\install-swift.ps1 -$SWIFT='https://download.swift.org/swift-6.2.1-release/windows10/swift-6.2.1-RELEASE/swift-6.2.1-RELEASE-windows10.exe' -$SWIFT_SHA256='FD1209AC3E008152924E0409E5590F2FE41644132E532D4526B8641339E88000' +if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm64") { + $SWIFT='https://download.swift.org/swift-6.2.1-release/windows10-arm64/swift-6.2.1-RELEASE/swift-6.2.1-RELEASE-windows10-arm64.exe' + $SWIFT_SHA256='7c2351e1708f6e74f4c97098c50ac049e08a58894e75cc7c8fd220eb2549fb9d' +} else { + $SWIFT='https://download.swift.org/swift-6.2.1-release/windows10/swift-6.2.1-RELEASE/swift-6.2.1-RELEASE-windows10.exe' + $SWIFT_SHA256='FD1209AC3E008152924E0409E5590F2FE41644132E532D4526B8641339E88000' +} Install-Swift -Url $SWIFT -Sha256 $SWIFT_SHA256 diff --git a/.github/workflows/scripts/windows/swift/install-swift-nightly-6.2.ps1 b/.github/workflows/scripts/windows/swift/install-swift-nightly-6.2.ps1 index 324bea0a..df7352da 100644 --- a/.github/workflows/scripts/windows/swift/install-swift-nightly-6.2.ps1 +++ b/.github/workflows/scripts/windows/swift/install-swift-nightly-6.2.ps1 @@ -11,8 +11,16 @@ ##===----------------------------------------------------------------------===## . $PSScriptRoot\install-swift.ps1 -$SWIFT_RELEASE_METADATA='http://download.swift.org/swift-6.2-branch/windows10/latest-build.json' +if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm64") { + # FIXME: http://download.swift.org/swift-6.2-branch/windows10-arm64/latest-build.json is currently missing on the server + #$swiftOSVersion = 'windows10-arm64' + $swiftOSVersion = 'windows10' +} else { + $swiftOSVersion = 'windows10' +} + +$SWIFT_RELEASE_METADATA="http://download.swift.org/swift-6.2-branch/$swiftOSVersion/latest-build.json" $Release = curl.exe -sL ${SWIFT_RELEASE_METADATA} -$SWIFT_URL = "https://download.swift.org/swift-6.2-branch/windows10/$($($Release | ConvertFrom-JSON).dir)/$($($Release | ConvertFrom-JSON).download)" +$SWIFT_URL = "https://download.swift.org/swift-6.2-branch/$swiftOSVersion/$($($Release | ConvertFrom-JSON).dir)/$($($Release | ConvertFrom-JSON).download)" Install-Swift -Url $SWIFT_URL -Sha256 "" \ No newline at end of file diff --git a/.github/workflows/scripts/windows/swift/install-swift-nightly.ps1 b/.github/workflows/scripts/windows/swift/install-swift-nightly.ps1 index 9c0c1545..08558ff6 100644 --- a/.github/workflows/scripts/windows/swift/install-swift-nightly.ps1 +++ b/.github/workflows/scripts/windows/swift/install-swift-nightly.ps1 @@ -11,8 +11,14 @@ ##===----------------------------------------------------------------------===## . $PSScriptRoot\install-swift.ps1 -$SWIFT_RELEASE_METADATA='http://download.swift.org/development/windows10/latest-build.json' +if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm64") { + $swiftOSVersion = 'windows10-arm64' +} else { + $swiftOSVersion = 'windows10' +} + +$SWIFT_RELEASE_METADATA="http://download.swift.org/development/$swiftOSVersion/latest-build.json" $Release = curl.exe -sL ${SWIFT_RELEASE_METADATA} -$SWIFT_URL = "https://download.swift.org/development/windows10/$($($Release | ConvertFrom-JSON).dir)/$($($Release | ConvertFrom-JSON).download)" +$SWIFT_URL = "https://download.swift.org/development/$swiftOSVersion/$($($Release | ConvertFrom-JSON).dir)/$($($Release | ConvertFrom-JSON).download)" Install-Swift -Url $SWIFT_URL -Sha256 "" \ No newline at end of file diff --git a/.github/workflows/swift_package_test.yml b/.github/workflows/swift_package_test.yml index 8637a1c2..6ff0b183 100644 --- a/.github/workflows/swift_package_test.yml +++ b/.github/workflows/swift_package_test.yml @@ -83,6 +83,10 @@ on: type: string description: "Exclude Windows Swift version list (JSON)" default: "[{\"swift_version\": \"\"}]" + windows_os_versions: + type: string + description: "Windows OS version label list (JSON)" + default: "[\"windows-2022\"]" swift_flags: type: string description: "Swift flags for release version" @@ -618,13 +622,14 @@ jobs: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/install-and-build-with-sdk.sh --android --flags="$BUILD_FLAGS" --build-command="${{ inputs.android_sdk_build_command }}" --android-sdk-triple=${{ join(fromJson(inputs.android_sdk_triples), ' --android-sdk-triple=') }} --android-ndk-version="${{ matrix.ndk_version }}" ${{ matrix.swift_version }} windows-build: - name: Windows (${{ matrix.swift_version }} - windows-2022) + name: Windows (${{ matrix.swift_version }} - ${{ matrix.os_version }}) if: ${{ inputs.enable_windows_checks }} - runs-on: windows-2022 + runs-on: ${{ matrix.os_version }} strategy: fail-fast: false matrix: swift_version: ${{ fromJson(inputs.windows_swift_versions) }} + os_version: ${{ fromJson(inputs.windows_os_versions) }} exclude: - ${{ fromJson(inputs.windows_exclude_swift_versions) }} steps: From af0213ce9056c791af4014c858607ff684d1fce8 Mon Sep 17 00:00:00 2001 From: Mishal Shah Date: Wed, 3 Dec 2025 23:53:57 -0800 Subject: [PATCH 2/4] Fix the http -> https --- .../scripts/windows/swift/install-swift-nightly-6.2.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scripts/windows/swift/install-swift-nightly-6.2.ps1 b/.github/workflows/scripts/windows/swift/install-swift-nightly-6.2.ps1 index df7352da..acf4ebfd 100644 --- a/.github/workflows/scripts/windows/swift/install-swift-nightly-6.2.ps1 +++ b/.github/workflows/scripts/windows/swift/install-swift-nightly-6.2.ps1 @@ -19,7 +19,7 @@ if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm $swiftOSVersion = 'windows10' } -$SWIFT_RELEASE_METADATA="http://download.swift.org/swift-6.2-branch/$swiftOSVersion/latest-build.json" +$SWIFT_RELEASE_METADATA="https://download.swift.org/swift-6.2-branch/$swiftOSVersion/latest-build.json" $Release = curl.exe -sL ${SWIFT_RELEASE_METADATA} $SWIFT_URL = "https://download.swift.org/swift-6.2-branch/$swiftOSVersion/$($($Release | ConvertFrom-JSON).dir)/$($($Release | ConvertFrom-JSON).download)" From 4d5bb93f6131802f44428e9230c563879e3c8f64 Mon Sep 17 00:00:00 2001 From: Mishal Shah Date: Wed, 3 Dec 2025 23:54:08 -0800 Subject: [PATCH 3/4] Fix the http -> https --- .../workflows/scripts/windows/swift/install-swift-nightly.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scripts/windows/swift/install-swift-nightly.ps1 b/.github/workflows/scripts/windows/swift/install-swift-nightly.ps1 index 08558ff6..23a1a620 100644 --- a/.github/workflows/scripts/windows/swift/install-swift-nightly.ps1 +++ b/.github/workflows/scripts/windows/swift/install-swift-nightly.ps1 @@ -17,7 +17,7 @@ if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm $swiftOSVersion = 'windows10' } -$SWIFT_RELEASE_METADATA="http://download.swift.org/development/$swiftOSVersion/latest-build.json" +$SWIFT_RELEASE_METADATA="https://download.swift.org/development/$swiftOSVersion/latest-build.json" $Release = curl.exe -sL ${SWIFT_RELEASE_METADATA} $SWIFT_URL = "https://download.swift.org/development/$swiftOSVersion/$($($Release | ConvertFrom-JSON).dir)/$($($Release | ConvertFrom-JSON).download)" From 3a7ffb74648e03ab39bcbcfff084660e2fa2f5e3 Mon Sep 17 00:00:00 2001 From: Mishal Shah Date: Wed, 3 Dec 2025 23:54:26 -0800 Subject: [PATCH 4/4] Remove the workaround --- .../scripts/windows/swift/install-swift-nightly-6.2.ps1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/scripts/windows/swift/install-swift-nightly-6.2.ps1 b/.github/workflows/scripts/windows/swift/install-swift-nightly-6.2.ps1 index acf4ebfd..b7df76cd 100644 --- a/.github/workflows/scripts/windows/swift/install-swift-nightly-6.2.ps1 +++ b/.github/workflows/scripts/windows/swift/install-swift-nightly-6.2.ps1 @@ -12,9 +12,7 @@ . $PSScriptRoot\install-swift.ps1 if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm64") { - # FIXME: http://download.swift.org/swift-6.2-branch/windows10-arm64/latest-build.json is currently missing on the server - #$swiftOSVersion = 'windows10-arm64' - $swiftOSVersion = 'windows10' + $swiftOSVersion = 'windows10-arm64' } else { $swiftOSVersion = 'windows10' }