Skip to content

Commit d4a0311

Browse files
authored
ci: added windows ARM64 runners to tests (#389)
* ci: added windows ARM64 runners to tests * fix: fixed windows arm64 toolchain detection
1 parent 45c1d3e commit d4a0311

File tree

10 files changed

+114
-30
lines changed

10 files changed

+114
-30
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ jobs:
346346
COMPOSITE: ./.ref-download-test
347347
strategy:
348348
matrix:
349-
os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-24.04-arm]
349+
os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-24.04-arm, windows-11-arm]
350350
steps:
351351
- name: Setup wrapper composite action at ${{ env.COMPOSITE }}
352352
uses: actions/github-script@v7

__tests__/installer/windows.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('windows toolchain installation verification', () => {
7878
it('tests setting up on ARM64 Windows 10', async () => {
7979
jest.spyOn(os, 'release').mockReturnValue('10.0.17063')
8080
const installer = new WindowsToolchainInstaller(toolchain)
81-
expect(installer['vsRequirement']('aarch64').components).toStrictEqual([
81+
expect(installer['vsRequirement']('arm64').components).toStrictEqual([
8282
'Microsoft.VisualStudio.Component.VC.Tools.ARM64',
8383
'Microsoft.VisualStudio.Component.Windows10SDK.17763'
8484
])
@@ -118,7 +118,7 @@ describe('windows toolchain installation verification', () => {
118118
preventCaching: false
119119
}
120120
const installer = new WindowsToolchainInstaller(toolchain)
121-
expect(installer['vsRequirement']('aarch64').components).toStrictEqual([
121+
expect(installer['vsRequirement']('arm64').components).toStrictEqual([
122122
'Microsoft.VisualStudio.Component.VC.Tools.ARM64',
123123
'Microsoft.VisualStudio.Component.Windows11SDK.22000'
124124
])

__tests__/snapshot/windows.test.ts

+18
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,22 @@ describe('fetch windows tool data based on options', () => {
185185
expect(tool.dir).toBe(name)
186186
expect(tool.branch).toBe('swiftwasm')
187187
})
188+
189+
it('fetches windows 11 arm64 latest swift 6.0.0 tool', async () => {
190+
setos({os: 'win32', dist: 'Windows', release: '10.0.26100'})
191+
jest.spyOn(os, 'arch').mockReturnValue('arm64')
192+
const ver6_0_0 = ToolchainVersion.create('6.0.0', false)
193+
const tool = await Platform.toolchain(ver6_0_0)
194+
expect(tool).toBeTruthy()
195+
const wTool = tool as WindowsToolchainSnapshot
196+
expect(wTool.download).toBe('swift-6.0-RELEASE-windows10-arm64.exe')
197+
expect(wTool.dir).toBe('swift-6.0-RELEASE')
198+
expect(wTool.platform).toBe('windows10-arm64')
199+
expect(wTool.branch).toBe('swift-6.0-release')
200+
expect(wTool.download_signature).toBe(
201+
'swift-6.0-RELEASE-windows10-arm64.exe.sig'
202+
)
203+
expect(wTool.docker).toBe('6.0-windowsservercore-ltsc2022')
204+
expect(wTool.preventCaching).toBe(false)
205+
})
188206
})

dist/index.js

+47-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/installer/windows/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class WindowsToolchainInstaller extends VerifyingToolchainInstaller<Windo
3131
})
3232

3333
const vsComponents = [
34-
`Microsoft.VisualStudio.Component.VC.Tools.${arch == 'aarch64' ? 'ARM64' : 'x86.x64'}`,
34+
`Microsoft.VisualStudio.Component.VC.Tools.${arch == 'arm64' ? 'ARM64' : 'x86.x64'}`,
3535
...providedComponents
3636
]
3737
if (!winsdkComponent) {

src/platform/index.ts

+1-13
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,7 @@ declare module './base' {
2828
}
2929

3030
Platform.currentPlatform = async () => {
31-
let arch: string
32-
switch (os.arch()) {
33-
case 'x64':
34-
arch = 'x86_64'
35-
break
36-
case 'arm64':
37-
arch = 'aarch64'
38-
break
39-
default:
40-
arch = os.arch()
41-
break
42-
}
43-
31+
const arch = os.arch()
4432
const _os: getos.Os = await new Promise((resolve, reject) => {
4533
getos((e, o) => {
4634
if (e) {

src/platform/linux.ts

+18
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,24 @@ import {LinuxToolchainInstaller} from '../installer'
1010
import {MODULE_DIR} from '../const'
1111

1212
export class LinuxPlatform extends VersionedPlatform<LinuxToolchainInstaller> {
13+
constructor(
14+
readonly name: string,
15+
readonly version: number,
16+
readonly arch: string
17+
) {
18+
switch (arch) {
19+
case 'x64':
20+
arch = 'x86_64'
21+
break
22+
case 'arm64':
23+
arch = 'aarch64'
24+
break
25+
default:
26+
break
27+
}
28+
super(name, version, arch)
29+
}
30+
1331
protected get downloadExtension() {
1432
return 'tar.gz'
1533
}

src/platform/windows.ts

+15
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ import {WindowsToolchainInstaller} from '../installer'
33
import {WindowsToolchainSnapshot, ToolchainSnapshot} from '../snapshot'
44

55
export class WindowsPlatform extends VersionedPlatform<WindowsToolchainInstaller> {
6+
constructor(
7+
readonly name: string,
8+
readonly version: number,
9+
readonly arch: string
10+
) {
11+
switch (arch) {
12+
case 'x64':
13+
arch = 'x86_64'
14+
break
15+
default:
16+
break
17+
}
18+
super(name, version, arch)
19+
}
20+
621
protected get downloadExtension() {
722
return 'exe'
823
}

src/platform/xcode.ts

+10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ import {XcodeToolchainInstaller} from '../installer'
66

77
export class XcodePlatform extends Platform<XcodeToolchainInstaller> {
88
constructor(readonly arch: string) {
9+
switch (arch) {
10+
case 'x64':
11+
arch = 'x86_64'
12+
break
13+
case 'arm64':
14+
arch = 'aarch64'
15+
break
16+
default:
17+
break
18+
}
919
super()
1020
}
1121

src/snapshot/windows.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ import {SignedToolchainSnapshot} from './signed'
22

33
export interface WindowsToolchainSnapshot extends SignedToolchainSnapshot {
44
readonly windows: boolean
5+
readonly docker?: string
56
}

0 commit comments

Comments
 (0)