From b9b37375c4e2c92466dd87a7aa8fdcb535725c38 Mon Sep 17 00:00:00 2001 From: Frederik Wallner Date: Wed, 3 Jul 2024 10:24:32 +0200 Subject: [PATCH 1/7] Test latest swift on latest windows --- .github/workflows/ci.yml | 5 +---- .github/workflows/stability.yml | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef45e0bd..2c923838 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/stability.yml b/.github/workflows/stability.yml index fb3b979d..6cbdc889 100644 --- a/.github/workflows/stability.yml +++ b/.github/workflows/stability.yml @@ -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 @@ -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 From dc3d8ce0469762d8c5fc65a76e84cfd03a1858cd Mon Sep 17 00:00:00 2001 From: Frederik Wallner Date: Wed, 3 Jul 2024 10:28:42 +0200 Subject: [PATCH 2/7] Whitelist 5.10 for windows --- src/swift-versions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/swift-versions.ts b/src/swift-versions.ts index 47aa35bd..e5ee5cc6 100644 --- a/src/swift-versions.ts +++ b/src/swift-versions.ts @@ -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]], From 7a4bf15d5df2451b1fbfff8b6fa55fab412f48b1 Mon Sep 17 00:00:00 2001 From: Frederik Wallner Date: Wed, 3 Jul 2024 10:51:24 +0200 Subject: [PATCH 3/7] Signature file seems to not be used for windows --- src/gpg.ts | 4 ++-- src/linux-install.ts | 2 +- src/windows-install.ts | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gpg.ts b/src/gpg.ts index 8a69ad87..173a0a20 100644 --- a/src/gpg.ts +++ b/src/gpg.ts @@ -15,9 +15,9 @@ export async function setupKeys() { await refreshKeys(); } -export async function verify(signaturePath: string, packagePath: string) { +export async function verify(...paths: string[]) { core.debug("Verifying signature"); - await exec("gpg", ["--verify", signaturePath, packagePath]); + await exec("gpg", ["--verify", ...paths]); } export async function refreshKeys() { diff --git a/src/linux-install.ts b/src/linux-install.ts index e57bf185..fa33045e 100644 --- a/src/linux-install.ts +++ b/src/linux-install.ts @@ -23,7 +23,7 @@ export async function install(version: string, system: System) { const swiftPkg = swiftPackage(version, system); let { pkg, signature } = await download(swiftPkg); - await verify(signature, pkg); + await verify(pkg, signature); swiftPath = await unpack(pkg, swiftPkg.name, version, system); } else { diff --git a/src/windows-install.ts b/src/windows-install.ts index 9e537697..fd0f50f3 100644 --- a/src/windows-install.ts +++ b/src/windows-install.ts @@ -23,8 +23,8 @@ export async function install(version: string, system: System) { await setupKeys(); - let { exe, signature } = await download(swiftPkg); - await verify(signature, exe); + let { exe } = await download(swiftPkg); + await verify(exe); const exePath = await toolCache.cacheFile( exe, @@ -80,11 +80,11 @@ 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([ + let [exe] = await Promise.all([ toolCache.downloadTool(url), toolCache.downloadTool(`${url}.sig`), ]); core.debug("Swift download complete"); - return { exe, signature, name }; + return { exe, name }; } From 59d4cb67bc0d7460a33a2ae1e7997e7168f9c4ff Mon Sep 17 00:00:00 2001 From: Frederik Wallner Date: Wed, 3 Jul 2024 10:55:56 +0200 Subject: [PATCH 4/7] Log file length --- src/gpg.ts | 2 +- src/linux-install.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gpg.ts b/src/gpg.ts index 173a0a20..0c870e9b 100644 --- a/src/gpg.ts +++ b/src/gpg.ts @@ -16,7 +16,7 @@ export async function setupKeys() { } export async function verify(...paths: string[]) { - core.debug("Verifying signature"); + core.debug(`Verifying signature using ${paths.length} files`); await exec("gpg", ["--verify", ...paths]); } diff --git a/src/linux-install.ts b/src/linux-install.ts index fa33045e..e1a87d1a 100644 --- a/src/linux-install.ts +++ b/src/linux-install.ts @@ -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(pkg, signature); From 391a573163d345e7d821df92f85270455b57f3a3 Mon Sep 17 00:00:00 2001 From: Frederik Wallner Date: Wed, 3 Jul 2024 10:59:23 +0200 Subject: [PATCH 5/7] Use correct order for signature --- src/linux-install.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linux-install.ts b/src/linux-install.ts index e1a87d1a..f481f4f9 100644 --- a/src/linux-install.ts +++ b/src/linux-install.ts @@ -23,7 +23,7 @@ export async function install(version: string, system: System) { const swiftPkg = swiftPackage(version, system); const { pkg, signature } = await download(swiftPkg); - await verify(pkg, signature); + await verify(signature, pkg); swiftPath = await unpack(pkg, swiftPkg.name, version, system); } else { From 57486f149c3c1b9de79bca78a52b31f1d1268ea5 Mon Sep 17 00:00:00 2001 From: Frederik Wallner Date: Wed, 3 Jul 2024 11:02:20 +0200 Subject: [PATCH 6/7] Don't try to download unused signature (facepalm) --- src/windows-install.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/windows-install.ts b/src/windows-install.ts index fd0f50f3..09543348 100644 --- a/src/windows-install.ts +++ b/src/windows-install.ts @@ -82,7 +82,6 @@ async function download({ url, name }: Package) { let [exe] = await Promise.all([ toolCache.downloadTool(url), - toolCache.downloadTool(`${url}.sig`), ]); core.debug("Swift download complete"); From 5efc47245f70486e8055d14d97a1c16b52a50b02 Mon Sep 17 00:00:00 2001 From: Frederik Wallner Date: Wed, 3 Jul 2024 11:07:59 +0200 Subject: [PATCH 7/7] Skip signature check on windows for now --- src/windows-install.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/windows-install.ts b/src/windows-install.ts index 09543348..c30d9d3f 100644 --- a/src/windows-install.ts +++ b/src/windows-install.ts @@ -23,8 +23,10 @@ export async function install(version: string, system: System) { await setupKeys(); - let { exe } = await download(swiftPkg); - await verify(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, @@ -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); @@ -80,9 +82,7 @@ export async function install(version: string, system: System) { async function download({ url, name }: Package) { core.debug("Downloading Swift for windows"); - let [exe] = await Promise.all([ - toolCache.downloadTool(url), - ]); + const exe = await toolCache.downloadTool(url); core.debug("Swift download complete"); return { exe, name };