diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 2970f73c..eef1905f 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -44,8 +44,8 @@ on: default: "" macos_runner_pool: type: string - description: "The self-hosted runner pool for macOS benchmark jobs." - default: "general" + description: "Label of the pool of self-hosted macOS runners to use, for an organization that splits its runners into pools such as general and nightly. Empty adds no pool label." + default: "" linux_env_vars: type: string description: "Environment variables for Linux jobs as JSON." diff --git a/.github/workflows/package_test.yml b/.github/workflows/package_test.yml index 1bde8535..2f700bd7 100644 --- a/.github/workflows/package_test.yml +++ b/.github/workflows/package_test.yml @@ -347,8 +347,8 @@ on: default: "ARM64" macos_runner_pool: type: string - description: "macOS self-hosted runner pool label." - default: "general" + description: "Label of the pool of self-hosted macOS runners to use, for an organization that splits its runners into pools such as general and nightly. Empty adds no pool label." + default: "" xcode_debug_output: type: boolean description: "Drop -quiet from the xcodebuild target invocations." diff --git a/.github/workflows/scripts/matrix/generate-matrix.swift b/.github/workflows/scripts/matrix/generate-matrix.swift index 04268be4..49f15b70 100644 --- a/.github/workflows/scripts/matrix/generate-matrix.swift +++ b/.github/workflows/scripts/matrix/generate-matrix.swift @@ -71,7 +71,7 @@ struct Configuration { @Input("MACOS_SWIFT_VERSIONS") var macOSVersions: [String] = [] @Input("MACOS_OS") var macOSOS: OSList = "tahoe" @Input("MACOS_ARCH") var macOSArchitecture = "ARM64" - @Input("MACOS_RUNNER_POOL") var macOSPool = "general" + @Input("MACOS_RUNNER_POOL") var macOSPool = "" @Input("MACOS_COMMAND") var macOSCommands: Commands = "xcrun swift test" @Input("MACOS_SETUP_COMMAND") var macOSSetupCommand = "" @Input("MACOS_ENV_VARS") var macOSEnvironment = JSONValue.object([:]) @@ -900,9 +900,12 @@ struct Runner { Runner(labels: [label], name: label) } - /// A machine from one of the self-hosted macOS pools. + /// A machine from the self-hosted macOS runners, in one of their pools if the organization + /// splits them into pools. A pool label no runner carries leaves the job waiting forever, + /// so an empty pool adds none. static func macOS(os: String, architecture: String, pool: String) -> Runner { - Runner(labels: ["self-hosted", "macos", os, architecture, pool], name: os) + let poolLabels = pool.isEmpty ? [] : [pool] + return Runner(labels: ["self-hosted", "macos", os, architecture] + poolLabels, name: os) } } diff --git a/.github/workflows/toolchain_matrix.yml b/.github/workflows/toolchain_matrix.yml index 5f3be67c..e5025498 100644 --- a/.github/workflows/toolchain_matrix.yml +++ b/.github/workflows/toolchain_matrix.yml @@ -94,8 +94,8 @@ on: default: "ARM64" macos_runner_pool: type: string - description: "macOS self-hosted runner pool label." - default: "general" + description: "Label of the pool of self-hosted macOS runners to use, for an organization that splits its runners into pools such as general and nightly. Empty adds no pool label." + default: "" windows_swift_versions: type: string description: "Windows Swift version list (JSON/YAML array). Empty uses current-2, current-1, current, nightly-release and nightly-main." diff --git a/tests/MatrixGeneratorValidator/Tests/MatrixGeneratorTests/CoreTests.swift b/tests/MatrixGeneratorValidator/Tests/MatrixGeneratorTests/CoreTests.swift index 0879bc57..5c8222ec 100644 --- a/tests/MatrixGeneratorValidator/Tests/MatrixGeneratorTests/CoreTests.swift +++ b/tests/MatrixGeneratorValidator/Tests/MatrixGeneratorTests/CoreTests.swift @@ -127,7 +127,7 @@ struct OSInputTests { let macOS = try Generator.run([ "ENABLE_MACOS": "true", "MACOS_SWIFT_VERSIONS": #"["6.3"]"#, "MACOS_OS": "sequoia", ]) - #expect(macOS.entries.first?.runner == ["self-hosted", "macos", "sequoia", "ARM64", "general"]) + #expect(macOS.entries.first?.runner == ["self-hosted", "macos", "sequoia", "ARM64"]) let windows = try Generator.run([ "ENABLE_WINDOWS": "true", "WINDOWS_SWIFT_VERSIONS": #"["6.3"]"#, "WINDOWS_OS": "windows-11-arm", @@ -150,7 +150,7 @@ struct OSInputTests { let macOS = try Generator.run([ "ENABLE_MACOS": "true", "MACOS_SWIFT_VERSIONS": #"["6.3"]"#, "MACOS_OS": "26.10", ]) - #expect(macOS.entries.first?.runner == ["self-hosted", "macos", "26.10", "ARM64", "general"]) + #expect(macOS.entries.first?.runner == ["self-hosted", "macos", "26.10", "ARM64"]) } @Test("One OS leaves the job names alone, however it is written") @@ -252,6 +252,18 @@ struct OSInputTests { #expect(generated.standardError.contains(#"["jammy""#)) #expect(!generated.standardError.contains("bad file")) } + + @Test("A pool label is added to the runner labels only when one is given") + func macOSPoolLabelIsOptional() throws { + let environment = ["ENABLE_MACOS": "true", "MACOS_SWIFT_VERSIONS": #"["6.3"]"#, "MACOS_OS": "tahoe"] + let without = try Generator.run(environment) + #expect(without.entries.first?.runner == ["self-hosted", "macos", "tahoe", "ARM64"]) + + var pooled = environment + pooled["MACOS_RUNNER_POOL"] = "nightly" + let with = try Generator.run(pooled) + #expect(with.entries.first?.runner == ["self-hosted", "macos", "tahoe", "ARM64", "nightly"]) + } } @Suite("Minimum version detection") diff --git a/tests/MatrixGeneratorValidator/Tests/MatrixGeneratorTests/PlatformTests.swift b/tests/MatrixGeneratorValidator/Tests/MatrixGeneratorTests/PlatformTests.swift index 706e5a63..1542275d 100644 --- a/tests/MatrixGeneratorValidator/Tests/MatrixGeneratorTests/PlatformTests.swift +++ b/tests/MatrixGeneratorValidator/Tests/MatrixGeneratorTests/PlatformTests.swift @@ -177,7 +177,7 @@ struct MacOSTests { let entry = try #require(generated.entries.first) #expect(entry.xcodeBuild?.xcodeVersion == "swift_6.3") #expect(entry.xcodeBuild?.swiftlyToolchain == "main-snapshot") - #expect(entry.runner == ["self-hosted", "macos", "sequoia", "X64", "general"]) + #expect(entry.runner == ["self-hosted", "macos", "sequoia", "X64"]) #expect(entry.command == "swiftly run swift build") }