Skip to content

Commit 2620466

Browse files
committed
Merge branch 'main' of github.com:cmcgee1024/swiftly into add_new_linux_platforms
2 parents ba9bfb3 + c35819a commit 2620466

23 files changed

+68
-408
lines changed

.github/workflows/pull_request.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Pull request
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
jobs:
8+
soundness:
9+
name: Soundness
10+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
11+
with:
12+
license_header_check_enabled: false
13+
license_header_check_project_name: "Swift.org"
14+
api_breakage_check_enabled: false
15+
docs_check_enabled: false
16+
format_check_enabled: false
17+
shell_check_enabled: false
18+
unacceptable_language_check_enabled: true
19+
20+
tests:
21+
name: Test
22+
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
23+
with:
24+
# linux_os_versions: "[\"jammy\", \"noble\", \"focal\", \"amazonlinux2\", \"rhel-ubi9\", \"bookworm\", \"fedora39\"]"
25+
# Not working: noble (compile error in TSC FileSystem), bookworm (missing memory.h), fedora39 (missing memory.h)
26+
linux_os_versions: "[\"jammy\", \"focal\", \"rhel-ubi9\"]"
27+
# We only care about the current stable release, because that's where we make our swiftly releases
28+
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\"}]"
29+
linux_pre_build_command: ((apt-get update && apt-get -y install curl make) || ((curl --help || yum -y install curl) && yum -y install make)) && ./scripts/install-libarchive.sh
30+
enable_windows_checks: false
31+
32+
releasebuild:
33+
name: Release Build
34+
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
35+
with:
36+
linux_os_versions: "[\"rhel-ubi9\"]"
37+
# We only care about the current stable release, because that's where we make our swiftly releases
38+
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\"}]"
39+
linux_pre_build_command: echo ""
40+
linux_build_command: swift run build-swiftly-release --skip 0.4.0
41+
enable_windows_checks: false
42+
43+
formatcheck:
44+
name: Format Check
45+
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
46+
with:
47+
# We only need to run this with one swift release and on one of the linux distributions
48+
linux_os_versions: "[\"jammy\"]"
49+
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\"}]"
50+
linux_pre_build_command: echo ""
51+
linux_build_command: swift run swiftformat --lint --dryrun .
52+
enable_windows_checks: false

NOTICE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ following third party libraries:
5656
* libarchive - Copyright (c) 2003-2018 Tim Kientzle. All rights reserved.
5757

5858
* LICENSE ("New BSD license"):
59-
* https://raw.githubusercontent.com/libarchive/libarchive/master/COPYING
59+
* https://raw.githubusercontent.com/libarchive/libarchive/release/COPYING
6060
* HOMEPAGE:
6161
* http://www.libarchive.org/

Tools/build-swiftly-release/BuildSwiftlyRelease.swift

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public func getShell() async throws -> String {
126126
}
127127
#endif
128128

129-
public func isAmazonLinux2() -> Bool {
129+
public func isRHEL9() -> Bool {
130130
let osReleaseFiles = ["/etc/os-release", "/usr/lib/os-release"]
131131
var releaseFile: String?
132132
for file in osReleaseFiles {
@@ -165,7 +165,7 @@ public func isAmazonLinux2() -> Bool {
165165
return false
166166
}
167167

168-
guard let versionID = versionID, versionID == "2", (id + idlike).contains("amzn") else {
168+
guard let versionID, versionID.hasPrefix("9"), (id + idlike).contains("rhel") else {
169169
return false
170170
}
171171

@@ -287,7 +287,7 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
287287

288288
func buildLinuxRelease() async throws {
289289
// Check system requirements
290-
guard isAmazonLinux2() else {
290+
guard isRHEL9() else {
291291
// TODO: see if docker can be used to spawn an Amazon Linux 2 container to continue the release building process
292292
throw Error(message: "Linux releases must be made from Amazon Linux 2 because it has the oldest version of glibc for maximum compatibility with other versions of Linux")
293293
}
@@ -298,13 +298,19 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
298298
let make = try await self.assertTool("make", message: "Please install make with `yum install make`")
299299
let git = try await self.assertTool("git", message: "Please install git with `yum install git`")
300300
let strip = try await self.assertTool("strip", message: "Please install strip with `yum install binutils`")
301+
let sha256sum = try await self.assertTool("sha256sum", message: "Please install sha256sum with `yum install coreutils`")
301302

302303
let swift = try await self.checkSwiftRequirement()
303304

304305
try await self.checkGitRepoStatus(git)
305306

306-
// Build a specific version of libarchive
307+
// Start with a fresh SwiftPM package
308+
try runProgram(swift, "package", "reset")
309+
310+
// Build a specific version of libarchive with a check on the tarball's SHA256
307311
let libArchiveVersion = "3.7.4"
312+
let libArchiveTarSha = "7875d49596286055b52439ed42f044bd8ad426aa4cc5aabd96bfe7abb971d5e8"
313+
308314
let buildCheckoutsDir = FileManager.default.currentDirectoryPath + "/.build/checkouts"
309315
let libArchivePath = buildCheckoutsDir + "/libarchive-\(libArchiveVersion)"
310316
let pkgConfigPath = libArchivePath + "/pkgconfig"
@@ -314,6 +320,11 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
314320

315321
try? FileManager.default.removeItem(atPath: libArchivePath)
316322
try runProgram(curl, "-o", "\(buildCheckoutsDir + "/libarchive-\(libArchiveVersion).tar.gz")", "--remote-name", "--location", "https://github.com/libarchive/libarchive/releases/download/v\(libArchiveVersion)/libarchive-\(libArchiveVersion).tar.gz")
323+
let libArchiveTarShaActual = try await runProgramOutput(sha256sum, "\(buildCheckoutsDir)/libarchive-\(libArchiveVersion).tar.gz")
324+
guard let libArchiveTarShaActual, libArchiveTarShaActual.starts(with: libArchiveTarSha) else {
325+
let shaActual = libArchiveTarShaActual ?? "none"
326+
throw Error(message: "The libarchive tar.gz file sha256sum is \(shaActual), but expected \(libArchiveTarSha)")
327+
}
317328
try runProgram(tar, "--directory=\(buildCheckoutsDir)", "-xzf", "\(buildCheckoutsDir)/libarchive-\(libArchiveVersion).tar.gz")
318329

319330
let cwd = FileManager.default.currentDirectoryPath
@@ -350,8 +361,6 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
350361

351362
FileManager.default.changeCurrentDirectoryPath(cwd)
352363

353-
try runProgram(swift, "package", "clean")
354-
355364
// Statically link standard libraries for maximum portability of the swiftly binary
356365
try runProgram(swift, "build", "--product=swiftly", "--pkg-config-path=\(pkgConfigPath)/lib/pkgconfig", "--static-swift-stdlib", "--configuration=release")
357366

docker/docker-compose.1804.yaml

Lines changed: 0 additions & 24 deletions
This file was deleted.

docker/docker-compose.2004.yaml

Lines changed: 0 additions & 24 deletions
This file was deleted.

docker/docker-compose.2204.yaml

Lines changed: 0 additions & 24 deletions
This file was deleted.

docker/docker-compose.2404.yaml

Lines changed: 0 additions & 24 deletions
This file was deleted.

docker/docker-compose.amazonlinux2.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

docker/docker-compose.debian12.yaml

Lines changed: 0 additions & 24 deletions
This file was deleted.

docker/docker-compose.fedora39.yaml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)