Skip to content

Commit c35819a

Browse files
authored
Add a github workflow for Linux based on the swiftlang template (#184)
Test on the Linux distributions that Swiftly currently supports. Also, test with the latest stable Swift toolchain. Build libarchive and install it using the shell script. Remove docker compose files because they are no longer needed. Fix lint errors. Remove Amazon Linux 2 because it is not supported with github actions. Make swiftly releases from RHEL9 since it has the oldest glibc of the remaining linux distributions. Add a release build using RHEL9 and add a formatter stage.
1 parent 7ea0dd9 commit c35819a

16 files changed

+56
-298
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: 3 additions & 3 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
}

docker/docker-compose.1804.yaml

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

docker/docker-compose.2004.yaml

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

docker/docker-compose.2204.yaml

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

docker/docker-compose.amazonlinux2.yaml

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

docker/docker-compose.ubi9.yaml

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

docker/docker-compose.yaml

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

docker/install-test-amazonlinux2.dockerfile

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

0 commit comments

Comments
 (0)