Skip to content
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

Restore support for Windows #676

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
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
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
swift: ["5.10"]
include:
- os: windows-latest
swift: "5.6.3"
steps:
- uses: actions/checkout@v4
- name: Setup Node
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/stability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ on:
- cron: '0 */12 * * *'

jobs:
v1:
name: "v1: Swift ${{ matrix.swift }} on ${{ matrix.os }}"
v2:
name: "v2: Swift ${{ matrix.swift }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
swift: ["5.10"]
steps:
- uses: swift-actions/setup-swift@v2
Expand All @@ -24,7 +24,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
swift: ["5.10"]
steps:
- uses: swift-actions/setup-swift@main
Expand Down
6 changes: 3 additions & 3 deletions src/gpg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export async function setupKeys() {
await refreshKeys();
}

export async function verify(signaturePath: string, packagePath: string) {
core.debug("Verifying signature");
await exec("gpg", ["--verify", signaturePath, packagePath]);
export async function verify(...paths: string[]) {
core.debug(`Verifying signature using ${paths.length} files`);
await exec("gpg", ["--verify", ...paths]);
}

export async function refreshKeys() {
Expand Down
2 changes: 1 addition & 1 deletion src/linux-install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function install(version: string, system: System) {
await setupKeys();

const swiftPkg = swiftPackage(version, system);
let { pkg, signature } = await download(swiftPkg);
const { pkg, signature } = await download(swiftPkg);

await verify(signature, pkg);

Expand Down
2 changes: 1 addition & 1 deletion src/swift-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as core from "@actions/core";
import { System, OS } from "./os";

const VERSIONS_LIST: [string, OS[]][] = [
["5.10", [OS.MacOS, OS.Ubuntu]],
["5.10", OS.all()],
["5.9.2", [OS.MacOS, OS.Ubuntu]],
["5.9.1", [OS.MacOS, OS.Ubuntu]],
["5.9", [OS.MacOS, OS.Ubuntu]],
Expand Down
15 changes: 7 additions & 8 deletions src/windows-install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ export async function install(version: string, system: System) {

await setupKeys();

let { exe, signature } = await download(swiftPkg);
await verify(signature, exe);
const { exe } = await download(swiftPkg);

// FIXME: It seems like Swift.org does not provide GPG signatures for Windows all builds.
//await verify(exe);

const exePath = await toolCache.cacheFile(
exe,
Expand Down Expand Up @@ -71,7 +73,7 @@ export async function install(version: string, system: System) {
path.join(swiftLibPath, "Swift-development", "bin"),
path.join(swiftLibPath, "icu-67", "usr", "bin"),
];
additionalPaths.forEach((value, index, array) => core.addPath(value));
additionalPaths.forEach((value) => core.addPath(value));

core.debug(`Swift installed at "${swiftInstallPath}"`);
await setupVsTools(swiftPkg);
Expand All @@ -80,11 +82,8 @@ export async function install(version: string, system: System) {
async function download({ url, name }: Package) {
core.debug("Downloading Swift for windows");

let [exe, signature] = await Promise.all([
toolCache.downloadTool(url),
toolCache.downloadTool(`${url}.sig`),
]);
const exe = await toolCache.downloadTool(url);

core.debug("Swift download complete");
return { exe, signature, name };
return { exe, name };
}
Loading