Skip to content

Commit a4c19f8

Browse files
committed
Add support for Amazon Linux 2023 in CI
1 parent dfb0982 commit a4c19f8

5 files changed

Lines changed: 15 additions & 9 deletions

File tree

.github/scripts/prebuild.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,14 @@ elif command -v apt-get >/dev/null 2>&1 ; then # bookworm, noble, jammy
7272
else
7373
echo "Skipping Android NDK installation on $dpkg_architecture" >&2
7474
fi
75-
elif command -v dnf >/dev/null 2>&1 ; then # rhel-ubi9
75+
elif command -v dnf >/dev/null 2>&1 ; then # amazonlinux2023, rhel-ubi9
7676
$sudo dnf update -y
7777

7878
# Build dependencies
7979
$sudo dnf install -y sqlite-devel ncurses-devel python3
8080

8181
# Debug symbols
82+
$sudo dnf install 'dnf-command(debuginfo-install)'
8283
$sudo dnf debuginfo-install -y glibc
8384
elif command -v yum >/dev/null 2>&1 ; then # amazonlinux2
8485
$sudo yum update -y

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
needs: [soundness, space-format-check]
1919
with:
2020
enable_cross_pr_testing: true
21-
linux_os_versions: '["amazonlinux2", "bookworm", "noble", "jammy", "rhel-ubi9"]'
21+
linux_os_versions: '["amazonlinux2", "amazonlinux2023", "bookworm", "noble", "jammy", "rhel-ubi9"]'
2222
linux_pre_build_command: ./.github/scripts/prebuild.sh
2323
linux_build_command: 'swift test --no-parallel'
2424
linux_swift_versions: '["nightly-main", "nightly-6.3"]'

Sources/SWBTestSupport/SkippedTestSupport.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ extension Trait where Self == Testing.ConditionTrait {
233233
}
234234
}
235235

236-
package static func requireSystemPackages(apt: String..., yum: String..., freebsd: String..., openbsd: String..., sourceLocation: SourceLocation = #_sourceLocation) -> Self {
236+
package static func requireSystemPackages(apt: String..., dnf: String..., freebsd: String..., openbsd: String..., sourceLocation: SourceLocation = #_sourceLocation) -> Self {
237237
enabled("required system packages are not installed") {
238238
func installCommand(packageManagerPath: Path, packageNames: String) -> String {
239239
switch packageManagerPath.basenameWithoutSuffix {
@@ -272,14 +272,19 @@ extension Trait where Self == Testing.ConditionTrait {
272272

273273
let apt = try await checkInstalled(hostOS: .linux, packageManagerPath: Path("/usr/bin/apt"), args: ["list", "--installed", "apt"], packages: apt, regex: #/(?<name>.+)\//#)
274274

275-
// spelled `--installed` in newer versions of yum, but Amazon Linux 2 is on older versions
276-
let yum = try await checkInstalled(hostOS: .linux, packageManagerPath: Path("/usr/bin/yum"), args: ["list", "installed", "yum"], packages: yum, regex: #/(?<name>.+)\./#)
275+
let dnf = {
276+
guard fs.exists(Path("/usr/bin/dnf")) else {
277+
// spelled `--installed` in newer versions of yum, but Amazon Linux 2 is on older versions
278+
return try await checkInstalled(hostOS: .linux, packageManagerPath: Path("/usr/bin/yum"), args: ["list", "installed", "yum"], packages: dnf, regex: #/(?<name>.+)\./#)
279+
}
280+
return try await checkInstalled(hostOS: .linux, packageManagerPath: Path("/usr/bin/dnf"), args: ["list", "--installed", "dnf"], packages: dnf, regex: #/(?<name>.+)\./#)
281+
}()
277282

278283
let freebsd = try await checkInstalled(hostOS: .freebsd, packageManagerPath: Path("/usr/sbin/pkg"), args: ["info"], packages: freebsd, regex: #/^Name(?:[ ]+): (?<name>.+)$/#)
279284

280285
let openbsd = try await checkInstalled(hostOS: .openbsd, packageManagerPath: Path("/usr/sbin/pkg_info"), args: ["-A"], packages: openbsd, regex: #/^(?<name>.+)-.*/#)
281286

282-
return apt && yum && freebsd && openbsd
287+
return apt && dnf && freebsd && openbsd
283288
}
284289
}
285290

Tests/SWBBuildSystemTests/BuildOperationTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ fileprivate struct BuildOperationTests: CoreBasedTests {
10021002
}
10031003

10041004
/// Check that environment variables are propagated from the user environment correctly.
1005-
@Test(.requireSDKs(.host), .skipHostOS(.windows), .requireSystemPackages(apt: "yacc", yum: "byacc"))
1005+
@Test(.requireSDKs(.host), .skipHostOS(.windows), .requireSystemPackages(apt: "yacc", dnf: "byacc"))
10061006
func userEnvironment() async throws {
10071007
try await withTemporaryDirectory { tmpDirPath async throws -> Void in
10081008
let testWorkspace = TestWorkspace(
@@ -2902,7 +2902,7 @@ That command depends on command in Target 'agg2' (project \'aProject\'): script
29022902
}
29032903

29042904
/// Check non-UTF8 encoded shell scripts don't cause any unexpected issues.
2905-
@Test(.requireSDKs(.host), .skipHostOS(.windows), .requireSystemPackages(apt: "xxd", yum: "vim-common", freebsd: "xxd", openbsd: "vim"))
2905+
@Test(.requireSDKs(.host), .skipHostOS(.windows), .requireSystemPackages(apt: "xxd", dnf: "vim-common", freebsd: "xxd", openbsd: "vim"))
29062906
func nonUTF8ShellScript() async throws {
29072907
try await withTemporaryDirectory { tmpDir in
29082908
let testWorkspace = TestWorkspace(

Tests/SWBCoreTests/CommandLineToolSpecDiscoveredInfoTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ import SWBMacro
242242
}
243243
}
244244

245-
@Test(.skipHostOS(.windows), .requireSystemPackages(apt: "libtool", yum: "libtool", freebsd: "libtool", openbsd: "libtool"))
245+
@Test(.skipHostOS(.windows), .requireSystemPackages(apt: "libtool", dnf: "libtool", freebsd: "libtool", openbsd: "libtool"))
246246
func discoveredLibtoolSpecInfo() async throws {
247247
try await withSpec(LibtoolLinkerSpec.self, .deferred) { (info: DiscoveredLibtoolLinkerToolSpecInfo) in
248248
#expect(info.toolPath.basename == "libtool")

0 commit comments

Comments
 (0)