From c16c2cae5d77de332d390de162624535a50559ab Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Wed, 2 Apr 2025 11:35:03 -0400 Subject: [PATCH 01/10] Move E2E testing into GH action for Linux --- .github/workflows/pull_request.yml | 27 ++++++ Package.swift | 13 +++ Sources/TestSwiftly/TestSwiftly.swift | 85 +++++++++++++++++++ Tests/SwiftlyTests/E2ETests.swift | 65 -------------- .../BuildSwiftlyRelease.swift | 42 ++++++++- 5 files changed, 163 insertions(+), 69 deletions(-) create mode 100644 Sources/TestSwiftly/TestSwiftly.swift delete mode 100644 Tests/SwiftlyTests/E2ETests.swift diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 4a2aca0c..a9f2ca32 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -58,6 +58,33 @@ jobs: path: .build/release/swiftly-*.tar.gz if-no-files-found: error retention-days: 1 + - name: Upload Tests + uses: actions/upload-artifact@v4 + with: + name: swiftly-tests-x86_64 + path: .build/debug/test-swiftly-linux-x86_64.tar.gz + if-no-files-found: error + retention-days: 1 + + releasetest: + name: Test Release + needs: releasebuildcheck + runs-on: ubuntu-latest + container: + image: "ubuntu:24.04" + steps: + - name: Prepare System + run: apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install ca-certificates gpg tzdata + - name: Download Release + uses: actions/download-artifact@v4 + with: + name: swiftly-release-x86_64 + - name: Download Tests + uses: actions/download-artifact@v4 + with: + name: swiftly-tests-x86_64 + - name: Extract and Run Workflow Tests + run: cp swiftly-*.tar.gz /root/swiftly.tar.gz && cp test-swiftly-*.tar.gz /root && cd /root && tar zxf test-swiftly.tar.gz && ./test-swiftly -y ./swiftly.tar.gz formatcheck: name: Format Check diff --git a/Package.swift b/Package.swift index 2f6f918a..9b129f26 100644 --- a/Package.swift +++ b/Package.swift @@ -12,6 +12,10 @@ let package = Package( name: "swiftly", targets: ["Swiftly"] ), + .executable( + name: "test-swiftly", + targets: ["TestSwiftly"] + ), ], dependencies: [ .package(url: "https://github.com/apple/swift-argument-parser", from: "1.3.0"), @@ -36,6 +40,15 @@ let package = Package( .product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"), ] ), + .executableTarget( + name: "TestSwiftly", + dependencies: [ + .product(name: "ArgumentParser", package: "swift-argument-parser"), + .target(name: "SwiftlyCore"), + .target(name: "LinuxPlatform", condition: .when(platforms: [.linux])), + .target(name: "MacOSPlatform", condition: .when(platforms: [.macOS])), + ] + ), .target( name: "SwiftlyCore", dependencies: [ diff --git a/Sources/TestSwiftly/TestSwiftly.swift b/Sources/TestSwiftly/TestSwiftly.swift new file mode 100644 index 00000000..33fc9e4a --- /dev/null +++ b/Sources/TestSwiftly/TestSwiftly.swift @@ -0,0 +1,85 @@ +import ArgumentParser +import Foundation +import SwiftlyCore +import System + +#if os(Linux) +import LinuxPlatform +#elseif os(macOS) +import MacOSPlatform +#endif + +#if os(Linux) +let currentPlatform: Platform = Linux.currentPlatform +#elseif os(macOS) +let currentPlatform: Platform = MacOS.currentPlatform +#else +#error("Unsupported platform") +#endif + +@main +struct TestSwiftly: AsyncParsableCommand { + @Flag(name: [.customShort("y"), .long], help: "Disable confirmation prompts by assuming 'yes'") + var assumeYes: Bool = false + + @Argument var swiftlyArchive: String? = nil + + mutating func run() async throws { + if !self.assumeYes { + print("WARNING: This test will mutate your system to test the swiftly installation end-to-end. Please run this on a fresh system and try again with '--assume-yes'.") + Foundation.exit(2) + } + + guard let swiftlyArchive = self.swiftlyArchive else { + print("ERROR: You must provide a swiftly archive path for the test.") + Foundation.exit(2) + } + + print("Extracting swiftly release") +#if os(Linux) + try currentPlatform.runProgram("tar", "-zxvf", swiftlyArchive, quiet: false) +#elseif os(macOS) + try currentPlatform.runProgram("installer", "-pkg", swiftlyArchive, "-target", "CurrentUserHomeDirectory", quiet: false) +#endif + + print("Running 'swiftly init --assume-yes --verbose' to install swiftly and the latest toolchain") + +#if os(Linux) + let extractedSwiftly = "./swiftly" +#elseif os(macOS) + let extractedSwiftly = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent(".swiftly/bin/swiftly").path +#endif + + try currentPlatform.runProgram(extractedSwiftly, "init", "--assume-yes", quiet: false) + + let shell = try await currentPlatform.getShell() + + var env = ProcessInfo.processInfo.environment + + // Setting this environment helps to ensure that the profile gets sourced with bash, even if it is not in an interactive shell + if shell.hasSuffix("bash") { + env["BASH_ENV"] = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent(".profile").path + } else if shell.hasSuffix("zsh") { + env["ZDOTDIR"] = FileManager.default.homeDirectoryForCurrentUser.path + } else if shell.hasSuffix("fish") { + env["XDG_CONFIG_HOME"] = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent(".config").path + } + + try currentPlatform.runProgram(shell, "-l", "-c", "swiftly install --assume-yes latest --post-install-file=./post-install.sh", quiet: false, env: env) + + var swiftReady = false + + if NSUserName() == "root" && FileManager.default.fileExists(atPath: "./post-install.sh") { + try currentPlatform.runProgram(shell, "./post-install.sh", quiet: false) + swiftReady = true + } else if FileManager.default.fileExists(atPath: "./post-install.sh") { + print("WARNING: not running as root, so skipping the post installation steps and final swift verification.") + } else { + swiftReady = true + } + + if swiftReady { + try currentPlatform.runProgram(shell, "-l", "-c", "swift --version", quiet: false, env: env) + } + } +} diff --git a/Tests/SwiftlyTests/E2ETests.swift b/Tests/SwiftlyTests/E2ETests.swift deleted file mode 100644 index 36f86704..00000000 --- a/Tests/SwiftlyTests/E2ETests.swift +++ /dev/null @@ -1,65 +0,0 @@ -import Foundation -@testable import Swiftly -@testable import SwiftlyCore -import XCTest - -final class E2ETests: SwiftlyTests { - /// Tests that `swiftly init` and `swiftly install latest` successfully installs the latest stable release. - /// - /// This will modify the user's system, but will undo those changes afterwards. - func testInstallLatest() async throws { - try await self.rollbackLocalChanges { - // Clear out the config.json to proceed with the init - try? FileManager.default.removeItem(at: Swiftly.currentPlatform.swiftlyConfigFile) - - let shell = if let s = ProcessInfo.processInfo.environment["SHELL"] { - s - } else { - try await Swiftly.currentPlatform.getShell() - } - - var initCmd = try self.parseCommand(Init.self, ["init", "--assume-yes", "--no-modify-profile"]) - try await initCmd.run() - - var config = try Config.load() - - // Config now exists and is the correct version - XCTAssertEqual(SwiftlyCore.version, config.version) - - // Check the environment script, if the shell is supported - let envScript: URL? = if shell.hasSuffix("bash") || shell.hasSuffix("zsh") { - Swiftly.currentPlatform.swiftlyHomeDir.appendingPathComponent("env.sh") - } else if shell.hasSuffix("fish") { - Swiftly.currentPlatform.swiftlyHomeDir.appendingPathComponent("env.fish") - } else { - nil - } - - if let envScript { - XCTAssertTrue(envScript.fileExists()) - } - - var cmd = try self.parseCommand(Install.self, ["install", "latest", "--post-install-file=\(Swiftly.currentPlatform.getTempFilePath().path)"]) - try await cmd.run() - - config = try Config.load() - - guard !config.installedToolchains.isEmpty else { - XCTFail("expected to install latest main snapshot toolchain but installed toolchains is empty in the config") - return - } - - let installedToolchain = config.installedToolchains.first! - - guard case let .stable(release) = installedToolchain else { - XCTFail("expected swiftly install latest to install release toolchain but got \(installedToolchain)") - return - } - - // As of writing this, 5.8.0 is the latest stable release. Assert it is at least that new. - XCTAssertTrue(release >= ToolchainVersion.StableRelease(major: 5, minor: 8, patch: 0)) - - try await validateInstalledToolchains([installedToolchain], description: "install latest") - } - } -} diff --git a/Tools/build-swiftly-release/BuildSwiftlyRelease.swift b/Tools/build-swiftly-release/BuildSwiftlyRelease.swift index 70da86a7..5eb78f59 100644 --- a/Tools/build-swiftly-release/BuildSwiftlyRelease.swift +++ b/Tools/build-swiftly-release/BuildSwiftlyRelease.swift @@ -164,6 +164,9 @@ struct BuildSwiftlyRelease: AsyncParsableCommand { var useRhelUbi9: Bool = false #endif + @Flag(help: "Produce a swiftly-test.tar.gz that has a standalone test suite to test the released bundle.") + var test: Bool = false + @Argument(help: "Version of swiftly to build the release.") var version: String @@ -365,7 +368,6 @@ struct BuildSwiftlyRelease: AsyncParsableCommand { FileManager.default.changeCurrentDirectoryPath(cwd) try runProgram(swift, "build", "--swift-sdk", "\(arch)-swift-linux-musl", "--product=swiftly", "--pkg-config-path=\(pkgConfigPath)/lib/pkgconfig", "--static-swift-stdlib", "--configuration=release") - try runProgram(swift, "sdk", "remove", sdkName) let releaseDir = cwd + "/.build/release" @@ -383,6 +385,21 @@ struct BuildSwiftlyRelease: AsyncParsableCommand { try runProgram(tar, "--directory=\(releaseDir)", "-czf", releaseArchive, "swiftly", "LICENSE.txt") print(releaseArchive) + + if self.test { +#if arch(arm64) + let testArchive = "\(releaseDir)/test-swiftly-linux-aarch64.tar.gz" +#else + let testArchive = "\(releaseDir)/test-swiftly-linux-x86_64.tar.gz" +#endif + + try runProgram(swift, "build", "--swift-sdk", "\(arch)-swift-linux-musl", "--product=test-swiftly", "--pkg-config-path=\(pkgConfigPath)/lib/pkgconfig", "--static-swift-stdlib", "--configuration=release") + try runProgram(tar, "--directory=\(releaseDir)", "-czf", testArchive, "test-swiftly") + + print(testArchive) + } + + try runProgram(swift, "sdk", "remove", sdkName) } func buildMacOSRelease(cert: String?, identifier: String) async throws { @@ -397,6 +414,8 @@ struct BuildSwiftlyRelease: AsyncParsableCommand { let pkgbuild = try await self.assertTool("pkgbuild", message: "In order to make pkg installers there needs to be the `pkgbuild` tool that is installed on macOS.") let strip = try await self.assertTool("strip", message: "In order to strip binaries there needs to be the `strip` tool that is installed on macOS.") + let tar = try await self.assertTool("tar", message: "In order to produce archives there needs to be the `tar` tool that is installed on macOS.") + try runProgram(swift, "package", "clean") for arch in ["x86_64", "arm64"] { @@ -415,7 +434,8 @@ struct BuildSwiftlyRelease: AsyncParsableCommand { let cwd = FileManager.default.currentDirectoryPath - let pkgFile = URL(fileURLWithPath: cwd + "/.build/release/swiftly-\(self.version).pkg") + let releaseDir = URL(fileURLWithPath: cwd + "/.build/release") + let pkgFile = releaseDir.appendingPathComponent("/swiftly-\(self.version).pkg") if let cert { try runProgram( @@ -450,8 +470,8 @@ struct BuildSwiftlyRelease: AsyncParsableCommand { // Re-configure the pkg to prefer installs into the current user's home directory with the help of productbuild. // Note that command-line installs can override this preference, but the GUI install will limit the choices. - let pkgFileReconfigured = URL(fileURLWithPath: cwd + "/.build/release/swiftly-\(self.version)-reconfigured.pkg") - let distFile = URL(fileURLWithPath: cwd + "/.build/release/distribution.plist") + let pkgFileReconfigured = releaseDir.appendingPathComponent("swiftly-\(self.version)-reconfigured.pkg") + let distFile = releaseDir.appendingPathComponent("distribution.plist") try runProgram("productbuild", "--synthesize", "--package", pkgFile.path, distFile.path) @@ -466,5 +486,19 @@ struct BuildSwiftlyRelease: AsyncParsableCommand { } try FileManager.default.removeItem(at: pkgFile) try FileManager.default.copyItem(atPath: pkgFileReconfigured.path, toPath: pkgFile.path) + + print(pkgFile.path) + + if self.test { + for arch in ["x86_64", "arm64"] { + try runProgram(swift, "build", "--product=test-swiftly", "--configuration=release", "--arch=\(arch)") + try runProgram(strip, ".build/\(arch)-apple-macosx/release/swiftly") + } + + let testArchive = releaseDir.appendingPathComponent("test-swiftly-macos.tar.gz") + + try runProgram(lipo, ".build/x86_64-apple-macosx/release/test-swiftly", ".build/arm64-apple-macosx/release/test-swiftly", "-create", "-o", "\(swiftlyBinDir)/swiftly") + try runProgram(tar, "--directory=\(swiftlyBinDir)", "-czf", testArchive.path, "test-swiftly") + } } } From 08060faf547d60b1d4d6cd56c52d830ec84e799f Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Wed, 2 Apr 2025 11:50:35 -0400 Subject: [PATCH 02/10] Fix missing System package with Linux and add the --test option to the build swiftly release script --- .github/workflows/pull_request.yml | 2 +- Sources/TestSwiftly/TestSwiftly.swift | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index a9f2ca32..d2b35276 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -50,7 +50,7 @@ jobs: - name: Prepare the action run: ./scripts/prep-gh-action.sh --install-swiftly - name: Build Artifact - run: swift run build-swiftly-release --use-rhel-ubi9 --skip "999.0.0" + run: swift run build-swiftly-release --test --skip "999.0.0" - name: Upload Artifact uses: actions/upload-artifact@v4 with: diff --git a/Sources/TestSwiftly/TestSwiftly.swift b/Sources/TestSwiftly/TestSwiftly.swift index 33fc9e4a..bb72af65 100644 --- a/Sources/TestSwiftly/TestSwiftly.swift +++ b/Sources/TestSwiftly/TestSwiftly.swift @@ -1,7 +1,6 @@ import ArgumentParser import Foundation import SwiftlyCore -import System #if os(Linux) import LinuxPlatform From 0466127f23b3cbc28aeb1f6558f523ffe2904c9f Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Wed, 2 Apr 2025 12:02:57 -0400 Subject: [PATCH 03/10] Pick the correct path for the test-swiftly executable for upload --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index d2b35276..db582988 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -62,7 +62,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: swiftly-tests-x86_64 - path: .build/debug/test-swiftly-linux-x86_64.tar.gz + path: .build/release/test-swiftly-linux-x86_64.tar.gz if-no-files-found: error retention-days: 1 From 491d6fe7105a9660453d7ccfe9b5fe731885a5b1 Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Wed, 2 Apr 2025 13:03:09 -0400 Subject: [PATCH 04/10] Switch to debug for the test-swiftly tool --- .../BuildSwiftlyRelease.swift | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Tools/build-swiftly-release/BuildSwiftlyRelease.swift b/Tools/build-swiftly-release/BuildSwiftlyRelease.swift index 5eb78f59..4f7aa4c8 100644 --- a/Tools/build-swiftly-release/BuildSwiftlyRelease.swift +++ b/Tools/build-swiftly-release/BuildSwiftlyRelease.swift @@ -387,14 +387,16 @@ struct BuildSwiftlyRelease: AsyncParsableCommand { print(releaseArchive) if self.test { + let debugDir = cwd + "/.build/debug" + #if arch(arm64) - let testArchive = "\(releaseDir)/test-swiftly-linux-aarch64.tar.gz" + let testArchive = "\(debugDir)/test-swiftly-linux-aarch64.tar.gz" #else - let testArchive = "\(releaseDir)/test-swiftly-linux-x86_64.tar.gz" + let testArchive = "\(debugDir)/test-swiftly-linux-x86_64.tar.gz" #endif - try runProgram(swift, "build", "--swift-sdk", "\(arch)-swift-linux-musl", "--product=test-swiftly", "--pkg-config-path=\(pkgConfigPath)/lib/pkgconfig", "--static-swift-stdlib", "--configuration=release") - try runProgram(tar, "--directory=\(releaseDir)", "-czf", testArchive, "test-swiftly") + try runProgram(swift, "build", "--swift-sdk", "\(arch)-swift-linux-musl", "--product=test-swiftly", "--pkg-config-path=\(pkgConfigPath)/lib/pkgconfig", "--static-swift-stdlib", "--configuration=debug") + try runProgram(tar, "--directory=\(debugDir)", "-czf", testArchive, "test-swiftly") print(testArchive) } @@ -491,14 +493,16 @@ struct BuildSwiftlyRelease: AsyncParsableCommand { if self.test { for arch in ["x86_64", "arm64"] { - try runProgram(swift, "build", "--product=test-swiftly", "--configuration=release", "--arch=\(arch)") + try runProgram(swift, "build", "--product=test-swiftly", "--configuration=debug", "--arch=\(arch)") try runProgram(strip, ".build/\(arch)-apple-macosx/release/swiftly") } let testArchive = releaseDir.appendingPathComponent("test-swiftly-macos.tar.gz") - try runProgram(lipo, ".build/x86_64-apple-macosx/release/test-swiftly", ".build/arm64-apple-macosx/release/test-swiftly", "-create", "-o", "\(swiftlyBinDir)/swiftly") - try runProgram(tar, "--directory=\(swiftlyBinDir)", "-czf", testArchive.path, "test-swiftly") + try runProgram(lipo, ".build/x86_64-apple-macosx/debug/test-swiftly", ".build/arm64-apple-macosx/debug/test-swiftly", "-create", "-o", "\(swiftlyBinDir)/swiftly") + try runProgram(tar, "--directory=.build/x86_64-apple-macosx/debug", "-czf", testArchive.path, "test-swiftly") + + print(testArchive.path) } } } From 5c2e9d8f28dc6bf34501867cc50c4f5753009555 Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Wed, 2 Apr 2025 13:17:59 -0400 Subject: [PATCH 05/10] Fix upload artifact path in the GH workflow --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index db582988..d2b35276 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -62,7 +62,7 @@ jobs: uses: actions/upload-artifact@v4 with: name: swiftly-tests-x86_64 - path: .build/release/test-swiftly-linux-x86_64.tar.gz + path: .build/debug/test-swiftly-linux-x86_64.tar.gz if-no-files-found: error retention-days: 1 From d297b484edd1b7eafec4be2ee1cf5ecd545ff5ad Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Wed, 2 Apr 2025 13:39:06 -0400 Subject: [PATCH 06/10] Fix archive name when extracting test-swiftly --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index d2b35276..38526af9 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -84,7 +84,7 @@ jobs: with: name: swiftly-tests-x86_64 - name: Extract and Run Workflow Tests - run: cp swiftly-*.tar.gz /root/swiftly.tar.gz && cp test-swiftly-*.tar.gz /root && cd /root && tar zxf test-swiftly.tar.gz && ./test-swiftly -y ./swiftly.tar.gz + run: cp swiftly-*.tar.gz /root/swiftly.tar.gz && cp test-swiftly-*.tar.gz /root && cd /root && tar zxf test-swiftly-*.tar.gz && ./test-swiftly -y ./swiftly.tar.gz formatcheck: name: Format Check From 25a0dfabd143d330165fd2899014e01875e4e537 Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Wed, 2 Apr 2025 13:57:58 -0400 Subject: [PATCH 07/10] Add tests for zsh and fish --- .github/workflows/pull_request.yml | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 38526af9..814b8c92 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -86,6 +86,46 @@ jobs: - name: Extract and Run Workflow Tests run: cp swiftly-*.tar.gz /root/swiftly.tar.gz && cp test-swiftly-*.tar.gz /root && cd /root && tar zxf test-swiftly-*.tar.gz && ./test-swiftly -y ./swiftly.tar.gz + releasetestzsh: + name: Test Release ZSH + needs: releasebuildcheck + runs-on: ubuntu-latest + container: + image: "ubuntu:24.04" + steps: + - name: Prepare System + run: apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install ca-certificates gpg tzdata zsh && chsh -s /bin/zsh + - name: Download Release + uses: actions/download-artifact@v4 + with: + name: swiftly-release-x86_64 + - name: Download Tests + uses: actions/download-artifact@v4 + with: + name: swiftly-tests-x86_64 + - name: Extract and Run Workflow Tests + run: cp swiftly-*.tar.gz /root/swiftly.tar.gz && cp test-swiftly-*.tar.gz /root && cd /root && tar zxf test-swiftly-*.tar.gz && ./test-swiftly -y ./swiftly.tar.gz + + releasetestfish: + name: Test Release FISH + needs: releasebuildcheck + runs-on: ubuntu-latest + container: + image: "ubuntu:24.04" + steps: + - name: Prepare System + run: apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install ca-certificates gpg tzdata fish && chsh -s /bin/fish + - name: Download Release + uses: actions/download-artifact@v4 + with: + name: swiftly-release-x86_64 + - name: Download Tests + uses: actions/download-artifact@v4 + with: + name: swiftly-tests-x86_64 + - name: Extract and Run Workflow Tests + run: cp swiftly-*.tar.gz /root/swiftly.tar.gz && cp test-swiftly-*.tar.gz /root && cd /root && tar zxf test-swiftly-*.tar.gz && ./test-swiftly -y ./swiftly.tar.gz + formatcheck: name: Format Check runs-on: ubuntu-latest From d259458fb47ee4f8f5cd07dae6ad1a0c81f3dfb8 Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Wed, 2 Apr 2025 14:48:19 -0400 Subject: [PATCH 08/10] Defer installation until after init --- Sources/TestSwiftly/TestSwiftly.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/TestSwiftly/TestSwiftly.swift b/Sources/TestSwiftly/TestSwiftly.swift index bb72af65..fa967aa9 100644 --- a/Sources/TestSwiftly/TestSwiftly.swift +++ b/Sources/TestSwiftly/TestSwiftly.swift @@ -49,7 +49,7 @@ struct TestSwiftly: AsyncParsableCommand { let extractedSwiftly = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent(".swiftly/bin/swiftly").path #endif - try currentPlatform.runProgram(extractedSwiftly, "init", "--assume-yes", quiet: false) + try currentPlatform.runProgram(extractedSwiftly, "init", "--assume-yes", "--skip-install", quiet: false) let shell = try await currentPlatform.getShell() From 26bea4347e5bc9dee9b4bee7ea512cc88ff43259 Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Sun, 6 Apr 2025 08:04:02 -0400 Subject: [PATCH 09/10] Matrix the shells for the test release checks --- .github/workflows/pull_request.yml | 52 ++++++------------------------ 1 file changed, 10 insertions(+), 42 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 814b8c92..ad9de4bf 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -67,54 +67,22 @@ jobs: retention-days: 1 releasetest: - name: Test Release - needs: releasebuildcheck - runs-on: ubuntu-latest - container: - image: "ubuntu:24.04" - steps: - - name: Prepare System - run: apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install ca-certificates gpg tzdata - - name: Download Release - uses: actions/download-artifact@v4 - with: - name: swiftly-release-x86_64 - - name: Download Tests - uses: actions/download-artifact@v4 - with: - name: swiftly-tests-x86_64 - - name: Extract and Run Workflow Tests - run: cp swiftly-*.tar.gz /root/swiftly.tar.gz && cp test-swiftly-*.tar.gz /root && cd /root && tar zxf test-swiftly-*.tar.gz && ./test-swiftly -y ./swiftly.tar.gz - - releasetestzsh: - name: Test Release ZSH - needs: releasebuildcheck - runs-on: ubuntu-latest - container: - image: "ubuntu:24.04" - steps: - - name: Prepare System - run: apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install ca-certificates gpg tzdata zsh && chsh -s /bin/zsh - - name: Download Release - uses: actions/download-artifact@v4 - with: - name: swiftly-release-x86_64 - - name: Download Tests - uses: actions/download-artifact@v4 - with: - name: swiftly-tests-x86_64 - - name: Extract and Run Workflow Tests - run: cp swiftly-*.tar.gz /root/swiftly.tar.gz && cp test-swiftly-*.tar.gz /root && cd /root && tar zxf test-swiftly-*.tar.gz && ./test-swiftly -y ./swiftly.tar.gz - - releasetestfish: - name: Test Release FISH + name: Test Release / ${{matrix.shell-pkg}} needs: releasebuildcheck runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + shell: [ + {"shell-pkg": "bash", "shell-bin": "/bin/bash"}, + {"shell-pkg": "zsh", "shell-bin": "/bin/zsh"}, + {"shell-pkg": "fish", "shell-bin": "/bin/fish"} + ] container: image: "ubuntu:24.04" steps: - name: Prepare System - run: apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install ca-certificates gpg tzdata fish && chsh -s /bin/fish + run: apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install ca-certificates gpg tzdata ${{matrix.shell-pkg}} && chsh -s ${{matrix.shell-bin}} - name: Download Release uses: actions/download-artifact@v4 with: From 00bac01195dc849ea41d3d95533ed78b3c56dd91 Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Sun, 6 Apr 2025 08:19:58 -0400 Subject: [PATCH 10/10] Fix the matrix references --- .github/workflows/pull_request.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index ad9de4bf..22b18830 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -67,22 +67,22 @@ jobs: retention-days: 1 releasetest: - name: Test Release / ${{matrix.shell-pkg}} + name: Test Release / ${{matrix.shell.pkg}} needs: releasebuildcheck runs-on: ubuntu-latest strategy: fail-fast: false matrix: shell: [ - {"shell-pkg": "bash", "shell-bin": "/bin/bash"}, - {"shell-pkg": "zsh", "shell-bin": "/bin/zsh"}, - {"shell-pkg": "fish", "shell-bin": "/bin/fish"} + {"pkg": "bash", "bin": "/bin/bash"}, + {"pkg": "zsh", "bin": "/bin/zsh"}, + {"pkg": "fish", "bin": "/bin/fish"} ] container: image: "ubuntu:24.04" steps: - name: Prepare System - run: apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install ca-certificates gpg tzdata ${{matrix.shell-pkg}} && chsh -s ${{matrix.shell-bin}} + run: apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install ca-certificates gpg tzdata ${{matrix.shell.pkg}} && chsh -s ${{matrix.shell.bin}} - name: Download Release uses: actions/download-artifact@v4 with: