From 1219f64e131d8c5e87eee720433a9f3fc14ca39e Mon Sep 17 00:00:00 2001 From: Rick Newton-Rogers Date: Tue, 10 Nov 2026 08:51:36 -0500 Subject: [PATCH] Don't set the minimum Swift version floor at the patch level A manifest with `swift-tools-version: 6.2.3` produced a floor of `6.2.3`, while the `6.2` version label orders as `6.2.0`. The filter then skipped Swift 6.2 even though the `6.2` toolchain satisfies that tools version. Changed: * Truncated the floor in `MinimumVersion` to its major and minor components. * Added tests for a patch tools version and a patch `minimum_swift_version`. Result: * A patch-level minimum keeps its own minor release in the matrix. --- .../scripts/matrix/generate-matrix.swift | 3 ++- .../MatrixGeneratorTests/CoreTests.swift | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/scripts/matrix/generate-matrix.swift b/.github/workflows/scripts/matrix/generate-matrix.swift index a4130c4d..a3c35b4c 100644 --- a/.github/workflows/scripts/matrix/generate-matrix.swift +++ b/.github/workflows/scripts/matrix/generate-matrix.swift @@ -1718,7 +1718,8 @@ struct MinimumVersion { """ ) } - self.floor = version + // The floor is the minor release, not the patch: a `6.2` label must satisfy a `6.2.3` minimum. + self.floor = SwiftVersion(majorMinor: "\(version.major).\(version.minor)") } /// A nightly is always kept: it is not a released version this can order. diff --git a/tests/MatrixGeneratorValidator/Tests/MatrixGeneratorTests/CoreTests.swift b/tests/MatrixGeneratorValidator/Tests/MatrixGeneratorTests/CoreTests.swift index c8245459..7cbe636d 100644 --- a/tests/MatrixGeneratorValidator/Tests/MatrixGeneratorTests/CoreTests.swift +++ b/tests/MatrixGeneratorValidator/Tests/MatrixGeneratorTests/CoreTests.swift @@ -277,6 +277,25 @@ struct MinimumVersionTests { #expect(generated.versions == ["6.2", "6.3"]) } + @Test("A patch tools version keeps its own minor release, which is published as major.minor") + func patchToolsVersionKeepsItsMinorRelease() throws { + let generated = try Generator.run( + ["ENABLE_LINUX": "true", "LINUX_SWIFT_VERSIONS": #"["6.1","6.2","6.3"]"#], + manifests: ["Package.swift": Generator.manifest(toolsVersion: "6.2.3")] + ) + #expect(generated.versions == ["6.2", "6.3"]) + } + + @Test("A patch minimum_swift_version keeps its own minor release") + func patchExplicitMinimumKeepsItsMinorRelease() throws { + let generated = try Generator.run([ + "ENABLE_LINUX": "true", + "LINUX_SWIFT_VERSIONS": #"["6.1","6.2","6.3"]"#, + "MINIMUM_SWIFT_VERSION": "6.2.3", + ]) + #expect(generated.versions == ["6.2", "6.3"]) + } + @Test("The lowest of all manifests wins") func lowestManifestWins() throws { let generated = try Generator.run(