From 8567c619a379c8229d6111146106f553f937376a Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Thu, 19 Dec 2024 10:09:30 -0500 Subject: [PATCH 01/21] Disable building of stdlib for embedded --- build-swift-stdlib.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build-swift-stdlib.sh b/build-swift-stdlib.sh index 407ca72..8477719 100755 --- a/build-swift-stdlib.sh +++ b/build-swift-stdlib.sh @@ -54,6 +54,7 @@ LIBS="-latomic" cmake -S $SWIFT_SRCDIR -B $SWIFT_BUILDDIR -G Ninja \ -DSWIFT_ENABLE_EXPERIMENTAL_NONESCAPABLE_TYPES=ON \ -DSWIFT_ENABLE_EXPERIMENTAL_OBSERVATION=ON \ -DSWIFT_ENABLE_SYNCHRONIZATION=ON \ + -DSWIFT_SHOULD_BUILD_EMBEDDED_STDLIB=OFF \ -DSWIFT_INCLUDE_TESTS=OFF \ -DSWIFT_INCLUDE_TEST_BINARIES=OFF \ -DSWIFT_BUILD_TEST_SUPPORT_MODULES=OFF \ From a574001333f8a6c48b509322410f615f8cbae1b7 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Thu, 19 Dec 2024 11:44:41 -0500 Subject: [PATCH 02/21] Fix building foundation for 6.1, requires SWIFT_NATIVE_PATH to point to valid installation --- build-foundation.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build-foundation.sh b/build-foundation.sh index 4d16059..114c892 100755 --- a/build-foundation.sh +++ b/build-foundation.sh @@ -37,6 +37,7 @@ LIBS="-latomic" cmake -S $FOUNDATION_SRCDIR -B $FOUNDATION_BUILDDIR -G Ninja \ -DCMAKE_Swift_FLAGS_DEBUG="" \ -DCMAKE_Swift_FLAGS_RELEASE="" \ -DCMAKE_Swift_FLAGS_RELWITHDEBINFO="" \ + -DSwiftFoundation_MACRO="${SWIFT_NATIVE_PATH}../lib/host/plugins/libFoundationMacros.so" \ -D_SwiftFoundation_SourceDIR="$SRC_ROOT/downloads/swift-foundation" \ -D_SwiftFoundationICU_SourceDIR="$SRC_ROOT/downloads/swift-foundation-icu" \ -D_SwiftCollections_SourceDIR="$SRC_ROOT/downloads/swift-collections" \ From c6f6bf914f8e813e89a7db9d068ef33ce5480eab Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Thu, 19 Dec 2024 12:31:57 -0500 Subject: [PATCH 03/21] Fix testing module build for Swift 6.x, add simple test for Testing module --- build.sh | 2 +- swift-hello/Sources/swift-hello/Hello.swift | 113 +++++++++--------- .../swift-helloTests/swift_helloTests.swift | 43 ++++--- 3 files changed, 84 insertions(+), 74 deletions(-) diff --git a/build.sh b/build.sh index e9656bd..742a99d 100755 --- a/build.sh +++ b/build.sh @@ -31,7 +31,7 @@ rm -rf $STAGING_DIR/usr/lib/swift* ./build-dispatch.sh ./build-foundation.sh ./build-xctest.sh -if [[ $SWIFT_VERSION == *"6.0"* ]]; then +if [[ $SWIFT_VERSION == *"6."* ]]; then ./build-swift-testing.sh fi diff --git a/swift-hello/Sources/swift-hello/Hello.swift b/swift-hello/Sources/swift-hello/Hello.swift index 7665293..cd2463b 100644 --- a/swift-hello/Sources/swift-hello/Hello.swift +++ b/swift-hello/Sources/swift-hello/Hello.swift @@ -1,14 +1,14 @@ #if canImport(Dispatch) -import Dispatch + import Dispatch #endif #if canImport(Foundation) -import Foundation + import Foundation #endif #if canImport(FoundationNetworking) -import FoundationNetworking + import FoundationNetworking #endif #if canImport(CxxStdlib) -import CxxStdlib + import CxxStdlib #endif @main @@ -17,39 +17,42 @@ struct Hello { static func main() async throws { print("Hello, world! 👋") try await testConcurrency() + #if canImport(Dispatch) - print("Dispatch installed") - testDispatch() + print("Dispatch installed") + testDispatch() #endif + #if canImport(Foundation) - print("Foundation installed") - testFoundation() + print("Foundation installed") + testFoundation() #endif + #if canImport(FoundationNetworking) || canImport(Darwin) - print("FoundationNetworking installed") - try await testFoundationNetworking() + print("FoundationNetworking installed") + try await testFoundationNetworking() #endif + #if canImport(CxxStdlib) - print("CxxStdlib installed, C++ interop should be available") + print("CxxStdlib installed, C++ interop should be available") #endif } } struct TestError: Error { - let reason: String } func testConcurrency() async throws { let task = Task { var didCatchError = false - do { try await asyncErrorTest() } - catch CocoaError.userCancelled { didCatchError = true } - catch { fatalError("Unexpected error catching") } + do { try await asyncErrorTest() } catch CocoaError.userCancelled { didCatchError = true } catch { + fatalError("Unexpected error catching") + } precondition(didCatchError) } await task.value - for _ in 0 ..< 5 { + for _ in 0..<5 { try await Task.sleep(nanoseconds: 100_000) try await Task.sleep(for: .microseconds(10)) } @@ -61,56 +64,56 @@ func asyncErrorTest(error: Error = CocoaError(.userCancelled)) async throws { } #if canImport(Foundation) -func testFoundation() { - print("UUID:", UUID()) - let formatter = DateFormatter() - formatter.dateStyle = .full - formatter.timeStyle = .full - print("Date:", formatter.string(from: Date())) -} + func testFoundation() { + print("UUID:", UUID()) + let formatter = DateFormatter() + formatter.dateStyle = .full + formatter.timeStyle = .full + print("Date:", formatter.string(from: Date())) + } #endif #if canImport(Dispatch) -func testDispatch() { - DispatchQueue.global().sync { - print("Dispatch thread: \(Thread.current.name ?? "\(Thread.current)")") + func testDispatch() { + DispatchQueue.global().sync { + print("Dispatch thread: \(Thread.current.name ?? "\(Thread.current)")") + } } -} #endif #if canImport(FoundationNetworking) || canImport(Darwin) -func testFoundationNetworking() async throws { - let url = URL(string: "https://httpbin.org/anything")! - let body = Data("test-\(UUID())".utf8) - var request = URLRequest(url: url) - request.httpMethod = "POST" - request.httpBody = body - let (data, urlResponse) = try await URLSession.shared.data(for: request) - guard let httpResponse = urlResponse as? HTTPURLResponse, httpResponse.statusCode == 200 else { - throw TestError(reason: "Invalid response") - } - guard let json = String(data: data, encoding: .utf8) else { - throw TestError(reason: "Invalid response") + func testFoundationNetworking() async throws { + let url = URL(string: "https://httpbin.org/anything")! + let body = Data("test-\(UUID())".utf8) + var request = URLRequest(url: url) + request.httpMethod = "POST" + request.httpBody = body + let (data, urlResponse) = try await URLSession.shared.data(for: request) + guard let httpResponse = urlResponse as? HTTPURLResponse, httpResponse.statusCode == 200 else { + throw TestError(reason: "Invalid response") + } + guard let json = String(data: data, encoding: .utf8) else { + throw TestError(reason: "Invalid response") + } + print(json) + print("URLSession test passed") } - print(json) - print("URLSession test passed") -} -#if os(Linux) -extension URLSession { + #if os(Linux) + extension URLSession { - func data(for request: URLRequest) async throws -> (Data, URLResponse) { - try await withCheckedThrowingContinuation { continuation in - let task = self.dataTask(with: request) { data, response, error in - if let error = error { - continuation.resume(throwing: error) - } else { - continuation.resume(returning: (data ?? .init(), response!)) + func data(for request: URLRequest) async throws -> (Data, URLResponse) { + try await withCheckedThrowingContinuation { continuation in + let task = self.dataTask(with: request) { data, response, error in + if let error = error { + continuation.resume(throwing: error) + } else { + continuation.resume(returning: (data ?? .init(), response!)) + } + } + task.resume() } } - task.resume() } - } -} -#endif + #endif #endif diff --git a/swift-hello/Tests/swift-helloTests/swift_helloTests.swift b/swift-hello/Tests/swift-helloTests/swift_helloTests.swift index f9ca48c..0354c06 100644 --- a/swift-hello/Tests/swift-helloTests/swift_helloTests.swift +++ b/swift-hello/Tests/swift-helloTests/swift_helloTests.swift @@ -1,4 +1,6 @@ +import Testing import XCTest + import class Foundation.Bundle final class swift_helloTests: XCTestCase { @@ -15,33 +17,38 @@ final class swift_helloTests: XCTestCase { // Mac Catalyst won't have `Process`, but it is supported for executables. #if !targetEnvironment(macCatalyst) - let fooBinary = productsDirectory.appendingPathComponent("swift-hello") + let fooBinary = productsDirectory.appendingPathComponent("swift-hello") - let process = Process() - process.executableURL = fooBinary + let process = Process() + process.executableURL = fooBinary - let pipe = Pipe() - process.standardOutput = pipe + let pipe = Pipe() + process.standardOutput = pipe - try process.run() - process.waitUntilExit() + try process.run() + process.waitUntilExit() - let data = pipe.fileHandleForReading.readDataToEndOfFile() - let output = String(data: data, encoding: .utf8) + let data = pipe.fileHandleForReading.readDataToEndOfFile() + let output = String(data: data, encoding: .utf8) - XCTAssertEqual(output, "Hello, world!\n") + XCTAssertEqual(output, "Hello, world!\n") #endif } /// Returns path to the built products directory. var productsDirectory: URL { - #if os(macOS) - for bundle in Bundle.allBundles where bundle.bundlePath.hasSuffix(".xctest") { - return bundle.bundleURL.deletingLastPathComponent() - } - fatalError("couldn't find the products directory") - #else - return Bundle.main.bundleURL - #endif + #if os(macOS) + for bundle in Bundle.allBundles where bundle.bundlePath.hasSuffix(".xctest") { + return bundle.bundleURL.deletingLastPathComponent() + } + fatalError("couldn't find the products directory") + #else + return Bundle.main.bundleURL + #endif } } + +@Test +func swiftTesting() { + #expect(true) +} From cb114f9ef47a432a3f900422adb00b189ea3a5a0 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Thu, 19 Dec 2024 12:33:40 -0500 Subject: [PATCH 04/21] Disable Testing module due to Swift 6.1 crash at the moment --- swift-hello/Tests/swift-helloTests/swift_helloTests.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/swift-hello/Tests/swift-helloTests/swift_helloTests.swift b/swift-hello/Tests/swift-helloTests/swift_helloTests.swift index 0354c06..bf21aa0 100644 --- a/swift-hello/Tests/swift-helloTests/swift_helloTests.swift +++ b/swift-hello/Tests/swift-helloTests/swift_helloTests.swift @@ -1,4 +1,4 @@ -import Testing +//import Testing import XCTest import class Foundation.Bundle @@ -48,7 +48,8 @@ final class swift_helloTests: XCTestCase { } } -@Test +// Disabled due to compiler crash in 6.1 +/*@Test func swiftTesting() { #expect(true) -} +}*/ From 12d06c06dd207716f08d8cbb635724fdc6789199 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Thu, 19 Dec 2024 15:12:46 -0500 Subject: [PATCH 05/21] Make swift-builder dockerfiles more flexible for version, use tag version for releases - Releases cannot be built until a gh-runner container exists --- .github/workflows/build-swift-release.yml | 2 +- docker/swift-builder-5.9.2.dockerfile | 36 ------------------- ...e => swift-builder-5.x-release.dockerfile} | 3 +- ...e => swift-builder-6.x-release.dockerfile} | 3 +- 4 files changed, 5 insertions(+), 39 deletions(-) delete mode 100644 docker/swift-builder-5.9.2.dockerfile rename docker/{swift-builder-5.10.1.dockerfile => swift-builder-5.x-release.dockerfile} (93%) rename docker/{swift-builder-6.0.2.dockerfile => swift-builder-6.x-release.dockerfile} (91%) diff --git a/.github/workflows/build-swift-release.yml b/.github/workflows/build-swift-release.yml index 8d446db..97355a8 100644 --- a/.github/workflows/build-swift-release.yml +++ b/.github/workflows/build-swift-release.yml @@ -7,7 +7,7 @@ on: env: SWIFT_TAG: swift-${{ github.event.release.tag_name }}-RELEASE SWIFT_WORKSPACE_CACHE: swift-${{ github.event.release.tag_name }}-workspace - SWIFT_BUILDER_TAG: 6.0.2-gh-runner + SWIFT_BUILDER_TAG: ${{ github.event.release.tag_name }}-gh-runner jobs: fetch-sources: diff --git a/docker/swift-builder-5.9.2.dockerfile b/docker/swift-builder-5.9.2.dockerfile deleted file mode 100644 index 03cb93f..0000000 --- a/docker/swift-builder-5.9.2.dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -FROM swift:5.9.2-jammy - -RUN apt-get -y update && \ - apt-get -y install \ - build-essential \ - cmake \ - file \ - git \ - icu-devtools \ - libcurl4-openssl-dev \ - libedit-dev \ - libicu-dev \ - libncurses5-dev \ - libpython3-dev \ - libsqlite3-dev \ - libxml2-dev \ - ninja-build \ - pkg-config \ - python2 \ - python-six \ - python2-dev \ - python3-six \ - python3-distutils \ - python3-pkg-resources \ - python3-psutil \ - rsync \ - swig \ - systemtap-sdt-dev \ - tzdata \ - uuid-dev \ - zip \ - wget - -ARG USER=builduser -ARG UID=1000 -RUN useradd ${USER} -u ${UID} && mkdir /home/${USER} && chown ${USER}:${USER} /home/${USER} diff --git a/docker/swift-builder-5.10.1.dockerfile b/docker/swift-builder-5.x-release.dockerfile similarity index 93% rename from docker/swift-builder-5.10.1.dockerfile rename to docker/swift-builder-5.x-release.dockerfile index 0602ce7..6cff3f2 100644 --- a/docker/swift-builder-5.10.1.dockerfile +++ b/docker/swift-builder-5.x-release.dockerfile @@ -1,4 +1,5 @@ -FROM swift:5.10.1-jammy +ARG SWIFT_RELEASE_VERSION=5.10.1 +FROM swift:${SWIFT_RELEASE_VERSION}-jammy RUN apt-get -y update && \ apt-get -y install \ diff --git a/docker/swift-builder-6.0.2.dockerfile b/docker/swift-builder-6.x-release.dockerfile similarity index 91% rename from docker/swift-builder-6.0.2.dockerfile rename to docker/swift-builder-6.x-release.dockerfile index 52dad23..809900a 100644 --- a/docker/swift-builder-6.0.2.dockerfile +++ b/docker/swift-builder-6.x-release.dockerfile @@ -1,4 +1,5 @@ -FROM swift:6.0.2-noble +ARG SWIFT_RELEASE_VERSION=6.0.3 +FROM swift:${SWIFT_RELEASE_VERSION}-noble RUN apt-get -y update && \ apt-get -q install -y \ From 991f96ebb95e2ff65232a275c2f1e65684b3efa9 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Thu, 19 Dec 2024 19:11:32 -0500 Subject: [PATCH 06/21] Fix swift-hello build for 6.1 by removing Testing --- .github/workflows/build-swift-versions.yml | 2 +- .../Tests/swift-helloTests/swift_helloTests.swift | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-swift-versions.yml b/.github/workflows/build-swift-versions.yml index a1c6e4d..2b8a8db 100644 --- a/.github/workflows/build-swift-versions.yml +++ b/.github/workflows/build-swift-versions.yml @@ -2,7 +2,7 @@ name: Build Swift Versions on: push: - branches: [ "main", "feature/**" ] + branches: [ "main" ] pull_request: branches: [ "main" ] diff --git a/swift-hello/Tests/swift-helloTests/swift_helloTests.swift b/swift-hello/Tests/swift-helloTests/swift_helloTests.swift index 936af2d..ef09795 100644 --- a/swift-hello/Tests/swift-helloTests/swift_helloTests.swift +++ b/swift-hello/Tests/swift-helloTests/swift_helloTests.swift @@ -2,9 +2,9 @@ import XCTest import class Foundation.Bundle -#if canImport(Testing) - //import Testing -#endif +/*#if canImport(Testing) + import Testing +#endif*/ final class swift_helloTests: XCTestCase { func testExample() throws { @@ -51,10 +51,10 @@ final class swift_helloTests: XCTestCase { } } -#if canImport(Testing) - // Disable due to compiler crash in 6.1 +// Disabled due to compiler crash in 6.1 +/*#if canImport(Testing) /*@Test func swiftTesting() { #expect(true) }*/ -#endif +#endif*/ From 63e16cd7fc727fa6cfff5b604e4bc089964c97eb Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Sat, 21 Dec 2024 09:02:19 -0500 Subject: [PATCH 07/21] Disable swift-testing for 6.1 since it is failing to compile --- build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 742a99d..f9cd834 100755 --- a/build.sh +++ b/build.sh @@ -31,7 +31,9 @@ rm -rf $STAGING_DIR/usr/lib/swift* ./build-dispatch.sh ./build-foundation.sh ./build-xctest.sh -if [[ $SWIFT_VERSION == *"6."* ]]; then + +# NOTE: Swift-testing is disabled in 6.1 since it fails to compile +if [[ $SWIFT_VERSION == *"6.0"* ]]; then ./build-swift-testing.sh fi From ef1298cd030a9e836c359c071f2beca0ed2ae825 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Mon, 23 Dec 2024 13:53:15 -0500 Subject: [PATCH 08/21] Try getting latest nightly version for 6.1 --- .github/workflows/build-swift-nightly.yml | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/build-swift-nightly.yml diff --git a/.github/workflows/build-swift-nightly.yml b/.github/workflows/build-swift-nightly.yml new file mode 100644 index 0000000..8e2218b --- /dev/null +++ b/.github/workflows/build-swift-nightly.yml @@ -0,0 +1,32 @@ +name: Build Swift Nightly + +on: + push: + branches: [ "feature/swift-6.1" ] + pull_request: + branches: [ "main" ] + +env: + DISTRIBUTION: debian-bookworm + +jobs: + nightly: + env: + SWIFT_BRANCH: swift-6.1-branch + SWIFT_PLATFORM: ubuntu2204 + SWIFT_WORKSPACE_CACHE: swift-nightly-workspace + name: Build Swift Nigtly + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Get Latest Nightly Version + shell: bash + run: | + export $(curl https://download.swift.org/${{ env.SWIFT_BRANCH }}/${{ env.SWIFT_PLATFORM }}/latest-build.yml | grep 'dir:' | sed 's/:[^:\/\/]/=/g') + echo "Swift ${{ env.SWIFT_BRANCH }} Latest Tag: $dir" + echo "SWIFT_TAG=$(echo $dir)" >> $GITHUB_ENV + - uses: ./.github/actions/checkout-swift + name: Fetch Swift Sources + with: + swift-tag: ${{ env.SWIFT_TAG }} + swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} From 34edf2ae8bb65d492f1d3b95406d4b60981276ce Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Mon, 23 Dec 2024 14:31:02 -0500 Subject: [PATCH 09/21] Cleanup swift-builder, try building container in nightly workflow --- .github/workflows/build-swift-nightly.yml | 23 +++++++++++++++++++---- build-in-container.sh | 2 +- swift-builder/build-container.sh | 4 ++-- swift-builder/build-gh-runner.sh | 4 +--- swift-builder/swift-builder-common | 2 -- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-swift-nightly.yml b/.github/workflows/build-swift-nightly.yml index 8e2218b..88e53fa 100644 --- a/.github/workflows/build-swift-nightly.yml +++ b/.github/workflows/build-swift-nightly.yml @@ -11,10 +11,14 @@ env: jobs: nightly: + strategy: + matrix: + branch: ["swift-6.1-branch", "development"] env: - SWIFT_BRANCH: swift-6.1-branch + SWIFT_TAG: + SWIFT_BRANCH: ${{ matrix.branch }} SWIFT_PLATFORM: ubuntu2204 - SWIFT_WORKSPACE_CACHE: swift-nightly-workspace + SWIFT_VERSION: ${{ matrix.branch }} name: Build Swift Nigtly runs-on: ubuntu-latest steps: @@ -23,10 +27,21 @@ jobs: shell: bash run: | export $(curl https://download.swift.org/${{ env.SWIFT_BRANCH }}/${{ env.SWIFT_PLATFORM }}/latest-build.yml | grep 'dir:' | sed 's/:[^:\/\/]/=/g') - echo "Swift ${{ env.SWIFT_BRANCH }} Latest Tag: $dir" + echo "Latest Tag on ${{ env.SWIFT_BRANCH }} Branch: $dir" echo "SWIFT_TAG=$(echo $dir)" >> $GITHUB_ENV - uses: ./.github/actions/checkout-swift name: Fetch Swift Sources with: swift-tag: ${{ env.SWIFT_TAG }} - swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} + swift-workspace-cache: ${{ env.SWIFT_BRANCH }}-workspace + - name: Build Swift Nightly Container + shell: bash + run: | + source ./swift-builder/swift-builder-common + ./swift-builder/build-container.sh + - uses: ./.github/actions/build-for-distribution + name: Build & Publish Swift + with: + swift-tag: ${{ env.SWIFT_TAG }} + distribution: ${{ env.DISTRIBUTION }} + builder-tag: ${{ env.SWIFT_VERSION }} diff --git a/build-in-container.sh b/build-in-container.sh index 0e7cf58..e31276d 100755 --- a/build-in-container.sh +++ b/build-in-container.sh @@ -10,7 +10,7 @@ source ./swift-builder/swift-builder-common echo "Building Swift ${SWIFT_TAG} using ${DOCKER_TAG}..." docker run \ --rm -ti \ - --user ${BUILD_USER}:${BUILD_USER} \ + --user ${USER}:${USER} \ --volume $(pwd):/src \ --workdir /src \ -e SWIFT_VERSION=${SWIFT_TAG} \ diff --git a/swift-builder/build-container.sh b/swift-builder/build-container.sh index 9e31602..b045d8d 100755 --- a/swift-builder/build-container.sh +++ b/swift-builder/build-container.sh @@ -9,7 +9,7 @@ echo "Building container for Swift $SWIFT_VERSION, branch $SWIFT_BRANCH, tag $SW docker build \ --build-arg SWIFT_VERSION=${SWIFT_TAG} \ --build-arg SWIFT_BRANCH=${SWIFT_BRANCH} \ - --build-arg USER=${BUILD_USER} \ - --build-arg UID=${BUILD_USER_ID} \ + --build-arg USER=${USER} \ + --build-arg UID=${UID} \ -t ${DOCKER_TAG} \ ${SCRIPT_DIR} diff --git a/swift-builder/build-gh-runner.sh b/swift-builder/build-gh-runner.sh index f033fe9..2051f0b 100755 --- a/swift-builder/build-gh-runner.sh +++ b/swift-builder/build-gh-runner.sh @@ -6,13 +6,11 @@ if [ -z $SWIFT_VERSION ]; then fi export DOCKER_TAG=${DOCKER_TAG:=xtremekforever/swift-builder:${SWIFT_VERSION}-gh-runner} -export BUILD_USER=runner -export BUILD_USER_ID=1001 SCRIPT_DIR=$(dirname "$0") source ${SCRIPT_DIR}/swift-builder-common -./build-container.sh +USER=runner UID=1001 ./build-container.sh if [ ! -z $PUSH ]; then echo "Pushing ${DOCKER_TAG} now..." diff --git a/swift-builder/swift-builder-common b/swift-builder/swift-builder-common index d6af23f..2307e12 100644 --- a/swift-builder/swift-builder-common +++ b/swift-builder/swift-builder-common @@ -1,7 +1,5 @@ SWIFT_VERSION=${SWIFT_VERSION:=6.0.3} SWIFT_BRANCH=${SWIFT_BRANCH:=swift-${SWIFT_VERSION}-release} SWIFT_TAG=${SWIFT_TAG:=swift-${SWIFT_VERSION}-RELEASE} -BUILD_USER=${BUILD_USER:=build-user} -BUILD_USER_ID=${BUILD_USER_ID:=$UID} DOCKER_TAG=${DOCKER_TAG:=swift-builder:${SWIFT_VERSION}} From 53e40ba38513ab01e870e08226d8fcf7611557b7 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Mon, 23 Dec 2024 14:47:01 -0500 Subject: [PATCH 10/21] Fix DOCKER_TAG to use xtremekforever/ by default --- swift-builder/swift-builder-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swift-builder/swift-builder-common b/swift-builder/swift-builder-common index 2307e12..cf7624f 100644 --- a/swift-builder/swift-builder-common +++ b/swift-builder/swift-builder-common @@ -2,4 +2,4 @@ SWIFT_VERSION=${SWIFT_VERSION:=6.0.3} SWIFT_BRANCH=${SWIFT_BRANCH:=swift-${SWIFT_VERSION}-release} SWIFT_TAG=${SWIFT_TAG:=swift-${SWIFT_VERSION}-RELEASE} -DOCKER_TAG=${DOCKER_TAG:=swift-builder:${SWIFT_VERSION}} +DOCKER_TAG=${DOCKER_TAG:=xtremekforever/swift-builder:${SWIFT_VERSION}} From c8da32158f21d0cde14250cd1afbfb1cdacf9a10 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Mon, 23 Dec 2024 15:27:49 -0500 Subject: [PATCH 11/21] Build only latest Swift from push CI - Also build container instead of using pre-built builder, to make the CI more flexible. --- .github/workflows/build-swift-latest.yml | 39 ++++++++++++ .github/workflows/build-swift-versions.yml | 74 ---------------------- README.md | 8 +-- 3 files changed, 43 insertions(+), 78 deletions(-) create mode 100644 .github/workflows/build-swift-latest.yml delete mode 100644 .github/workflows/build-swift-versions.yml diff --git a/.github/workflows/build-swift-latest.yml b/.github/workflows/build-swift-latest.yml new file mode 100644 index 0000000..a0d986e --- /dev/null +++ b/.github/workflows/build-swift-latest.yml @@ -0,0 +1,39 @@ +name: Build Swift Latest + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + DISTRIBUTION: debian-bookworm + +jobs: + build-latest: + strategy: + matrix: + version: ["6.0.3"] + env: + SWIFT_VERSION: ${{ matrix.version }} + SWIFT_TAG: swift-${{ matrix.version }}-RELEASE + name: Build Swift + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/checkout-swift + name: Fetch Swift Sources + with: + swift-tag: ${{ env.SWIFT_TAG }} + swift-workspace-cache: swift-${{ matrix.version }}-workspace + - name: Generate Builder Container + shell: bash + run: | + source ./swift-builder/swift-builder-common + ./swift-builder/build-container.sh + - uses: ./.github/actions/build-for-distribution + name: Build & Publish Swift + with: + swift-tag: ${{ env.SWIFT_TAG }} + distribution: ${{ env.DISTRIBUTION }} + builder-tag: ${{ env.SWIFT_VERSION }} diff --git a/.github/workflows/build-swift-versions.yml b/.github/workflows/build-swift-versions.yml deleted file mode 100644 index 2b8a8db..0000000 --- a/.github/workflows/build-swift-versions.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Build Swift Versions - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -env: - DISTRIBUTION: debian-bookworm - -jobs: - swift-5-9-2: - env: - SWIFT_TAG: swift-5.9.2-RELEASE - SWIFT_WORKSPACE_CACHE: swift-5.9.2-workspace - SWIFT_BUILDER_TAG: 5.9.2-gh-runner - name: Build Swift 5.9.2 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/checkout-swift - name: Fetch Swift Sources - with: - swift-tag: ${{ env.SWIFT_TAG }} - swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} - - uses: ./.github/actions/build-for-distribution - name: Build & Publish Swift - with: - swift-tag: ${{ env.SWIFT_TAG }} - distribution: ${{ env.DISTRIBUTION }} - builder-tag: ${{ env.SWIFT_BUILDER_TAG }} - - swift-5-10-1: - env: - SWIFT_TAG: swift-5.10.1-RELEASE - SWIFT_WORKSPACE_CACHE: swift-5.10.1-workspace - SWIFT_BUILDER_TAG: 5.10.1-gh-runner - name: Build Swift 5.10.1 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/checkout-swift - name: Fetch Swift Sources - with: - swift-tag: ${{ env.SWIFT_TAG }} - swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} - - uses: ./.github/actions/build-for-distribution - name: Build & Publish Swift - with: - swift-tag: ${{ env.SWIFT_TAG }} - distribution: ${{ env.DISTRIBUTION }} - builder-tag: ${{ env.SWIFT_BUILDER_TAG }} - - swift-6-0-3: - env: - SWIFT_TAG: swift-6.0.3-RELEASE - SWIFT_WORKSPACE_CACHE: swift-6.0.3-workspace - SWIFT_BUILDER_TAG: 6.0.2-gh-runner - name: Build Swift 6.0.3 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/checkout-swift - name: Fetch Swift Sources - with: - swift-tag: ${{ env.SWIFT_TAG }} - swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} - - uses: ./.github/actions/build-for-distribution - name: Build & Publish Swift - with: - swift-tag: ${{ env.SWIFT_TAG }} - distribution: ${{ env.DISTRIBUTION }} - builder-tag: ${{ env.SWIFT_BUILDER_TAG }} diff --git a/README.md b/README.md index 82e6f66..ee66d96 100644 --- a/README.md +++ b/README.md @@ -73,14 +73,14 @@ After building the armv7 runtime using the `build.sh` script, you can generate a using the `build-linux-cross-sdk.sh` script. You must provide the swift tag and distribution name: ```bash -./build-linux-cross-sdk.sh swift-5.10.1-RELEASE ubuntu-noble +./build-linux-cross-sdk.sh swift-6.0.3-RELEASE ubuntu-noble ``` By default, the SDK will be generated to be installed at a path of /opt/$SWIFT_TAG-$DISTRIBUTION-armv7, but this can be customized by providing a different install prefix to the script: ```bash export SDK_INSTALL_PREFIX=/home/myuser/swift-sdks -./build-linux-cross-sdk.sh swift-5.10.1-RELEASE ubuntu-noble +./build-linux-cross-sdk.sh swift-6.0.3-RELEASE ubuntu-noble ``` ## Continuous Integration & Releases @@ -97,11 +97,11 @@ To use the SDK that is generated by the CI or published to the [Releases](https: extract it to /opt: ```bash -sudo tar -xf swift-5.10.1-RELEASE-debian-bookworm-armv7-sdk.tar.gz -C /opt +sudo tar -xf swift-6.0.3-RELEASE-debian-bookworm-armv7-sdk.tar.gz -C /opt ``` Then, from a Swift package, use the `--destination` paramter to cross-compile it for the target: ```bash -swift build --destination /opt/swift-5.10.1-RELEASE-debian-bookworm-armv7/debian-bookworm.json +swift build --destination /opt/swift-6.0.3-RELEASE-debian-bookworm-armv7/debian-bookworm.json ``` From 16c30a2a6f12ab2a4a298ef5d10555d7b536bacc Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Mon, 23 Dec 2024 15:36:42 -0500 Subject: [PATCH 12/21] Disable caching of sysroot, this is not needed --- .../actions/build-for-distribution/action.yml | 1 - .github/actions/build-with-sysroot/action.yml | 17 ----------------- 2 files changed, 18 deletions(-) diff --git a/.github/actions/build-for-distribution/action.yml b/.github/actions/build-for-distribution/action.yml index e95026e..9e21f70 100644 --- a/.github/actions/build-for-distribution/action.yml +++ b/.github/actions/build-for-distribution/action.yml @@ -28,7 +28,6 @@ runs: with: swift-tag: ${{ inputs.swift-tag }} swift-workspace-cache: ${{ inputs.swift-workspace-cache }} - sysroot-id: sysroot-${{ inputs.distribution }} sysroot-name: sysroot-${{ inputs.distribution }}-armv7 distribution: ${{ inputs.distribution }} builder-tag: ${{ inputs.builder-tag }} diff --git a/.github/actions/build-with-sysroot/action.yml b/.github/actions/build-with-sysroot/action.yml index 5b910e2..01b5ac0 100644 --- a/.github/actions/build-with-sysroot/action.yml +++ b/.github/actions/build-with-sysroot/action.yml @@ -7,9 +7,6 @@ inputs: swift-workspace-cache: description: The name of the Swift workspace directory to restore required: true - sysroot-id: - description: The sysroot ID to use when caching and publishing - required: true sysroot-name: description: The name of the sysroot to use to build Swift required: true @@ -22,13 +19,6 @@ inputs: runs: using: "composite" steps: - - name: Restore Sysroot - id: restore-sysroot - uses: actions/cache/restore@v4 - with: - key: ${{ inputs.sysroot-id }} - path: ${{ inputs.sysroot-name }} - - if: ${{ steps.restore-sysroot.outputs.cache-hit != 'true' }} name: Build shell: bash env: @@ -37,13 +27,6 @@ runs: - name: Compress shell: bash run: tar -czf ${{ inputs.sysroot-name }}.tar.gz ${{ inputs.sysroot-name }} - - name: Cache Sysroot - id: cache-sysroot - if: steps.restore-sysroot.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - key: ${{ inputs.sysroot-id }} - path: ${{ inputs.sysroot-name }} - name: Build Swift shell: bash run: | From b8db79054ea315a6bd533cef263f0a4fa83fc2aa Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Mon, 23 Dec 2024 15:46:55 -0500 Subject: [PATCH 13/21] Use matrix for release builds, enable building latest to test --- .github/workflows/build-swift-release.yml | 83 ++++++----------------- 1 file changed, 20 insertions(+), 63 deletions(-) diff --git a/.github/workflows/build-swift-release.yml b/.github/workflows/build-swift-release.yml index 97355a8..3a63e5c 100644 --- a/.github/workflows/build-swift-release.yml +++ b/.github/workflows/build-swift-release.yml @@ -1,13 +1,18 @@ name: Build Swift Release on: + push: + branches: [ "feature/**" ] release: types: [published] env: - SWIFT_TAG: swift-${{ github.event.release.tag_name }}-RELEASE - SWIFT_WORKSPACE_CACHE: swift-${{ github.event.release.tag_name }}-workspace - SWIFT_BUILDER_TAG: ${{ github.event.release.tag_name }}-gh-runner + SWIFT_VERSION: 6.0.3 + SWIFT_TAG: swift-6.0.3-RELEASE + SWIFT_WORKSPACE_CACHE: swift-6.0.3-workspace + #SWIFT_VERSION: ${{ github.event.release.tag_name }} + #SWIFT_TAG: swift-${{ github.event.release.tag_name }}-RELEASE + #SWIFT_WORKSPACE_CACHE: swift-${{ github.event.release.tag_name }}-workspace jobs: fetch-sources: @@ -21,72 +26,24 @@ jobs: swift-tag: ${{ env.SWIFT_TAG }} swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} - debian-bullseye: - name: Build for Debian Bullseye + build-for-distribution: + strategy: + matrix: + distribution: ["debian-bullseye", "debian-bookworm", "ubuntu-focal", "ubuntu-jammy", "ubuntu-noble"] + name: Build Swift for Distribution runs-on: ubuntu-latest needs: [fetch-sources] steps: - uses: actions/checkout@v4 + - name: Generate Builder Container + shell: bash + run: | + source ./swift-builder/swift-builder-common + ./swift-builder/build-container.sh - uses: ./.github/actions/build-for-distribution name: "Build & Publish Swift: ${{ env.SWIFT_TAG }}" with: swift-tag: ${{ env.SWIFT_TAG }} swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} - distribution: ${{ github.job }} - builder-tag: ${{ env.SWIFT_BUILDER_TAG }} - - debian-bookworm: - name: Build for Debian Bookworm - runs-on: ubuntu-latest - needs: [fetch-sources] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/build-for-distribution - name: "Build & Publish Swift: ${{ env.SWIFT_TAG }}" - with: - swift-tag: ${{ env.SWIFT_TAG }} - swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} - distribution: ${{ github.job }} - builder-tag: ${{ env.SWIFT_BUILDER_TAG }} - - ubuntu-focal: - name: Build for Ubuntu Focal - runs-on: ubuntu-latest - needs: [fetch-sources] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/build-for-distribution - name: "Build & Publish Swift: ${{ env.SWIFT_TAG }}" - with: - swift-tag: ${{ env.SWIFT_TAG }} - swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} - distribution: ${{ github.job }} - builder-tag: ${{ env.SWIFT_BUILDER_TAG }} - - ubuntu-jammy: - name: Build for Ubuntu Jammy - runs-on: ubuntu-latest - needs: [fetch-sources] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/build-for-distribution - name: "Build & Publish Swift: ${{ env.SWIFT_TAG }}" - with: - swift-tag: ${{ env.SWIFT_TAG }} - swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} - distribution: ${{ github.job }} - builder-tag: ${{ env.SWIFT_BUILDER_TAG }} - - ubuntu-noble: - name: Build for Ubuntu Noble - runs-on: ubuntu-latest - needs: [fetch-sources] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/build-for-distribution - name: "Build & Publish Swift: ${{ env.SWIFT_TAG }}" - with: - swift-tag: ${{ env.SWIFT_TAG }} - swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} - distribution: ${{ github.job }} - builder-tag: ${{ env.SWIFT_BUILDER_TAG }} + distribution: ${{ matrix.distribution }} + builder-tag: ${{ env.SWIFT_VERSION }} From eb3c40c380bcfa683fa6fe688a5d52b8195210c6 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Mon, 23 Dec 2024 16:01:25 -0500 Subject: [PATCH 14/21] Touchup naming and formatting for release build workflow --- .github/actions/build-with-sysroot/action.yml | 4 ++-- .github/workflows/build-swift-release.yml | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/actions/build-with-sysroot/action.yml b/.github/actions/build-with-sysroot/action.yml index 01b5ac0..b77fba3 100644 --- a/.github/actions/build-with-sysroot/action.yml +++ b/.github/actions/build-with-sysroot/action.yml @@ -19,11 +19,11 @@ inputs: runs: using: "composite" steps: - name: Build + - name: Build shell: bash env: DISTRIBUTION: ${{ inputs.distribution }} - run: ./build-sysroot.sh `echo ${DISTRIBUTION/-/:}` ${{ inputs.sysroot-name }} + run: ./build-sysroot.sh $(echo ${DISTRIBUTION/-/:}) ${{ inputs.sysroot-name }} - name: Compress shell: bash run: tar -czf ${{ inputs.sysroot-name }}.tar.gz ${{ inputs.sysroot-name }} diff --git a/.github/workflows/build-swift-release.yml b/.github/workflows/build-swift-release.yml index 3a63e5c..4507944 100644 --- a/.github/workflows/build-swift-release.yml +++ b/.github/workflows/build-swift-release.yml @@ -29,8 +29,14 @@ jobs: build-for-distribution: strategy: matrix: - distribution: ["debian-bullseye", "debian-bookworm", "ubuntu-focal", "ubuntu-jammy", "ubuntu-noble"] - name: Build Swift for Distribution + distribution: [ + "debian-bullseye", + "debian-bookworm", + "ubuntu-focal", + "ubuntu-jammy", + "ubuntu-noble" + ] + name: Build Swift runs-on: ubuntu-latest needs: [fetch-sources] steps: From fe3d0f56da94cf67ce41183967a01b2a6d842cf3 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Mon, 23 Dec 2024 20:35:45 -0500 Subject: [PATCH 15/21] Add schedule for nightly, remove sysroot caching --- .../actions/build-for-distribution/action.yml | 1 - .github/actions/build-with-sysroot/action.yml | 19 +------------------ .github/workflows/build-swift-nightly.yml | 5 ++--- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/.github/actions/build-for-distribution/action.yml b/.github/actions/build-for-distribution/action.yml index e95026e..9e21f70 100644 --- a/.github/actions/build-for-distribution/action.yml +++ b/.github/actions/build-for-distribution/action.yml @@ -28,7 +28,6 @@ runs: with: swift-tag: ${{ inputs.swift-tag }} swift-workspace-cache: ${{ inputs.swift-workspace-cache }} - sysroot-id: sysroot-${{ inputs.distribution }} sysroot-name: sysroot-${{ inputs.distribution }}-armv7 distribution: ${{ inputs.distribution }} builder-tag: ${{ inputs.builder-tag }} diff --git a/.github/actions/build-with-sysroot/action.yml b/.github/actions/build-with-sysroot/action.yml index 5b910e2..048f55e 100644 --- a/.github/actions/build-with-sysroot/action.yml +++ b/.github/actions/build-with-sysroot/action.yml @@ -7,9 +7,6 @@ inputs: swift-workspace-cache: description: The name of the Swift workspace directory to restore required: true - sysroot-id: - description: The sysroot ID to use when caching and publishing - required: true sysroot-name: description: The name of the sysroot to use to build Swift required: true @@ -22,14 +19,7 @@ inputs: runs: using: "composite" steps: - - name: Restore Sysroot - id: restore-sysroot - uses: actions/cache/restore@v4 - with: - key: ${{ inputs.sysroot-id }} - path: ${{ inputs.sysroot-name }} - - if: ${{ steps.restore-sysroot.outputs.cache-hit != 'true' }} - name: Build + - name: Build shell: bash env: DISTRIBUTION: ${{ inputs.distribution }} @@ -37,13 +27,6 @@ runs: - name: Compress shell: bash run: tar -czf ${{ inputs.sysroot-name }}.tar.gz ${{ inputs.sysroot-name }} - - name: Cache Sysroot - id: cache-sysroot - if: steps.restore-sysroot.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - key: ${{ inputs.sysroot-id }} - path: ${{ inputs.sysroot-name }} - name: Build Swift shell: bash run: | diff --git a/.github/workflows/build-swift-nightly.yml b/.github/workflows/build-swift-nightly.yml index 88e53fa..7801f7a 100644 --- a/.github/workflows/build-swift-nightly.yml +++ b/.github/workflows/build-swift-nightly.yml @@ -1,10 +1,9 @@ name: Build Swift Nightly on: - push: - branches: [ "feature/swift-6.1" ] pull_request: - branches: [ "main" ] + schedule: + - cron: '0 21 * * *' env: DISTRIBUTION: debian-bookworm From 2bb8eeba1d88a4dfa93bba35b35441e27ff789f1 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Mon, 23 Dec 2024 20:40:25 -0500 Subject: [PATCH 16/21] Use single workspace cache for Swift, we don't get much cache space --- .github/actions/build-with-sysroot/action.yml | 3 --- .github/workflows/build-swift-latest.yml | 2 +- .github/workflows/build-swift-nightly.yml | 3 ++- .github/workflows/build-swift-release.yml | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/actions/build-with-sysroot/action.yml b/.github/actions/build-with-sysroot/action.yml index b77fba3..7bc23a3 100644 --- a/.github/actions/build-with-sysroot/action.yml +++ b/.github/actions/build-with-sysroot/action.yml @@ -4,9 +4,6 @@ inputs: swift-tag: description: The Swift tag version that is being built required: true - swift-workspace-cache: - description: The name of the Swift workspace directory to restore - required: true sysroot-name: description: The name of the sysroot to use to build Swift required: true diff --git a/.github/workflows/build-swift-latest.yml b/.github/workflows/build-swift-latest.yml index a0d986e..e9ba708 100644 --- a/.github/workflows/build-swift-latest.yml +++ b/.github/workflows/build-swift-latest.yml @@ -25,7 +25,7 @@ jobs: name: Fetch Swift Sources with: swift-tag: ${{ env.SWIFT_TAG }} - swift-workspace-cache: swift-${{ matrix.version }}-workspace + swift-workspace-cache: swift-workspace - name: Generate Builder Container shell: bash run: | diff --git a/.github/workflows/build-swift-nightly.yml b/.github/workflows/build-swift-nightly.yml index 7801f7a..eafc69a 100644 --- a/.github/workflows/build-swift-nightly.yml +++ b/.github/workflows/build-swift-nightly.yml @@ -18,6 +18,7 @@ jobs: SWIFT_BRANCH: ${{ matrix.branch }} SWIFT_PLATFORM: ubuntu2204 SWIFT_VERSION: ${{ matrix.branch }} + SWIFT_WORKSPACE_CACHE: swift-workspace name: Build Swift Nigtly runs-on: ubuntu-latest steps: @@ -32,7 +33,7 @@ jobs: name: Fetch Swift Sources with: swift-tag: ${{ env.SWIFT_TAG }} - swift-workspace-cache: ${{ env.SWIFT_BRANCH }}-workspace + swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} - name: Build Swift Nightly Container shell: bash run: | diff --git a/.github/workflows/build-swift-release.yml b/.github/workflows/build-swift-release.yml index 4507944..a9cb934 100644 --- a/.github/workflows/build-swift-release.yml +++ b/.github/workflows/build-swift-release.yml @@ -9,10 +9,9 @@ on: env: SWIFT_VERSION: 6.0.3 SWIFT_TAG: swift-6.0.3-RELEASE - SWIFT_WORKSPACE_CACHE: swift-6.0.3-workspace #SWIFT_VERSION: ${{ github.event.release.tag_name }} #SWIFT_TAG: swift-${{ github.event.release.tag_name }}-RELEASE - #SWIFT_WORKSPACE_CACHE: swift-${{ github.event.release.tag_name }}-workspace + SWIFT_WORKSPACE_CACHE: swift-workspace jobs: fetch-sources: From afe3a5855792cfd99a3bd16413b9f0ad9d7b5d02 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Mon, 23 Dec 2024 20:46:30 -0500 Subject: [PATCH 17/21] Try uploading artifacts --- .github/workflows/build-swift-release.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-swift-release.yml b/.github/workflows/build-swift-release.yml index a9cb934..e6579db 100644 --- a/.github/workflows/build-swift-release.yml +++ b/.github/workflows/build-swift-release.yml @@ -7,8 +7,8 @@ on: types: [published] env: - SWIFT_VERSION: 6.0.3 - SWIFT_TAG: swift-6.0.3-RELEASE + SWIFT_VERSION: 6.0 + SWIFT_TAG: swift-6.0-RELEASE #SWIFT_VERSION: ${{ github.event.release.tag_name }} #SWIFT_TAG: swift-${{ github.event.release.tag_name }}-RELEASE SWIFT_WORKSPACE_CACHE: swift-workspace @@ -46,9 +46,17 @@ jobs: source ./swift-builder/swift-builder-common ./swift-builder/build-container.sh - uses: ./.github/actions/build-for-distribution - name: "Build & Publish Swift: ${{ env.SWIFT_TAG }}" + name: "Build & Publish Swift: ${{ env.SWIFT_VERSION }}" with: swift-tag: ${{ env.SWIFT_TAG }} swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} distribution: ${{ matrix.distribution }} builder-tag: ${{ env.SWIFT_VERSION }} + - name: Update Release ${{ env.SWIFT_VERSION }} + uses: ncipollo/release-action@v1 + with: + tag: ${{ env.SWIFT_VERSION }} + commit: ${{ github.sha }} + artifactErrorsFailBuild: true + artifacts: "*.tar.gz" + body: "See the [README](https://github.com/xtremekforever/swift-armv7#continuous-integration) for more information on build artifacts." From b2f993d14a16b10e5967c86dccdbfe4a1601c6e4 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Mon, 23 Dec 2024 21:07:54 -0500 Subject: [PATCH 18/21] Add allowUpdate flag to create release action --- .github/workflows/build-swift-release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-swift-release.yml b/.github/workflows/build-swift-release.yml index e6579db..73ce512 100644 --- a/.github/workflows/build-swift-release.yml +++ b/.github/workflows/build-swift-release.yml @@ -7,8 +7,8 @@ on: types: [published] env: - SWIFT_VERSION: 6.0 - SWIFT_TAG: swift-6.0-RELEASE + SWIFT_VERSION: 6.0.1 + SWIFT_TAG: swift-6.0.1-RELEASE #SWIFT_VERSION: ${{ github.event.release.tag_name }} #SWIFT_TAG: swift-${{ github.event.release.tag_name }}-RELEASE SWIFT_WORKSPACE_CACHE: swift-workspace @@ -55,6 +55,8 @@ jobs: - name: Update Release ${{ env.SWIFT_VERSION }} uses: ncipollo/release-action@v1 with: + allowUpdates: true + name: Swift ${{ env.SWIFT_VERSION }} for armv7 tag: ${{ env.SWIFT_VERSION }} commit: ${{ github.sha }} artifactErrorsFailBuild: true From 7f1c1f44fe9b259d109e056c98d4738bd88e7c38 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Mon, 23 Dec 2024 21:29:23 -0500 Subject: [PATCH 19/21] Restore trigger on release --- .github/actions/build-for-distribution/action.yml | 1 - .github/workflows/build-swift-release.yml | 12 ++++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/actions/build-for-distribution/action.yml b/.github/actions/build-for-distribution/action.yml index 9e21f70..13d1c0e 100644 --- a/.github/actions/build-for-distribution/action.yml +++ b/.github/actions/build-for-distribution/action.yml @@ -27,7 +27,6 @@ runs: name: Build Swift + SDK using Sysroot with: swift-tag: ${{ inputs.swift-tag }} - swift-workspace-cache: ${{ inputs.swift-workspace-cache }} sysroot-name: sysroot-${{ inputs.distribution }}-armv7 distribution: ${{ inputs.distribution }} builder-tag: ${{ inputs.builder-tag }} diff --git a/.github/workflows/build-swift-release.yml b/.github/workflows/build-swift-release.yml index 73ce512..bc791ce 100644 --- a/.github/workflows/build-swift-release.yml +++ b/.github/workflows/build-swift-release.yml @@ -1,16 +1,12 @@ name: Build Swift Release on: - push: - branches: [ "feature/**" ] release: types: [published] env: - SWIFT_VERSION: 6.0.1 - SWIFT_TAG: swift-6.0.1-RELEASE - #SWIFT_VERSION: ${{ github.event.release.tag_name }} - #SWIFT_TAG: swift-${{ github.event.release.tag_name }}-RELEASE + SWIFT_VERSION: ${{ github.event.release.tag_name }} + SWIFT_TAG: swift-${{ github.event.release.tag_name }}-RELEASE SWIFT_WORKSPACE_CACHE: swift-workspace jobs: @@ -20,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/checkout-swift - name: "Restore or Checkout: ${{ env.SWIFT_TAG }}" + name: "Restore or Checkout ${{ env.SWIFT_VERSION }}" with: swift-tag: ${{ env.SWIFT_TAG }} swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} @@ -46,7 +42,7 @@ jobs: source ./swift-builder/swift-builder-common ./swift-builder/build-container.sh - uses: ./.github/actions/build-for-distribution - name: "Build & Publish Swift: ${{ env.SWIFT_VERSION }}" + name: "Build & Publish Swift ${{ env.SWIFT_VERSION }}" with: swift-tag: ${{ env.SWIFT_TAG }} swift-workspace-cache: ${{ env.SWIFT_WORKSPACE_CACHE }} From 67c705305e0746c93771e0a6647c91ff6bbf72d4 Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Tue, 24 Dec 2024 07:23:17 -0500 Subject: [PATCH 20/21] Fix a few more typos --- .github/workflows/build-swift-nightly.yml | 2 +- swift-builder/Dockerfile | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-swift-nightly.yml b/.github/workflows/build-swift-nightly.yml index eafc69a..00ebb5a 100644 --- a/.github/workflows/build-swift-nightly.yml +++ b/.github/workflows/build-swift-nightly.yml @@ -3,7 +3,7 @@ name: Build Swift Nightly on: pull_request: schedule: - - cron: '0 21 * * *' + - cron: '0 9 * * *' env: DISTRIBUTION: debian-bookworm diff --git a/swift-builder/Dockerfile b/swift-builder/Dockerfile index 5170f52..d5a356e 100644 --- a/swift-builder/Dockerfile +++ b/swift-builder/Dockerfile @@ -44,8 +44,7 @@ ARG SWIFT_BRANCH=development ARG SWIFT_VERSION=swift-DEVELOPMENT-SNAPSHOT-2024-12-13-a ARG SWIFT_WEBROOT=https://download.swift.org -ENV SWIFT_SIGNING_KEY=$SWIFT_SIGNING_KEY \ - SWIFT_PLATFORM=$SWIFT_PLATFORM \ +ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \ SWIFT_BRANCH=$SWIFT_BRANCH \ SWIFT_VERSION=$SWIFT_VERSION \ SWIFT_WEBROOT=$SWIFT_WEBROOT From 32457003c1c4ab027f6cc7fec91653d19e7a351b Mon Sep 17 00:00:00 2001 From: "Jesse L. Zamora" Date: Tue, 24 Dec 2024 07:43:48 -0500 Subject: [PATCH 21/21] Update build-in-container.sh script to passthrough variables - These can be used to customize where things are or end up. --- build-in-container.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build-in-container.sh b/build-in-container.sh index e31276d..29238ff 100755 --- a/build-in-container.sh +++ b/build-in-container.sh @@ -14,5 +14,7 @@ docker run \ --volume $(pwd):/src \ --workdir /src \ -e SWIFT_VERSION=${SWIFT_TAG} \ - ${DOCKER_REPO}swift-builder:${SWIFT_VERSION} \ + -e STAGING_DIR=${STAGING_DIR} \ + -e INSTALL_TAR=${INSTALL_TAG} \ + ${DOCKER_TAG} \ ./build.sh