Skip to content

Commit d2a489c

Browse files
committed
Add support for Windows on ARM
1 parent 30fccd9 commit d2a489c

File tree

8 files changed

+49
-13
lines changed

8 files changed

+49
-13
lines changed

.github/workflows/pull_request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ jobs:
7777
Invoke-Program swift package init --type library
7878
Invoke-Program swift build
7979
enable_windows_docker: false
80+
windows_os_versions: '["windows-2022", "windows-11-arm"]'
8081

8182
tests_macos:
8283
name: Test

.github/workflows/scripts/windows/install-vsb.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ $Process =
3232
'--norestart',
3333
'--nocache',
3434
'--add', 'Microsoft.VisualStudio.Component.Windows11SDK.22000',
35-
'--add', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64'
35+
'--add', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
36+
'--add', 'Microsoft.VisualStudio.Component.VC.Tools.ARM64'
3637
)
3738
if ($Process.ExitCode -eq 0 -or $Process.ExitCode -eq 3010) {
3839
Write-Host 'SUCCESS'

.github/workflows/scripts/windows/swift/install-swift-6.0.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
##===----------------------------------------------------------------------===##
1212
. $PSScriptRoot\install-swift.ps1
1313

14-
$SWIFT='https://download.swift.org/swift-6.0.3-release/windows10/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-windows10.exe'
15-
$SWIFT_SHA256='AB205D83A38047882DB80E6A88C7D33B651F3BAC96D4515D7CBA5335F37999D3'
14+
if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm64") {
15+
$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'
16+
$SWIFT_SHA256='81474651e59a9955c9e6a389ef53abd61631ffc62c63a2a02977271019e7c722'
17+
} else {
18+
$SWIFT='https://download.swift.org/swift-6.0.3-release/windows10/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-windows10.exe'
19+
$SWIFT_SHA256='AB205D83A38047882DB80E6A88C7D33B651F3BAC96D4515D7CBA5335F37999D3'
20+
}
1621

1722
Install-Swift -Url $SWIFT -Sha256 $SWIFT_SHA256

.github/workflows/scripts/windows/swift/install-swift-6.1.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
##===----------------------------------------------------------------------===##
1212
. $PSScriptRoot\install-swift.ps1
1313

14-
$SWIFT='https://download.swift.org/swift-6.1.2-release/windows10/swift-6.1.2-RELEASE/swift-6.1.2-RELEASE-windows10.exe'
15-
$SWIFT_SHA256='92a0323ed7dd333c3b05e6e0e428f3a91c77d159f6ccfc8626a996f2ace09a0b'
14+
if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm64") {
15+
$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'
16+
$SWIFT_SHA256='121fb407e578178f82dccf39a4d03527873d8f7611a801a8fc26da52503a0c5c'
17+
} else {
18+
$SWIFT='https://download.swift.org/swift-6.1.2-release/windows10/swift-6.1.2-RELEASE/swift-6.1.2-RELEASE-windows10.exe'
19+
$SWIFT_SHA256='92a0323ed7dd333c3b05e6e0e428f3a91c77d159f6ccfc8626a996f2ace09a0b'
20+
}
1621

1722
Install-Swift -Url $SWIFT -Sha256 $SWIFT_SHA256

.github/workflows/scripts/windows/swift/install-swift-6.2.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
##===----------------------------------------------------------------------===##
1212
. $PSScriptRoot\install-swift.ps1
1313

14-
$SWIFT='https://download.swift.org/swift-6.2.1-release/windows10/swift-6.2.1-RELEASE/swift-6.2.1-RELEASE-windows10.exe'
15-
$SWIFT_SHA256='FD1209AC3E008152924E0409E5590F2FE41644132E532D4526B8641339E88000'
14+
if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm64") {
15+
$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'
16+
$SWIFT_SHA256='7c2351e1708f6e74f4c97098c50ac049e08a58894e75cc7c8fd220eb2549fb9d'
17+
} else {
18+
$SWIFT='https://download.swift.org/swift-6.2.1-release/windows10/swift-6.2.1-RELEASE/swift-6.2.1-RELEASE-windows10.exe'
19+
$SWIFT_SHA256='FD1209AC3E008152924E0409E5590F2FE41644132E532D4526B8641339E88000'
20+
}
1621

