Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
strategy:
fail-fast: false
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:
Expand Down
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.0
6.2.0
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ let package = Package(
.target(name: "LinuxPlatform", condition: .when(platforms: [.linux])),
.target(name: "MacOSPlatform", condition: .when(platforms: [.macOS])),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "_NIOFileSystem", package: "swift-nio"),
],
path: "Tools/build-swiftly-release"
),
Expand Down
15 changes: 9 additions & 6 deletions Tools/build-swiftly-release/BuildSwiftlyRelease.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ArgumentParser
import AsyncHTTPClient
import Foundation
import NIOFileSystem
import SwiftlyCore
import SystemPackage

Expand All @@ -16,7 +17,7 @@ let currentPlatform = MacOS()
let currentPlatform = Linux()
#endif

typealias fs = FileSystem
typealias fs = SwiftlyCore.FileSystem
typealias sys = SystemCommand

extension Runnable {
Expand Down Expand Up @@ -156,12 +157,14 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
guard libarchiveResponse.status == .ok else {
throw Error(message: "Download failed with status: \(libarchiveResponse.status)")
}
let buf = try await libarchiveResponse.body.collect(upTo: 20 * 1024 * 1024)
guard let contents = buf.getBytes(at: 0, length: buf.readableBytes) else {
throw Error(message: "Unable to read all of the bytes")

try await NIOFileSystem.FileSystem.shared.withFileHandle(forWritingAt: buildCheckoutsDir / "libarchive-\(libArchiveVersion).tar.gz", options: .newFile(replaceExisting: true)) { fileHandle in
var pos: Int64 = 0

for try await buffer in libarchiveResponse.body {
pos += try await fileHandle.write(contentsOf: buffer, toAbsoluteOffset: pos)
}
}
let data = Data(contents)
try data.write(to: buildCheckoutsDir / "libarchive-\(libArchiveVersion).tar.gz")

let libArchiveTarShaActual = try await sys.sha256sum(files: buildCheckoutsDir / "libarchive-\(libArchiveVersion).tar.gz").output(currentPlatform)
guard let libArchiveTarShaActual, libArchiveTarShaActual.starts(with: libArchiveTarSha) else {
Expand Down