From 7b0c5e14c89f2b779e9f8c584487aca9de5f47d0 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 09:14:11 -0500 Subject: [PATCH 01/46] Test with self-hosted swiftly --- .github/workflows/pull_request.yml | 20 ++++++++++++++++++++ .swift-version | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 52fc7760..ddd5b987 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -19,6 +19,26 @@ jobs: shell_check_enabled: false unacceptable_language_check_enabled: true + tests-selfhosted: + name: Test Self Hosted + runs-on: ubuntu-latest + strategy: + matrix: + container: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "redhat/ubi9", "debian:12", "fedora:39"] + container: + image: ${{ matrix.container }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install swiftly + run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init --skip-install + - name: Install selected swift toolchain + run: /root/.local/share/swiftly/bin/swiftly install --post-install=post-install.sh + - name: Perform swift toolchain post-installation + run: ./post-install.sh + - name: Build and Test + run: ./scripts/prep-gh-action.sh && ./scripts/install-libarchive.sh && /root/local/.share/swiftly/bin/swift test + tests: name: Test uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main diff --git a/.swift-version b/.swift-version index e0ea36fe..39c5d6a6 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -6.0 +6.0.3 \ No newline at end of file From 4c9810150cc786e2546bf48d11ffdb022f483ff4 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 09:16:44 -0500 Subject: [PATCH 02/46] Prepare the docker image before trying to install swiftly --- .github/workflows/pull_request.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index ddd5b987..afe7f9f6 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -30,6 +30,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Prepare image + run: ./scripts/prep-gh-action.sh - name: Install swiftly run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init --skip-install - name: Install selected swift toolchain @@ -37,7 +39,7 @@ jobs: - name: Perform swift toolchain post-installation run: ./post-install.sh - name: Build and Test - run: ./scripts/prep-gh-action.sh && ./scripts/install-libarchive.sh && /root/local/.share/swiftly/bin/swift test + run: ./scripts/install-libarchive.sh && /root/local/.share/swiftly/bin/swift test tests: name: Test From 8eef5a1f8c1a43f557dd63a2dc472bb94ef9e5c9 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 09:18:50 -0500 Subject: [PATCH 03/46] Hard code the architecture --- .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 afe7f9f6..f92ada52 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -33,7 +33,7 @@ jobs: - name: Prepare image run: ./scripts/prep-gh-action.sh - name: Install swiftly - run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init --skip-install + run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init --skip-install - name: Install selected swift toolchain run: /root/.local/share/swiftly/bin/swiftly install --post-install=post-install.sh - name: Perform swift toolchain post-installation From 13116b8d9c6a05d57bb587389832d98a2c9b7d33 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 09:20:24 -0500 Subject: [PATCH 04/46] Correct the swiftly install option --- .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 f92ada52..fe029c64 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -35,7 +35,7 @@ jobs: - name: Install swiftly run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init --skip-install - name: Install selected swift toolchain - run: /root/.local/share/swiftly/bin/swiftly install --post-install=post-install.sh + run: /root/.local/share/swiftly/bin/swiftly install --post-install-file=post-install.sh - name: Perform swift toolchain post-installation run: ./post-install.sh - name: Build and Test From 19b69839331dd604089a8252670bf645af6b30f3 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 09:21:51 -0500 Subject: [PATCH 05/46] Add gpg to the action prep script --- scripts/prep-gh-action.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/prep-gh-action.sh b/scripts/prep-gh-action.sh index c1306e39..969fb726 100755 --- a/scripts/prep-gh-action.sh +++ b/scripts/prep-gh-action.sh @@ -1,7 +1,7 @@ #!/bin/bash -apt-get --help && apt-get update && apt-get -y install curl make -yum --help && (curl --help && yum -y install curl) && yum install make +apt-get --help && apt-get update && apt-get -y install curl make gpg +yum --help && (curl --help && yum -y install curl) && yum install make gpg (cat /etc/os-release | grep bookworm) && apt-get -y install libstdc++-12-dev gnupg2 (cat /etc/os-release | grep 'Fedora Linux 39') && yum -y install libstdc++-devel libstdc++-static From 1aaf5a88565980b8715b37f36c708940eb2ec154 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 09:23:25 -0500 Subject: [PATCH 06/46] Remove Ubuntu 20.04 --- .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 fe029c64..b1340047 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - container: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "redhat/ubi9", "debian:12", "fedora:39"] + container: ["ubuntu:22.04", "ubuntu:24.04", "redhat/ubi9", "debian:12", "fedora:39"] container: image: ${{ matrix.container }} steps: From 1e48eddc71fd0f9ddb8f3d5a0bff18743489401c Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 09:37:23 -0500 Subject: [PATCH 07/46] chmod the post install script --- .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 b1340047..a78c4de5 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -37,7 +37,7 @@ jobs: - name: Install selected swift toolchain run: /root/.local/share/swiftly/bin/swiftly install --post-install-file=post-install.sh - name: Perform swift toolchain post-installation - run: ./post-install.sh + run: chmod u+x post-install.sh && ./post-install.sh - name: Build and Test run: ./scripts/install-libarchive.sh && /root/local/.share/swiftly/bin/swift test From 393d8427b2e75e699b137bd6831fddf6dc7e4f1d Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 09:42:14 -0500 Subject: [PATCH 08/46] Pre-configure tzdata package --- scripts/prep-gh-action.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prep-gh-action.sh b/scripts/prep-gh-action.sh index 969fb726..12e36c44 100755 --- a/scripts/prep-gh-action.sh +++ b/scripts/prep-gh-action.sh @@ -1,6 +1,6 @@ #!/bin/bash -apt-get --help && apt-get update && apt-get -y install curl make gpg +apt-get --help && apt-get update && TZ=Etc/UTC apt-get -y install curl make gpg tzdata yum --help && (curl --help && yum -y install curl) && yum install make gpg (cat /etc/os-release | grep bookworm) && apt-get -y install libstdc++-12-dev gnupg2 From e12bf8de4c0192c88449bfdf47c40ff266799d8a Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 09:46:18 -0500 Subject: [PATCH 09/46] Use swiftly to run the install libarchive script for the C compiler --- .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 a78c4de5..e19485fc 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -39,7 +39,7 @@ jobs: - name: Perform swift toolchain post-installation run: chmod u+x post-install.sh && ./post-install.sh - name: Build and Test - run: ./scripts/install-libarchive.sh && /root/local/.share/swiftly/bin/swift test + run: CC=clang /root/local/.share/swiftly/bin/swiftly run ./scripts/install-libarchive.sh && /root/local/.share/swiftly/bin/swift test tests: name: Test From 4fb93e1e3e4cbae5f84c47cebb1b62eec103b50a Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 09:48:05 -0500 Subject: [PATCH 10/46] Correct swiftly path --- .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 e19485fc..65667bfa 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -39,7 +39,7 @@ jobs: - name: Perform swift toolchain post-installation run: chmod u+x post-install.sh && ./post-install.sh - name: Build and Test - run: CC=clang /root/local/.share/swiftly/bin/swiftly run ./scripts/install-libarchive.sh && /root/local/.share/swiftly/bin/swift test + run: CC=clang ./swiftly run ./scripts/install-libarchive.sh && /root/local/.share/swiftly/bin/swift test tests: name: Test From 9771ba3f5fda3d9d4647520ed70568782236d9a9 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 09:50:26 -0500 Subject: [PATCH 11/46] Correct swiftly path --- .github/workflows/pull_request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 65667bfa..b7349ecf 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -33,13 +33,13 @@ jobs: - name: Prepare image run: ./scripts/prep-gh-action.sh - name: Install swiftly - run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init --skip-install + run: cd /root && curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init --skip-install - name: Install selected swift toolchain run: /root/.local/share/swiftly/bin/swiftly install --post-install-file=post-install.sh - name: Perform swift toolchain post-installation run: chmod u+x post-install.sh && ./post-install.sh - name: Build and Test - run: CC=clang ./swiftly run ./scripts/install-libarchive.sh && /root/local/.share/swiftly/bin/swift test + run: CC=clang /root/.local/share/swiftly/bin/swiftly run ./scripts/install-libarchive.sh && /root/local/.share/swiftly/bin/swift test tests: name: Test From 8fc1a8667c77b293542e0c3e00b90811efe5163a Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 09:55:38 -0500 Subject: [PATCH 12/46] Correct path to swift --- .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 b7349ecf..f148da27 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -39,7 +39,7 @@ jobs: - name: Perform swift toolchain post-installation run: chmod u+x post-install.sh && ./post-install.sh - name: Build and Test - run: CC=clang /root/.local/share/swiftly/bin/swiftly run ./scripts/install-libarchive.sh && /root/local/.share/swiftly/bin/swift test + run: CC=clang /root/.local/share/swiftly/bin/swiftly run ./scripts/install-libarchive.sh && /root/.local/share/swiftly/bin/swift test tests: name: Test From 29ae892529444c5aefa3a7ca40821ae5be5494ff Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 11:51:26 -0500 Subject: [PATCH 13/46] Disable fail fast, and run tests outside of proxy --- .github/workflows/pull_request.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index f148da27..f37598fe 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -23,6 +23,7 @@ jobs: name: Test Self Hosted runs-on: ubuntu-latest strategy: + fail-fast: false matrix: container: ["ubuntu:22.04", "ubuntu:24.04", "redhat/ubi9", "debian:12", "fedora:39"] container: @@ -39,7 +40,7 @@ jobs: - name: Perform swift toolchain post-installation run: chmod u+x post-install.sh && ./post-install.sh - name: Build and Test - run: CC=clang /root/.local/share/swiftly/bin/swiftly run ./scripts/install-libarchive.sh && /root/.local/share/swiftly/bin/swift test + run: CC=clang /root/.local/share/swiftly/bin/swiftly run ./scripts/install-libarchive.sh && /root/.local/share/swiftly/bin/swiftly run swift test tests: name: Test From 13323a9c8072549646f7926afc3b251f77ed478b Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 13:00:29 -0500 Subject: [PATCH 14/46] Move proxy circularity check out of swiftly run --- Sources/Swiftly/Proxy.swift | 8 +++++++- Sources/SwiftlyCore/Platform.swift | 14 ++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Sources/Swiftly/Proxy.swift b/Sources/Swiftly/Proxy.swift index 72b642c2..cc208389 100644 --- a/Sources/Swiftly/Proxy.swift +++ b/Sources/Swiftly/Proxy.swift @@ -56,7 +56,13 @@ public enum Proxy { throw Error(message: "No swift toolchain could be selected from either from a .swift-version file, or the default. You can try using `swiftly install ` to install one.") } - try await Swiftly.currentPlatform.proxy(toolchain, binName, Array(CommandLine.arguments[1...])) + // Prevent circularities with a memento environment variable + guard ProcessInfo.processInfo.environment["SWIFTLY_PROXY_IN_PROGRESS"] == nil else { + throw Error(message: "Circular swiftly proxy invocation") + } + let env = ["SWIFTLY_PROXY_IN_PROGRESS": "1"] + + try await Swiftly.currentPlatform.proxy(toolchain, binName, Array(CommandLine.arguments[1...]), env) } catch let terminated as RunProgramError { exit(terminated.exitCode) } catch let error as Error { diff --git a/Sources/SwiftlyCore/Platform.swift b/Sources/SwiftlyCore/Platform.swift index a82b4ad2..780afe18 100644 --- a/Sources/SwiftlyCore/Platform.swift +++ b/Sources/SwiftlyCore/Platform.swift @@ -143,12 +143,6 @@ extension Platform { let tcPath = self.findToolchainLocation(toolchain).appendingPathComponent("usr/bin") var newEnv = ProcessInfo.processInfo.environment - // Prevent circularities with a memento environment variable - guard newEnv["SWIFTLY_PROXY_IN_PROGRESS"] == nil else { - throw Error(message: "Circular swiftly proxy invocation") - } - newEnv["SWIFTLY_PROXY_IN_PROGRESS"] = "1" - // The toolchain goes to the beginning of the PATH var newPath = newEnv["PATH"] ?? "" if !newPath.hasPrefix(tcPath.path + ":") { @@ -164,8 +158,12 @@ extension Platform { /// In the case where the command exit with a non-zero exit code a RunProgramError is thrown with /// the exit code and program information. /// - public func proxy(_ toolchain: ToolchainVersion, _ command: String, _ arguments: [String]) async throws { - try self.runProgram([command] + arguments, env: self.proxyEnv(toolchain)) + public func proxy(_ toolchain: ToolchainVersion, _ command: String, _ arguments: [String], _ env: [String: String] = [:]) async throws { + var newEnv = try self.proxyEnv(toolchain) + for (key, value) in env { + newEnv[key] = value + } + try self.runProgram([command] + arguments, env: newEnv) } /// Proxy the invocation of the provided command to the chosen toolchain and capture the output. From 4c77cc65f9031089e133eb4c6c48d0dc1f2438c4 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 13:18:10 -0500 Subject: [PATCH 15/46] Reduce tests to just jammy, and rely on swiftly being added to the path --- .github/workflows/pull_request.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index f37598fe..cba81f48 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -36,17 +36,17 @@ jobs: - name: Install swiftly run: cd /root && curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init --skip-install - name: Install selected swift toolchain - run: /root/.local/share/swiftly/bin/swiftly install --post-install-file=post-install.sh + run: swiftly install --post-install-file=post-install.sh - name: Perform swift toolchain post-installation run: chmod u+x post-install.sh && ./post-install.sh - name: Build and Test - run: CC=clang /root/.local/share/swiftly/bin/swiftly run ./scripts/install-libarchive.sh && /root/.local/share/swiftly/bin/swiftly run swift test + run: CC=clang swiftly run ./scripts/install-libarchive.sh && swift test tests: name: Test uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main with: - linux_os_versions: "[\"jammy\", \"focal\", \"rhel-ubi9\", \"noble\", \"bookworm\", \"fedora39\"]" + linux_os_versions: "[\"jammy\"]" # We only care about the current stable release, because that's where we make our swiftly releases linux_exclude_swift_versions: "[{\"swift_version\": \"nightly-main\"},{\"swift_version\": \"nightly-6.0\"},{\"swift_version\": \"5.8\"},{\"swift_version\": \"5.9\"},{\"swift_version\": \"5.10\"}]" linux_pre_build_command: ./scripts/prep-gh-action.sh && ./scripts/install-libarchive.sh From c558f768da83c7cc1c7d92df4e380abff4c3041e Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 13:23:23 -0500 Subject: [PATCH 16/46] Move swiftly to be a system binary to be on the path --- .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 cba81f48..bcbeba10 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -34,7 +34,7 @@ jobs: - name: Prepare image run: ./scripts/prep-gh-action.sh - name: Install swiftly - run: cd /root && curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init --skip-install + run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init --skip-install - name: Install selected swift toolchain run: swiftly install --post-install-file=post-install.sh - name: Perform swift toolchain post-installation From 342de1226663ecc0c2df7027c976d865e585b6b8 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 13:26:43 -0500 Subject: [PATCH 17/46] Try and get swiftly into the shell environment --- .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 bcbeba10..8c76dfae 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -34,7 +34,7 @@ jobs: - name: Prepare image run: ./scripts/prep-gh-action.sh - name: Install swiftly - run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init --skip-install + run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init --skip-install && . "/root/.local/share/swiftly/env.sh" && hash -r - name: Install selected swift toolchain run: swiftly install --post-install-file=post-install.sh - name: Perform swift toolchain post-installation From 2ce77acf680b3f3e61589ef55a4d983926f4707a Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 13:29:43 -0500 Subject: [PATCH 18/46] Add assume-yes to the swiftly init and use swiftly run to set PATH --- .github/workflows/pull_request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 8c76dfae..b97ddb86 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -34,13 +34,13 @@ jobs: - name: Prepare image run: ./scripts/prep-gh-action.sh - name: Install swiftly - run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init --skip-install && . "/root/.local/share/swiftly/env.sh" && hash -r + run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init -y --skip-install - name: Install selected swift toolchain run: swiftly install --post-install-file=post-install.sh - name: Perform swift toolchain post-installation run: chmod u+x post-install.sh && ./post-install.sh - name: Build and Test - run: CC=clang swiftly run ./scripts/install-libarchive.sh && swift test + run: CC=clang swiftly run ./scripts/install-libarchive.sh && swiftly run swift test tests: name: Test From b03507af8618330c01fd958800b1b128f96aba88 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 13:46:42 -0500 Subject: [PATCH 19/46] Update the path for subsequent worklow steps --- .github/workflows/pull_request.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index b97ddb86..90cc112c 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -34,13 +34,13 @@ jobs: - name: Prepare image run: ./scripts/prep-gh-action.sh - name: Install swiftly - run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init -y --skip-install + run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init -y --skip-install && . /root/.local/share/swiftly/env.sh && echo "PATH=$PATH" >> "$GITHUB_ENV" - name: Install selected swift toolchain - run: swiftly install --post-install-file=post-install.sh + run: swiftly install --post-install-file=post-install.sh && swift --version - name: Perform swift toolchain post-installation run: chmod u+x post-install.sh && ./post-install.sh - name: Build and Test - run: CC=clang swiftly run ./scripts/install-libarchive.sh && swiftly run swift test + run: CC=clang swiftly run ./scripts/install-libarchive.sh && swift test tests: name: Test From d3e1329698ccce685cef3d18221ec21422f772e0 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 13:48:59 -0500 Subject: [PATCH 20/46] Another attempt at updating the path for subsequent steps --- .github/workflows/pull_request.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 90cc112c..5b47a766 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -34,11 +34,13 @@ jobs: - name: Prepare image run: ./scripts/prep-gh-action.sh - name: Install swiftly - run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init -y --skip-install && . /root/.local/share/swiftly/env.sh && echo "PATH=$PATH" >> "$GITHUB_ENV" + run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init -y --skip-install && . /root/.local/share/swiftly/env.sh && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "PATH=$PATH" "$GITHUB_ENV" - name: Install selected swift toolchain - run: swiftly install --post-install-file=post-install.sh && swift --version + run: swiftly install --post-install-file=post-install.sh - name: Perform swift toolchain post-installation run: chmod u+x post-install.sh && ./post-install.sh + - name: Display swift version + run: swift --version - name: Build and Test run: CC=clang swiftly run ./scripts/install-libarchive.sh && swift test From fb1d088a1e5ee8bed9e32a140770b2dd6bca794e Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 13:52:19 -0500 Subject: [PATCH 21/46] Add more detailed environment info --- .github/workflows/pull_request.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 5b47a766..c4f4a76a 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -34,7 +34,9 @@ jobs: - name: Prepare image run: ./scripts/prep-gh-action.sh - name: Install swiftly - run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init -y --skip-install && . /root/.local/share/swiftly/env.sh && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "PATH=$PATH" "$GITHUB_ENV" + run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init -y --skip-install + - name: Update environment + run: . "/root/.local/share/swiftly/env.sh" && echo "GITHUB_ENV=$GITHUB_ENV" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "PATH=$PATH" "$GITHUB_ENV" - name: Install selected swift toolchain run: swiftly install --post-install-file=post-install.sh - name: Perform swift toolchain post-installation From 03845efaa0d3b55088ccfb226e03ca147e45200e Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 13:53:50 -0500 Subject: [PATCH 22/46] Show environment file --- .github/workflows/pull_request.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c4f4a76a..4775d8ae 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -35,6 +35,8 @@ jobs: run: ./scripts/prep-gh-action.sh - name: Install swiftly run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init -y --skip-install + - name: Show environment + run: cat "/root/.local/share/swiftly/env.sh" - name: Update environment run: . "/root/.local/share/swiftly/env.sh" && echo "GITHUB_ENV=$GITHUB_ENV" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "PATH=$PATH" "$GITHUB_ENV" - name: Install selected swift toolchain From d881d8305bb1ddf8861f2a6ce811eea7ca772070 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 13:57:26 -0500 Subject: [PATCH 23/46] Display the shell that is in use --- .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 4775d8ae..87bdb979 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -36,7 +36,7 @@ jobs: - name: Install swiftly run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init -y --skip-install - name: Show environment - run: cat "/root/.local/share/swiftly/env.sh" + run: cat "/root/.local/share/swiftly/env.sh" && echo "SHELL is $SHELL" - name: Update environment run: . "/root/.local/share/swiftly/env.sh" && echo "GITHUB_ENV=$GITHUB_ENV" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "PATH=$PATH" "$GITHUB_ENV" - name: Install selected swift toolchain From fb75fdb92efcf5bf8f30ed0b3d861ca96e6a9154 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 14:00:33 -0500 Subject: [PATCH 24/46] Force bash shell when updating the environment --- .github/workflows/pull_request.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 87bdb979..dbd8d3cb 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -35,10 +35,8 @@ jobs: run: ./scripts/prep-gh-action.sh - name: Install swiftly run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init -y --skip-install - - name: Show environment - run: cat "/root/.local/share/swiftly/env.sh" && echo "SHELL is $SHELL" - name: Update environment - run: . "/root/.local/share/swiftly/env.sh" && echo "GITHUB_ENV=$GITHUB_ENV" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "PATH=$PATH" "$GITHUB_ENV" + run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "GITHUB_ENV=$GITHUB_ENV" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "PATH=$PATH" "$GITHUB_ENV"' - name: Install selected swift toolchain run: swiftly install --post-install-file=post-install.sh - name: Perform swift toolchain post-installation From a659f48e79dc57d366cfbdb22ef63b2b268293d0 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 14:05:58 -0500 Subject: [PATCH 25/46] Remove extra echo statements and update all swiftly environment variables for the job --- .github/workflows/pull_request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index dbd8d3cb..4772c808 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -34,9 +34,9 @@ jobs: - name: Prepare image run: ./scripts/prep-gh-action.sh - name: Install swiftly - run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && mv swiftly /usr/bin && swiftly init -y --skip-install + run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install - name: Update environment - run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "GITHUB_ENV=$GITHUB_ENV" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "PATH=$PATH" "$GITHUB_ENV"' + run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' - name: Install selected swift toolchain run: swiftly install --post-install-file=post-install.sh - name: Perform swift toolchain post-installation From 38b5a40640b73ade09c735f1581bbcd02cc65b35 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 14:12:00 -0500 Subject: [PATCH 26/46] Extract swiftly bootstrap version and arch out of the job steps --- .github/workflows/pull_request.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 4772c808..ef507f62 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -6,6 +6,9 @@ on: push: branches: [main] +env: + SWIFTLY_BOOTSTRAP_VERSION: 0.4.0-dev + jobs: soundness: name: Soundness @@ -34,7 +37,7 @@ jobs: - name: Prepare image run: ./scripts/prep-gh-action.sh - name: Install swiftly - run: curl -O https://download.swift.org/swiftly/linux/swiftly-0.4.0-dev-x86_64.tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install + run: bash -c 'curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install - name: Update environment run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' - name: Install selected swift toolchain From e76ad1d90fcba724afef4e85a718173944d175d4 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 14:13:00 -0500 Subject: [PATCH 27/46] Missing quote --- .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 ef507f62..7cbcc4f5 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -37,7 +37,7 @@ jobs: - name: Prepare image run: ./scripts/prep-gh-action.sh - name: Install swiftly - run: bash -c 'curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install + run: bash -c 'curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install' - name: Update environment run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' - name: Install selected swift toolchain From 5c7be85caa2cc65c05bd2086d5f3a5a5dffaa11d Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 16:02:21 -0500 Subject: [PATCH 28/46] Convert jobs to bootstrap with swiftly --- .github/workflows/build_release.yml | 17 +++++++- .github/workflows/pull_request.yml | 60 ++++++++++++++++++++++------- 2 files changed, 63 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 654158bd..d2064fef 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -14,15 +14,30 @@ on: type: string default: "--skip" +env: + SWIFTLY_BOOTSTRAP_VERSION: 0.4.0-dev + jobs: buildrelease: name: Build Release runs-on: ubuntu-latest container: - image: "swift:6.0-rhel-ubi9" + image: "redhat/ubi9" steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Prepare the action + run: ./scripts/prep-gh-action.sh + - name: Install swiftly + run: bash -c 'curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install' + - name: Update environment + run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' + - name: Install selected swift toolchain + run: swiftly install --post-install-file=post-install.sh + - name: Perform swift toolchain post-installation + run: chmod u+x post-install.sh && ./post-install.sh + - name: Display swift version + run: swift --version - name: Build Release Artifact run: swift run build-swiftly-release --use-rhel-ubi9 ${{ inputs.skip }} ${{ inputs.version }} - name: Upload Release Artifact diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 7cbcc4f5..593043d5 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -23,7 +23,7 @@ jobs: unacceptable_language_check_enabled: true tests-selfhosted: - name: Test Self Hosted + name: Test (Self Hosted) - ${{ matrix.container }} runs-on: ubuntu-latest strategy: fail-fast: false @@ -34,7 +34,7 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Prepare image + - name: Prepare the action run: ./scripts/prep-gh-action.sh - name: Install swiftly run: bash -c 'curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install' @@ -63,10 +63,22 @@ jobs: name: Release Build Check runs-on: ubuntu-latest container: - image: "swift:6.0-rhel-ubi9" + image: "redhat/ubi9" steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Prepare the action + run: ./scripts/prep-gh-action.sh + - name: Install swiftly + run: bash -c 'curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install' + - name: Update environment + run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' + - name: Install selected swift toolchain + run: swiftly install --post-install-file=post-install.sh + - name: Perform swift toolchain post-installation + run: chmod u+x post-install.sh && ./post-install.sh + - name: Display swift version + run: swift --version - name: Build Artifact run: swift run build-swiftly-release --use-rhel-ubi9 --skip "999.0.0" - name: Upload Artifact @@ -79,25 +91,47 @@ jobs: formatcheck: name: Format Check - uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main - with: - # We only need to run this with one swift release and on one of the linux distributions - linux_os_versions: "[\"jammy\"]" - linux_exclude_swift_versions: "[{\"swift_version\": \"nightly-main\"},{\"swift_version\": \"nightly-6.0\"},{\"swift_version\": \"5.8\"},{\"swift_version\": \"5.9\"},{\"swift_version\": \"5.10\"}]" - linux_pre_build_command: ./scripts/prep-gh-action.sh - linux_build_command: swift run swiftformat --lint --dryrun . || (echo "Please run 'swift run swiftformat .' to format the source code."; exit 1) - enable_windows_checks: false + runs-on: ubuntu-latest + container: + image: ubuntu:22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Prepare the action + run: ./scripts/prep-gh-action.sh + - name: Install swiftly + run: bash -c 'curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install' + - name: Update environment + run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' + - name: Install selected swift toolchain + run: swiftly install --post-install-file=post-install.sh + - name: Perform swift toolchain post-installation + run: chmod u+x post-install.sh && ./post-install.sh + - name: Display swift version + run: swift --version + - name: Check format + run: swift run swiftformat --lint --dryrun . || (echo "Please run 'swift run swiftformat .' to format the source code."; exit 1) docscheck: name: Documentation Check runs-on: ubuntu-latest container: - image: "swift:6.0-noble" + image: ubuntu:22.04 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Prepare the action - run: ./scripts/prep-gh-action.sh && ./scripts/install-libarchive.sh + run: ./scripts/prep-gh-action.sh + - name: Install swiftly + run: bash -c 'curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install' + - name: Update environment + run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' + - name: Install selected swift toolchain + run: swiftly install --post-install-file=post-install.sh + - name: Perform swift toolchain post-installation + run: chmod u+x post-install.sh && ./post-install.sh + - name: Display swift version + run: swift --version - name: Generate Swiftly CLI Reference and Check for Differences run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && git config --global --add safe.directory $(pwd) && git diff --exit-code Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run 'swift package plugin generate-docs-reference' and commit/push the changes."; exit 1) - name: Generate Documentation Set From 40d2eef4265787a6df6b370731cc20fd7cd545b3 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 16:09:00 -0500 Subject: [PATCH 29/46] Install libarchive before documentation check --- .github/workflows/pull_request.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 593043d5..ea0d0f0a 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -132,6 +132,8 @@ jobs: run: chmod u+x post-install.sh && ./post-install.sh - name: Display swift version run: swift --version + - name: Install libarchive + run: CC=clang swiftly run ./scripts/install-libarchive.sh - name: Generate Swiftly CLI Reference and Check for Differences run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && git config --global --add safe.directory $(pwd) && git diff --exit-code Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run 'swift package plugin generate-docs-reference' and commit/push the changes."; exit 1) - name: Generate Documentation Set From b4431a866760d6bc0f0e95842f08e82b2ebdb9a4 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 18:09:38 -0500 Subject: [PATCH 30/46] Update documentation check to a newer ubuntu --- .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 ea0d0f0a..4e85bef7 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -116,7 +116,7 @@ jobs: name: Documentation Check runs-on: ubuntu-latest container: - image: ubuntu:22.04 + image: ubuntu:24.04 steps: - name: Checkout repository uses: actions/checkout@v4 From 02ef1a84ec2d0c57af149213b6e9401a572b0ac4 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 18:18:25 -0500 Subject: [PATCH 31/46] Fix cli reference check --- .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 4e85bef7..62a9737c 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -135,7 +135,7 @@ jobs: - name: Install libarchive run: CC=clang swiftly run ./scripts/install-libarchive.sh - name: Generate Swiftly CLI Reference and Check for Differences - run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && git config --global --add safe.directory $(pwd) && git diff --exit-code Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run 'swift package plugin generate-docs-reference' and commit/push the changes."; exit 1) + run: bash -c 'swift package plugin --allow-writing-to-package-directory generate-docs-reference && git config --global --add safe.directory $(pwd) && git diff --exit-code Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run swift package plugin generate-docs-reference and commit/push the changes."; exit 1)' - name: Generate Documentation Set run: swift package --allow-writing-to-directory .build/docs generate-documentation --target SwiftlyDocs --output-path .build/docs - name: Upload Documentation Artifacts From 1a04f8a4f305572d5f32f199a05b36960b48844a Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 18:21:28 -0500 Subject: [PATCH 32/46] Fix quoting problem --- .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 62a9737c..1a66c547 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -135,7 +135,7 @@ jobs: - name: Install libarchive run: CC=clang swiftly run ./scripts/install-libarchive.sh - name: Generate Swiftly CLI Reference and Check for Differences - run: bash -c 'swift package plugin --allow-writing-to-package-directory generate-docs-reference && git config --global --add safe.directory $(pwd) && git diff --exit-code Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run swift package plugin generate-docs-reference and commit/push the changes."; exit 1)' + run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && bash -c 'git config --global --add safe.directory $(pwd)' && git diff --exit-code Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run `swift package plugin generate-docs-reference` and commit/push the changes."; exit 1) - name: Generate Documentation Set run: swift package --allow-writing-to-directory .build/docs generate-documentation --target SwiftlyDocs --output-path .build/docs - name: Upload Documentation Artifacts From 129055dd7df146ebc5f3a735f9fc19b4e904c318 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 18:52:40 -0500 Subject: [PATCH 33/46] Capture more details --- .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 1a66c547..490a45d6 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -135,7 +135,7 @@ jobs: - name: Install libarchive run: CC=clang swiftly run ./scripts/install-libarchive.sh - name: Generate Swiftly CLI Reference and Check for Differences - run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && bash -c 'git config --global --add safe.directory $(pwd)' && git diff --exit-code Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run `swift package plugin generate-docs-reference` and commit/push the changes."; exit 1) + run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && bash -c 'echo "PWD: $(pwd)"; git config --global --add safe.directory $(pwd)' && git diff Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run `swift package plugin generate-docs-reference` and commit/push the changes."; exit 1) - name: Generate Documentation Set run: swift package --allow-writing-to-directory .build/docs generate-documentation --target SwiftlyDocs --output-path .build/docs - name: Upload Documentation Artifacts From b65571f36ec11e7bf956f308ba378759df0bd7a4 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 18:55:02 -0500 Subject: [PATCH 34/46] Capture more details --- .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 490a45d6..ed8b0f9d 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -135,7 +135,7 @@ jobs: - name: Install libarchive run: CC=clang swiftly run ./scripts/install-libarchive.sh - name: Generate Swiftly CLI Reference and Check for Differences - run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && bash -c 'echo "PWD: $(pwd)"; git config --global --add safe.directory $(pwd)' && git diff Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run `swift package plugin generate-docs-reference` and commit/push the changes."; exit 1) + run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && git diff Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run `swift package plugin generate-docs-reference` and commit/push the changes."; exit 1) - name: Generate Documentation Set run: swift package --allow-writing-to-directory .build/docs generate-documentation --target SwiftlyDocs --output-path .build/docs - name: Upload Documentation Artifacts From 5d6764d3c1ae53e1c99ca55841225ab74ceac2fe Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 19:02:29 -0500 Subject: [PATCH 35/46] Capture more details --- .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 ed8b0f9d..162e50f2 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -135,7 +135,7 @@ jobs: - name: Install libarchive run: CC=clang swiftly run ./scripts/install-libarchive.sh - name: Generate Swiftly CLI Reference and Check for Differences - run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && git diff Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run `swift package plugin generate-docs-reference` and commit/push the changes."; exit 1) + run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && bash -c 'echo "PWD is $(pwd)"' && bash -c 'git config --global --add safe.directory $(pwd)' && git diff Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run `swift package plugin generate-docs-reference` and commit/push the changes."; exit 1) - name: Generate Documentation Set run: swift package --allow-writing-to-directory .build/docs generate-documentation --target SwiftlyDocs --output-path .build/docs - name: Upload Documentation Artifacts From f9d0594509cf740709aa5908295654b72fbfad7a Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 19:08:47 -0500 Subject: [PATCH 36/46] Pre-install git so that the checkout clones the repo instead of using REST to fetch it --- .github/workflows/pull_request.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 162e50f2..98f719c6 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -118,6 +118,8 @@ jobs: container: image: ubuntu:24.04 steps: + - name: Install git + run: apt-get update && apt-get -y install git - name: Checkout repository uses: actions/checkout@v4 - name: Prepare the action @@ -135,7 +137,7 @@ jobs: - name: Install libarchive run: CC=clang swiftly run ./scripts/install-libarchive.sh - name: Generate Swiftly CLI Reference and Check for Differences - run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && bash -c 'echo "PWD is $(pwd)"' && bash -c 'git config --global --add safe.directory $(pwd)' && git diff Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run `swift package plugin generate-docs-reference` and commit/push the changes."; exit 1) + run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && bash -c 'git config --global --add safe.directory $(pwd)' && git diff Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run `swift package plugin generate-docs-reference` and commit/push the changes."; exit 1) - name: Generate Documentation Set run: swift package --allow-writing-to-directory .build/docs generate-documentation --target SwiftlyDocs --output-path .build/docs - name: Upload Documentation Artifacts From 765e2804e135e44a31e2656e80186ff06d998b52 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 19:13:23 -0500 Subject: [PATCH 37/46] Re-add the exit code option to the git diff --- .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 98f719c6..b0c9fc58 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -137,7 +137,7 @@ jobs: - name: Install libarchive run: CC=clang swiftly run ./scripts/install-libarchive.sh - name: Generate Swiftly CLI Reference and Check for Differences - run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && bash -c 'git config --global --add safe.directory $(pwd)' && git diff Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run `swift package plugin generate-docs-reference` and commit/push the changes."; exit 1) + run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && bash -c 'git config --global --add safe.directory $(pwd)' && git diff --exit-code Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run `swift package plugin generate-docs-reference` and commit/push the changes."; exit 1) - name: Generate Documentation Set run: swift package --allow-writing-to-directory .build/docs generate-documentation --target SwiftlyDocs --output-path .build/docs - name: Upload Documentation Artifacts From 335a25a67e1ff8be8dc62d15b7c796d183e5ed93 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 20:50:55 -0500 Subject: [PATCH 38/46] Consolidate the swiftly and libarchive install into the prep script --- .github/workflows/build_release.yml | 12 +------ .github/workflows/pull_request.yml | 54 ++++------------------------- scripts/prep-gh-action.sh | 42 ++++++++++++++++++++-- 3 files changed, 46 insertions(+), 62 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index d2064fef..cf3bec24 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -27,17 +27,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Prepare the action - run: ./scripts/prep-gh-action.sh - - name: Install swiftly - run: bash -c 'curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install' - - name: Update environment - run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' - - name: Install selected swift toolchain - run: swiftly install --post-install-file=post-install.sh - - name: Perform swift toolchain post-installation - run: chmod u+x post-install.sh && ./post-install.sh - - name: Display swift version - run: swift --version + run: ./scripts/prep-gh-action.sh --install-swiftly - name: Build Release Artifact run: swift run build-swiftly-release --use-rhel-ubi9 ${{ inputs.skip }} ${{ inputs.version }} - name: Upload Release Artifact diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index b0c9fc58..2c581289 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -35,19 +35,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Prepare the action - run: ./scripts/prep-gh-action.sh - - name: Install swiftly - run: bash -c 'curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install' - - name: Update environment - run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' - - name: Install selected swift toolchain - run: swiftly install --post-install-file=post-install.sh - - name: Perform swift toolchain post-installation - run: chmod u+x post-install.sh && ./post-install.sh - - name: Display swift version - run: swift --version + run: ./scripts/prep-gh-action.sh --install-swiftly - name: Build and Test - run: CC=clang swiftly run ./scripts/install-libarchive.sh && swift test + run: swift test tests: name: Test @@ -56,7 +46,7 @@ jobs: linux_os_versions: "[\"jammy\"]" # We only care about the current stable release, because that's where we make our swiftly releases linux_exclude_swift_versions: "[{\"swift_version\": \"nightly-main\"},{\"swift_version\": \"nightly-6.0\"},{\"swift_version\": \"5.8\"},{\"swift_version\": \"5.9\"},{\"swift_version\": \"5.10\"}]" - linux_pre_build_command: ./scripts/prep-gh-action.sh && ./scripts/install-libarchive.sh + linux_pre_build_command: ./scripts/prep-gh-action.sh enable_windows_checks: false releasebuildcheck: @@ -68,17 +58,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Prepare the action - run: ./scripts/prep-gh-action.sh - - name: Install swiftly - run: bash -c 'curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install' - - name: Update environment - run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' - - name: Install selected swift toolchain - run: swiftly install --post-install-file=post-install.sh - - name: Perform swift toolchain post-installation - run: chmod u+x post-install.sh && ./post-install.sh - - name: Display swift version - run: swift --version + run: ./scripts/prep-gh-action.sh --install-swiftly - name: Build Artifact run: swift run build-swiftly-release --use-rhel-ubi9 --skip "999.0.0" - name: Upload Artifact @@ -98,17 +78,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Prepare the action - run: ./scripts/prep-gh-action.sh - - name: Install swiftly - run: bash -c 'curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install' - - name: Update environment - run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' - - name: Install selected swift toolchain - run: swiftly install --post-install-file=post-install.sh - - name: Perform swift toolchain post-installation - run: chmod u+x post-install.sh && ./post-install.sh - - name: Display swift version - run: swift --version + run: ./scripts/prep-gh-action.sh --install-swiftly - name: Check format run: swift run swiftformat --lint --dryrun . || (echo "Please run 'swift run swiftformat .' to format the source code."; exit 1) @@ -123,19 +93,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Prepare the action - run: ./scripts/prep-gh-action.sh - - name: Install swiftly - run: bash -c 'curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install' - - name: Update environment - run: bash -c '. "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' - - name: Install selected swift toolchain - run: swiftly install --post-install-file=post-install.sh - - name: Perform swift toolchain post-installation - run: chmod u+x post-install.sh && ./post-install.sh - - name: Display swift version - run: swift --version - - name: Install libarchive - run: CC=clang swiftly run ./scripts/install-libarchive.sh + run: ./scripts/prep-gh-action.sh --install-swiftly - name: Generate Swiftly CLI Reference and Check for Differences run: swift package plugin --allow-writing-to-package-directory generate-docs-reference && bash -c 'git config --global --add safe.directory $(pwd)' && git diff --exit-code Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md || (echo "The documentation hasn't been updated with the latest swiftly command-line reference. Please run `swift package plugin generate-docs-reference` and commit/push the changes."; exit 1) - name: Generate Documentation Set diff --git a/scripts/prep-gh-action.sh b/scripts/prep-gh-action.sh index 12e36c44..d0d79702 100755 --- a/scripts/prep-gh-action.sh +++ b/scripts/prep-gh-action.sh @@ -1,9 +1,45 @@ #!/bin/bash +# Install the basic utilities depending on the type of Linux distribution apt-get --help && apt-get update && TZ=Etc/UTC apt-get -y install curl make gpg tzdata yum --help && (curl --help && yum -y install curl) && yum install make gpg -(cat /etc/os-release | grep bookworm) && apt-get -y install libstdc++-12-dev gnupg2 -(cat /etc/os-release | grep 'Fedora Linux 39') && yum -y install libstdc++-devel libstdc++-static +set -e -exit 0 +while [ $# -ne 0 ] +do + arg="$1" + case "$arg" in + --install-swiftly) + installSwiftly=true + ;; + *) + ;; + esac + shift +done + +if [ "$installSwiftly" == true ]; then + echo "Installing swiftly" + curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install + + echo "Updating environment" + . "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' + + echo "Installing selected swift toolchain" + swiftly install --post-install-file=post-install.sh + + echo "Performing swift toolchain post-installation" + chmod u+x post-install.sh && ./post-install.sh + + echo "Displaying swift version" + swift --version + + CC=clang swiftly run "$(dirname "$0")/install-libarchive.sh" +else + # Official swift docker images are missing these packages at the moment + (cat /etc/os-release | grep bookworm) && apt-get -y install libstdc++-12-dev gnupg2 + (cat /etc/os-release | grep 'Fedora Linux 39') && yum -y install libstdc++-devel libstdc++-static + + "$(dirname "$0")/install-libarchive.sh" +fi From 443619c5d033288e0b16df8c3eee38f7b220907d Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 20:53:45 -0500 Subject: [PATCH 39/46] Fix quotes --- scripts/prep-gh-action.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/prep-gh-action.sh b/scripts/prep-gh-action.sh index d0d79702..6425500f 100755 --- a/scripts/prep-gh-action.sh +++ b/scripts/prep-gh-action.sh @@ -6,8 +6,7 @@ yum --help && (curl --help && yum -y install curl) && yum install make gpg set -e -while [ $# -ne 0 ] -do +while [ $# -ne 0 ]; do arg="$1" case "$arg" in --install-swiftly) @@ -24,7 +23,7 @@ if [ "$installSwiftly" == true ]; then curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install echo "Updating environment" - . "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"' + . "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV" echo "Installing selected swift toolchain" swiftly install --post-install-file=post-install.sh From 154ef7486770811f7e3c00eda115b00a9e96b5c5 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 21:02:55 -0500 Subject: [PATCH 40/46] Skip attempt to run post install script if it does not exist --- scripts/prep-gh-action.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/prep-gh-action.sh b/scripts/prep-gh-action.sh index 6425500f..f6e5a6fd 100755 --- a/scripts/prep-gh-action.sh +++ b/scripts/prep-gh-action.sh @@ -28,8 +28,10 @@ if [ "$installSwiftly" == true ]; then echo "Installing selected swift toolchain" swiftly install --post-install-file=post-install.sh - echo "Performing swift toolchain post-installation" - chmod u+x post-install.sh && ./post-install.sh + if [ -f post-install.sh ]; then + echo "Performing swift toolchain post-installation" + chmod u+x post-install.sh && ./post-install.sh + fi echo "Displaying swift version" swift --version From a46fc4ee017705df6f7c388939556c2ab6f19da8 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 21:06:14 -0500 Subject: [PATCH 41/46] Fix test job names --- .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 2c581289..551a2c05 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -23,7 +23,7 @@ jobs: unacceptable_language_check_enabled: true tests-selfhosted: - name: Test (Self Hosted) - ${{ matrix.container }} + name: Test (Self Hosted) / ${{ matrix.container }} runs-on: ubuntu-latest strategy: fail-fast: false From 3f2172dbc55c182e542b8a9561a8f3ce39cf603f Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Tue, 24 Dec 2024 21:24:55 -0500 Subject: [PATCH 42/46] Add more checks the github prep script --- scripts/prep-gh-action.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/prep-gh-action.sh b/scripts/prep-gh-action.sh index f6e5a6fd..04219d7c 100755 --- a/scripts/prep-gh-action.sh +++ b/scripts/prep-gh-action.sh @@ -22,11 +22,21 @@ if [ "$installSwiftly" == true ]; then echo "Installing swiftly" curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install - echo "Updating environment" - . "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV" + . "/root/.local/share/swiftly/env.sh" + hash -r - echo "Installing selected swift toolchain" - swiftly install --post-install-file=post-install.sh + if [ -n "$GITHUB_ENV" ]; then + echo "Updating GitHub environment" + echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV" + fi + + if [ -f .swift-version ]; then + echo "Installing selected swift toolchain" + swiftly install --post-install-file=post-install.sh + else + echo "Installing latest toolchain" + swiftly install --post-install-file=post-install.sh latest + fi if [ -f post-install.sh ]; then echo "Performing swift toolchain post-installation" From d9391f0f32709c519c97e7734fc28bbc61e2d963 Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Thu, 26 Dec 2024 08:51:32 -0500 Subject: [PATCH 43/46] Fix test coverage for Ubuntu 20.04 --- .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 551a2c05..f679ece2 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -43,7 +43,7 @@ jobs: name: Test uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main with: - linux_os_versions: "[\"jammy\"]" + linux_os_versions: "[\"focal\"]" # We only care about the current stable release, because that's where we make our swiftly releases linux_exclude_swift_versions: "[{\"swift_version\": \"nightly-main\"},{\"swift_version\": \"nightly-6.0\"},{\"swift_version\": \"5.8\"},{\"swift_version\": \"5.9\"},{\"swift_version\": \"5.10\"}]" linux_pre_build_command: ./scripts/prep-gh-action.sh From 25ff40d0132de5ab752054124a92162c0450cbbb Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Fri, 10 Jan 2025 14:41:13 -0500 Subject: [PATCH 44/46] Move Ubuntu 20.04 to self-hosted --- .github/workflows/pull_request.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index f679ece2..6ad20e5e 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -28,7 +28,7 @@ jobs: strategy: fail-fast: false matrix: - container: ["ubuntu:22.04", "ubuntu:24.04", "redhat/ubi9", "debian:12", "fedora:39"] + container: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "redhat/ubi9", "debian:12", "fedora:39"] container: image: ${{ matrix.container }} steps: @@ -39,16 +39,6 @@ jobs: - name: Build and Test run: swift test - tests: - name: Test - uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main - with: - linux_os_versions: "[\"focal\"]" - # We only care about the current stable release, because that's where we make our swiftly releases - linux_exclude_swift_versions: "[{\"swift_version\": \"nightly-main\"},{\"swift_version\": \"nightly-6.0\"},{\"swift_version\": \"5.8\"},{\"swift_version\": \"5.9\"},{\"swift_version\": \"5.10\"}]" - linux_pre_build_command: ./scripts/prep-gh-action.sh - enable_windows_checks: false - releasebuildcheck: name: Release Build Check runs-on: ubuntu-latest From 8c1cd9305e1f378dfcc809c9534ea9ac2270250b Mon Sep 17 00:00:00 2001 From: "Chris (SPG) McGee" Date: Thu, 16 Jan 2025 08:38:39 -0500 Subject: [PATCH 45/46] Remove unnecessary packages for C++ compilation --- scripts/prep-gh-action.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/prep-gh-action.sh b/scripts/prep-gh-action.sh index 04219d7c..38f8f91c 100755 --- a/scripts/prep-gh-action.sh +++ b/scripts/prep-gh-action.sh @@ -1,5 +1,9 @@ #!/bin/bash +# This script does a bit of extra preparation of the docker containers used to run the GitHub workflows +# that are specific to this project's needs when building/testing. Note that this script runs on +# every supported Linux distribution so it must adapt to the distribution that it is running. + # Install the basic utilities depending on the type of Linux distribution apt-get --help && apt-get update && TZ=Etc/UTC apt-get -y install curl make gpg tzdata yum --help && (curl --help && yum -y install curl) && yum install make gpg @@ -48,9 +52,5 @@ if [ "$installSwiftly" == true ]; then CC=clang swiftly run "$(dirname "$0")/install-libarchive.sh" else - # Official swift docker images are missing these packages at the moment - (cat /etc/os-release | grep bookworm) && apt-get -y install libstdc++-12-dev gnupg2 - (cat /etc/os-release | grep 'Fedora Linux 39') && yum -y install libstdc++-devel libstdc++-static - "$(dirname "$0")/install-libarchive.sh" fi From b40a5c2edd9845236cb7d7489d3c433f23b60806 Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Mon, 27 Jan 2025 07:30:46 -0500 Subject: [PATCH 46/46] Correct the error type --- Sources/Swiftly/Proxy.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Swiftly/Proxy.swift b/Sources/Swiftly/Proxy.swift index d2b97e62..9d46fcc9 100644 --- a/Sources/Swiftly/Proxy.swift +++ b/Sources/Swiftly/Proxy.swift @@ -58,7 +58,7 @@ public enum Proxy { // Prevent circularities with a memento environment variable guard ProcessInfo.processInfo.environment["SWIFTLY_PROXY_IN_PROGRESS"] == nil else { - throw Error(message: "Circular swiftly proxy invocation") + throw SwiftlyError(message: "Circular swiftly proxy invocation") } let env = ["SWIFTLY_PROXY_IN_PROGRESS": "1"]