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(