1722
Install-Swift -Url $SWIFT -Sha256 $SWIFT_SHA256

.github/workflows/scripts/windows/swift/install-swift-nightly-6.2.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,16 @@
1111
##===----------------------------------------------------------------------===##
1212
. $PSScriptRoot\install-swift.ps1
1313

14-
$SWIFT_RELEASE_METADATA='http://download.swift.org/swift-6.2-branch/windows10/latest-build.json'
14+
if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm64") {
15+
# FIXME: http://download.swift.org/swift-6.2-branch/windows10-arm64/latest-build.json is currently missing on the server
16+
#$swiftOSVersion = 'windows10-arm64'
17+
$swiftOSVersion = 'windows10'
18+
} else {
19+
$swiftOSVersion = 'windows10'
20+
}
21+
22+
$SWIFT_RELEASE_METADATA="http://download.swift.org/swift-6.2-branch/$swiftOSVersion/latest-build.json"
1523
$Release = curl.exe -sL ${SWIFT_RELEASE_METADATA}
16-
$SWIFT_URL = "https://download.swift.org/swift-6.2-branch/windows10/$($($Release | ConvertFrom-JSON).dir)/$($($Release | ConvertFrom-JSON).download)"
24+
$SWIFT_URL = "https://download.swift.org/swift-6.2-branch/$swiftOSVersion/$($($Release | ConvertFrom-JSON).dir)/$($($Release | ConvertFrom-JSON).download)"
1725

1826
Install-Swift -Url $SWIFT_URL -Sha256 ""

.github/workflows/scripts/windows/swift/install-swift-nightly.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@
1111
##===----------------------------------------------------------------------===##
1212
. $PSScriptRoot\install-swift.ps1
1313

14-
$SWIFT_RELEASE_METADATA='http://download.swift.org/development/windows10/latest-build.json'
14+
if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm64") {
15+
$swiftOSVersion = 'windows10-arm64'
16+
} else {
17+
$swiftOSVersion = 'windows10'
18+
}
19+
20+
$SWIFT_RELEASE_METADATA="http://download.swift.org/development/$swiftOSVersion/latest-build.json"
1521
$Release = curl.exe -sL ${SWIFT_RELEASE_METADATA}
16-
$SWIFT_URL = "https://download.swift.org/development/windows10/$($($Release | ConvertFrom-JSON).dir)/$($($Release | ConvertFrom-JSON).download)"
22+
$SWIFT_URL = "https://download.swift.org/development/$swiftOSVersion/$($($Release | ConvertFrom-JSON).dir)/$($($Release | ConvertFrom-JSON).download)"
1723

1824
Install-Swift -Url $SWIFT_URL -Sha256 ""

.github/workflows/swift_package_test.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ on:
8383
type: string
8484
description: "Exclude Windows Swift version list (JSON)"
8585
default: "[{\"swift_version\": \"\"}]"
86+
windows_os_versions:
87+
type: string
88+
description: "Windows OS version label list (JSON)"
89+
default: "[\"windows-2022\"]"
8690
swift_flags:
8791
type: string
8892
description: "Swift flags for release version"
@@ -618,13 +622,14 @@ jobs:
618622
${{ 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 }}
619623
620624
windows-build:
621-
name: Windows (${{ matrix.swift_version }} - windows-2022)
625+
name: Windows (${{ matrix.swift_version }} - ${{ matrix.os_version }})
622626
if: ${{ inputs.enable_windows_checks }}
623-
runs-on: windows-2022
627+
runs-on: ${{ matrix.os_version }}
624628
strategy:
625629
fail-fast: false
626630
matrix:
627631
swift_version: ${{ fromJson(inputs.windows_swift_versions) }}
632+
os_version: ${{ fromJson(inputs.windows_os_versions) }}
628633
exclude:
629634
- ${{ fromJson(inputs.windows_exclude_swift_versions) }}
630635
steps:

0 commit comments

Comments
 (0)