Skip to content
Draft
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
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest]
os:
[
ubuntu-latest,
ubuntu-24.04-arm,
macos-latest,
windows-latest,
windows-11-arm,
]
swift: ["6.1"]
steps:
- uses: actions/checkout@v4
Expand All @@ -36,6 +43,9 @@ jobs:
node-version-file: ".nvmrc"
- run: npm install
- run: npm run build && npm run pack-source-map
- name: Add msbuild to PATH
if: ${{ matrix.os == 'windows-latest' || matrix.os == 'windows-11-arm' }}
uses: microsoft/setup-msbuild@v2
- uses: ./
with:
swift-version: ${{ matrix.swift }}
Expand Down
41 changes: 40 additions & 1 deletion src/windows/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,44 @@ import { coerce } from "semver";
* Setup Swift on Windows as theres no support for Swiftly yet.
*/
export async function setupWindows(version: string) {
throw Error("Windows is not supported yet");
const path = await download(version);
addPath(path);
}

async function download(version: string) {
const m = machine();

let url: string;
if (m === "arm64") {
url = `https://download.swift.org/swift-${version}-release/windows10-arm64/swift-${version}-RELEASE/swift-${version}-RELEASE-windows10-arm64.exe`;
} else {
url = `https://download.swift.org/swift-${version}-release/windows10/swift-${version}-RELEASE/swift-${version}-RELEASE-windows10.exe`;
}

debug(`Downloading Swift installer from ${url}`);

const tmpPath = tempDir();

const installerPath = await downloadTool(
url,
join(tmpPath, "swift-installer.exe"),
);

const targetPath = join(tmpPath, "Swift");

await cmd(
installerPath,
"/passive",
"/quiet",
"/norestart",
`InstallRoot=${targetPath}`,
);

return join(
targetPath,
"Toolchains",
`${coerce(version)}+Asserts`,
"usr",
"bin",
);
}