Skip to content

ci: added windows ARM64 runners to tests #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ jobs:
COMPOSITE: ./.ref-download-test
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-24.04-arm]
os: [ubuntu-latest, macos-latest, windows-latest, ubuntu-24.04-arm, windows-11-arm]
steps:
- name: Setup wrapper composite action at ${{ env.COMPOSITE }}
uses: actions/github-script@v7
Expand Down
4 changes: 2 additions & 2 deletions __tests__/installer/windows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('windows toolchain installation verification', () => {
it('tests setting up on ARM64 Windows 10', async () => {
jest.spyOn(os, 'release').mockReturnValue('10.0.17063')
const installer = new WindowsToolchainInstaller(toolchain)
expect(installer['vsRequirement']('aarch64').components).toStrictEqual([
expect(installer['vsRequirement']('arm64').components).toStrictEqual([
'Microsoft.VisualStudio.Component.VC.Tools.ARM64',
'Microsoft.VisualStudio.Component.Windows10SDK.17763'
])
Expand Down Expand Up @@ -118,7 +118,7 @@ describe('windows toolchain installation verification', () => {
preventCaching: false
}
const installer = new WindowsToolchainInstaller(toolchain)
expect(installer['vsRequirement']('aarch64').components).toStrictEqual([
expect(installer['vsRequirement']('arm64').components).toStrictEqual([
'Microsoft.VisualStudio.Component.VC.Tools.ARM64',
'Microsoft.VisualStudio.Component.Windows11SDK.22000'
])
Expand Down
18 changes: 18 additions & 0 deletions __tests__/snapshot/windows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,22 @@ describe('fetch windows tool data based on options', () => {
expect(tool.dir).toBe(name)
expect(tool.branch).toBe('swiftwasm')
})

it('fetches windows 11 arm64 latest swift 6.0.0 tool', async () => {
setos({os: 'win32', dist: 'Windows', release: '10.0.26100'})
jest.spyOn(os, 'arch').mockReturnValue('arm64')
const ver6_0_0 = ToolchainVersion.create('6.0.0', false)
const tool = await Platform.toolchain(ver6_0_0)
expect(tool).toBeTruthy()
const wTool = tool as WindowsToolchainSnapshot
expect(wTool.download).toBe('swift-6.0-RELEASE-windows10-arm64.exe')
expect(wTool.dir).toBe('swift-6.0-RELEASE')
expect(wTool.platform).toBe('windows10-arm64')
expect(wTool.branch).toBe('swift-6.0-release')
expect(wTool.download_signature).toBe(
'swift-6.0-RELEASE-windows10-arm64.exe.sig'
)
expect(wTool.docker).toBe('6.0-windowsservercore-ltsc2022')
expect(wTool.preventCaching).toBe(false)
})
})
60 changes: 47 additions & 13 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/installer/windows/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class WindowsToolchainInstaller extends VerifyingToolchainInstaller<Windo
})

const vsComponents = [
`Microsoft.VisualStudio.Component.VC.Tools.${arch == 'aarch64' ? 'ARM64' : 'x86.x64'}`,
`Microsoft.VisualStudio.Component.VC.Tools.${arch == 'arm64' ? 'ARM64' : 'x86.x64'}`,
...providedComponents
]
if (!winsdkComponent) {
Expand Down
14 changes: 1 addition & 13 deletions src/platform/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,7 @@ declare module './base' {
}

Platform.currentPlatform = async () => {
let arch: string
switch (os.arch()) {
case 'x64':
arch = 'x86_64'
break
case 'arm64':
arch = 'aarch64'
break
default:
arch = os.arch()
break
}

const arch = os.arch()
const _os: getos.Os = await new Promise((resolve, reject) => {
getos((e, o) => {
if (e) {
Expand Down
18 changes: 18 additions & 0 deletions src/platform/linux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@
import {MODULE_DIR} from '../const'

export class LinuxPlatform extends VersionedPlatform<LinuxToolchainInstaller> {
constructor(
readonly name: string,
readonly version: number,
readonly arch: string
) {
switch (arch) {
case 'x64':
arch = 'x86_64'
break
case 'arm64':
arch = 'aarch64'
break
default:
break

Check warning on line 26 in src/platform/linux.ts

View check run for this annotation

Codecov / codecov/patch

src/platform/linux.ts#L25-L26

Added lines #L25 - L26 were not covered by tests
}
super(name, version, arch)
}

protected get downloadExtension() {
return 'tar.gz'
}
Expand Down
15 changes: 15 additions & 0 deletions src/platform/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ import {WindowsToolchainInstaller} from '../installer'
import {WindowsToolchainSnapshot, ToolchainSnapshot} from '../snapshot'

export class WindowsPlatform extends VersionedPlatform<WindowsToolchainInstaller> {
constructor(
readonly name: string,
readonly version: number,
readonly arch: string
) {
switch (arch) {
case 'x64':
arch = 'x86_64'
break
default:
break
}
super(name, version, arch)
}

protected get downloadExtension() {
return 'exe'
}
Expand Down
10 changes: 10 additions & 0 deletions src/platform/xcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@

export class XcodePlatform extends Platform<XcodeToolchainInstaller> {
constructor(readonly arch: string) {
switch (arch) {
case 'x64':
arch = 'x86_64'
break
case 'arm64':
arch = 'aarch64'
break
default:
break

Check warning on line 17 in src/platform/xcode.ts

View check run for this annotation

Codecov / codecov/patch

src/platform/xcode.ts#L16-L17

Added lines #L16 - L17 were not covered by tests
}
super()
}

Expand Down
1 change: 1 addition & 0 deletions src/snapshot/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ import {SignedToolchainSnapshot} from './signed'

export interface WindowsToolchainSnapshot extends SignedToolchainSnapshot {
readonly windows: boolean
readonly docker?: string
}
Loading