Skip to content

Commit b6968de

Browse files
committed
Update to new Swift version
1 parent d77d3f0 commit b6968de

25 files changed

Lines changed: 184 additions & 128 deletions

Sources/App/Core/SwiftVersion+Build.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,27 @@ extension SwiftVersion {
1818
// https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/1267#issuecomment-975379966
1919
// Patch versions are irrelevant here but the underlying type requires one, so use 0
2020
// in general.
21-
static let v5_10: Self = .init(5, 10, 0)
2221
static let v6_0: Self = .init(6, 0, 0)
2322
static let v6_1: Self = .init(6, 1, 0)
2423
static let v6_2: Self = .init(6, 2, 0)
24+
static let v6_3: Self = .init(6, 3, 0)
2525

2626
/// Currently supported swift versions for building
2727
static var allActive: [Self] {
28-
[.v5_10, .v6_0, .v6_1, .v6_2]
28+
[.v6_0, .v6_1, .v6_2, .v6_3]
2929
}
3030

3131
var xcodeVersion: String? {
3232
// NB: this is used for display purposes and not critical for compiler selection
3333
switch self {
34-
case .v5_10:
35-
return "Xcode 15.4"
3634
case .v6_0:
3735
return "Xcode 16.2"
3836
case .v6_1:
3937
return "Xcode 16.3"
4038
case .v6_2:
41-
return "Xcode 26.0"
39+
return "Xcode 26.3"
40+
case .v6_3:
41+
return "Xcode 26.4"
4242
default:
4343
return nil
4444
}

Tests/AppTests/AlertingTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ extension AllTests.AlertingTests {
3434
Alerting.BuildInfo.mock(swiftVersion: $0)
3535
}
3636
#expect(all.validateSwiftVersionsPresent() == .ok)
37-
#expect(all.filter { $0.swiftVersion != .v1 }.validateSwiftVersionsPresent() == .failed(reasons: ["Missing Swift version: 5.10"]))
38-
#expect(all.filter { $0.swiftVersion != .v1 && $0.swiftVersion != .v2 }.validateSwiftVersionsPresent() == .failed(reasons: ["Missing Swift version: 5.10", "Missing Swift version: 6.0"]))
37+
#expect(all.filter { $0.swiftVersion != .v1 }.validateSwiftVersionsPresent() == .failed(reasons: ["Missing Swift version: 6.0"]))
38+
#expect(all.filter { $0.swiftVersion != .v1 && $0.swiftVersion != .v2 }.validateSwiftVersionsPresent() == .failed(reasons: ["Missing Swift version: 6.0", "Missing Swift version: 6.1"]))
3939
}
4040

4141
@Test func validatePlatformsSuccessful() throws {
@@ -57,13 +57,13 @@ extension AllTests.AlertingTests {
5757
Alerting.BuildInfo.mock(swiftVersion: $0, status: .ok)
5858
}
5959
#expect(all.validateSwiftVersionsSuccessful() == .ok)
60-
#expect(all.filter { $0.swiftVersion != .v1 }.validateSwiftVersionsSuccessful() == .failed(reasons: ["Swift version without successful builds: 5.10"]))
60+
#expect(all.filter { $0.swiftVersion != .v1 }.validateSwiftVersionsSuccessful() == .failed(reasons: ["Swift version without successful builds: 6.0"]))
6161
#expect(
6262
Array(all.filter { $0.swiftVersion != .v1 })
6363
.appending(.mock(swiftVersion: .v1, status: .failed))
64-
.validateSwiftVersionsSuccessful() == .failed(reasons: ["Swift version without successful builds: 5.10"])
64+
.validateSwiftVersionsSuccessful() == .failed(reasons: ["Swift version without successful builds: 6.0"])
6565
)
66-
#expect(all.filter { $0.swiftVersion != .v1 && $0.swiftVersion != .v2 }.validateSwiftVersionsSuccessful() == .failed(reasons: ["Swift version without successful builds: 5.10", "Swift version without successful builds: 6.0"]))
66+
#expect(all.filter { $0.swiftVersion != .v1 && $0.swiftVersion != .v2 }.validateSwiftVersionsSuccessful() == .failed(reasons: ["Swift version without successful builds: 6.0", "Swift version without successful builds: 6.1"]))
6767
}
6868

6969
@Test func validateRunnerIdsPresent() throws {

Tests/AppTests/ApiTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ extension AllTests.ApiTests {
818818
let badge = try res.content.decode(Badge.self)
819819
#expect(badge.schemaVersion == 1)
820820
#expect(badge.label == "Swift")
821-
#expect(badge.message == "6.0 | 5.10")
821+
#expect(badge.message == "6.1 | 6.0")
822822
#expect(badge.isError == false)
823823
#expect(badge.color == "blue")
824824
#expect(badge.cacheSeconds == 6*3600)

Tests/AppTests/BadgeTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import Testing
2020
extension AllTests.BadgeTests {
2121

2222
@Test func badgeMessage_swiftVersions() throws {
23-
#expect(Badge.badgeMessage(swiftVersions: [.v1, .v2, .v3, .v4]) == "6.2 | 6.1 | 6.0 | 5.10")
23+
#expect(Badge.badgeMessage(swiftVersions: [.v1, .v2, .v3, .v4]) == "6.3 | 6.2 | 6.1 | 6.0")
2424
#expect(Badge.badgeMessage(swiftVersions: []) == nil)
2525
}
2626

Tests/AppTests/BuildIndexModelTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ extension AllTests.BuildIndexModelTests {
9696
let matrix = model.buildMatrix
9797

9898
// validate
99-
#expect(matrix.values.keys.count == 32)
99+
#expect(matrix.values.keys.count == 34)
100100
#expect(
101101
matrix.values[.init(swiftVersion: .v3, platform: .iOS)]?.map(\.column.label) == ["1.2.3", "2.0.0-b1", "main"]
102102
)
@@ -141,7 +141,7 @@ extension AllTests.BuildIndexModelTests {
141141
let matrix = model.buildMatrix
142142

143143
// validate
144-
#expect(matrix.values.keys.count == 32)
144+
#expect(matrix.values.keys.count == 34)
145145
#expect(
146146
matrix.values[.init(swiftVersion: .v3, platform: .iOS)]?.map(\.column.label) == ["1.2.3", "main"]
147147
)

Tests/AppTests/BuildTriggerTests.swift

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ extension AllTests.BuildTriggerTests {
267267
"\(v) could not be converted to a SPIManifest Swift version")
268268
}
269269
// Check the values specifically (which we can't easily do in the loop above)
270-
#expect(BuildPair(.iOS, .v5_10).manifestSwiftVersion == .v5_10)
271270
#expect(BuildPair(.iOS, .v6_0).manifestSwiftVersion == .v6_0)
272271
#expect(BuildPair(.iOS, .v6_1).manifestSwiftVersion == .v6_1)
273272
#expect(BuildPair(.iOS, .v6_2).manifestSwiftVersion == .v6_2)
273+
#expect(BuildPair(.iOS, .v6_3).manifestSwiftVersion == .v6_3)
274274
}
275275

276276
@Test func SPIManifest_docPairs() throws {
@@ -281,7 +281,7 @@ extension AllTests.BuildTriggerTests {
281281
configs:
282282
- documentation_targets: [t0]
283283
""")
284-
#expect(manifest.docPairs == [.init(.macosSpm, .v6_2)])
284+
#expect(manifest.docPairs == [.init(.macosSpm, .v6_3)])
285285
}
286286
do {
287287
let manifest = try SPIManifest.Manifest(yml: """
@@ -290,9 +290,9 @@ extension AllTests.BuildTriggerTests {
290290
configs:
291291
- documentation_targets: [t0]
292292
platform: ios
293-
swift_version: 5.10
293+
swift_version: 6.0
294294
""")
295-
#expect(manifest.docPairs == [.init(.iOS, .v5_10)])
295+
#expect(manifest.docPairs == [.init(.iOS, .v6_0)])
296296
}
297297
do {
298298
let manifest = try SPIManifest.Manifest(yml: """
@@ -302,12 +302,12 @@ extension AllTests.BuildTriggerTests {
302302
configs:
303303
- documentation_targets: [t0]
304304
platform: ios
305-
swift_version: 5.10
305+
swift_version: 6.0
306306
- documentation_targets: [t0]
307307
platform: macos-spm
308-
swift_version: 6.0
308+
swift_version: 6.1
309309
""")
310-
#expect(manifest.docPairs == [.init(.iOS, .v5_10), .init(.macosSpm, .v6_0)])
310+
#expect(manifest.docPairs == [.init(.iOS, .v6_0), .init(.macosSpm, .v6_1)])
311311
}
312312
}
313313

@@ -349,7 +349,7 @@ extension AllTests.BuildTriggerTests {
349349
let expectedPairs = Set(SwiftVersion.allActive.map { BuildPair(.macosSpm, $0) })
350350
#expect(res == [.init(versionId: versionId,
351351
buildPairs: expectedPairs,
352-
docPairs: .init([.init(.macosSpm, .v6_2)]),
352+
docPairs: .init([.init(.macosSpm, .v6_3)]),
353353
reference: .tag(1, 2, 3))!])
354354
}
355355
}
@@ -390,7 +390,7 @@ extension AllTests.BuildTriggerTests {
390390
#expect(queries.count == 1)
391391
#expect(queries.value.map { $0.variables["VERSION_ID"] } == [versionId.uuidString])
392392
#expect(queries.value.map { $0.variables["BUILD_PLATFORM"] } == ["ios"])
393-
#expect(queries.value.map { $0.variables["SWIFT_VERSION"] } == ["5.10"])
393+
#expect(queries.value.map { $0.variables["SWIFT_VERSION"] } == ["6.0"])
394394

395395
// ensure the Build stubs is created to prevent re-selection
396396
let v = try await Version.find(versionId, on: app.db)
@@ -437,30 +437,30 @@ extension AllTests.BuildTriggerTests {
437437

438438
// validate
439439
// ensure Gitlab requests go out
440-
#expect(queries.count == 32)
441-
#expect(queries.value.map { $0.variables["VERSION_ID"] } == Array(repeating: versionId.uuidString, count: 32))
440+
#expect(queries.count == 34)
441+
#expect(queries.value.map { $0.variables["VERSION_ID"] } == Array(repeating: versionId.uuidString, count: 34))
442442
let buildPlatforms = queries.value.compactMap { $0.variables["BUILD_PLATFORM"] }
443443
#expect(Dictionary(grouping: buildPlatforms, by: { $0 })
444-
.mapValues(\.count) == ["android": 2,
444+
.mapValues(\.count) == ["android": 3,
445445
"ios": 4,
446446
"macos-spm": 4,
447447
"macos-xcodebuild": 4,
448448
"linux": 4,
449-
"wasm": 2,
449+
"wasm": 3,
450450
"watchos": 4,
451451
"visionos": 4,
452452
"tvos": 4])
453453
let swiftVersions = queries.value.compactMap { $0.variables["SWIFT_VERSION"] }
454454
#expect(Dictionary(grouping: swiftVersions, by: { $0 })
455455
.mapValues(\.count) == [SwiftVersion.v1.description(droppingZeroes: .patch): 7,
456-
SwiftVersion.v2.description(droppingZeroes: .patch): 7,
456+
SwiftVersion.v2.description(droppingZeroes: .patch): 9,
457457
SwiftVersion.v3.description(droppingZeroes: .patch): 9,
458458
SwiftVersion.v4.description(droppingZeroes: .patch): 9])
459459

460460
// ensure the Build stubs are created to prevent re-selection
461461
let v = try await Version.find(versionId, on: app.db)
462462
try await v?.$builds.load(on: app.db)
463-
#expect(v?.builds.count == 32)
463+
#expect(v?.builds.count == 34)
464464

465465
// ensure re-selection is empty
466466
let candidates = try await fetchBuildCandidates(app.db)
@@ -598,11 +598,11 @@ extension AllTests.BuildTriggerTests {
598598
try await triggerBuilds(on: app.db, mode: .packageId(pkgId, force: false))
599599

600600
// validate
601-
#expect(triggerCount.value == 32)
601+
#expect(triggerCount.value == 34)
602602
// ensure builds are now in progress
603603
let v = try await Version.find(versionId, on: app.db)
604604
try await v?.$builds.load(on: app.db)
605-
#expect(v?.builds.count == 32)
605+
#expect(v?.builds.count == 34)
606606
}
607607
}
608608

@@ -623,11 +623,11 @@ extension AllTests.BuildTriggerTests {
623623
try await triggerBuilds(on: app.db, mode: .packageId(pkgId, force: true))
624624

625625
// validate
626-
#expect(triggerCount.value == 32)
626+
#expect(triggerCount.value == 34)
627627
// ensure builds are now in progress
628628
let v = try await Version.find(versionId, on: app.db)
629629
try await v?.$builds.load(on: app.db)
630-
#expect(v?.builds.count == 32)
630+
#expect(v?.builds.count == 34)
631631
}
632632
}
633633
}
@@ -672,7 +672,7 @@ extension AllTests.BuildTriggerTests {
672672
try await triggerBuilds(on: app.db, mode: .limit(4))
673673

674674
// validate - only the first batch must be allowed to trigger
675-
#expect(triggerCount.value == 32)
675+
#expect(triggerCount.value == 34)
676676
}
677677
}
678678
}
@@ -753,7 +753,7 @@ extension AllTests.BuildTriggerTests {
753753
try await triggerBuilds(on: app.db, mode: .packageId(.id0, force: false))
754754

755755
// Ensure all triggers were attempted
756-
#expect(triggerCount.value == 32)
756+
#expect(triggerCount.value == 34)
757757

758758
// validate that one build record is saved, for the successful trigger
759759
let count = try await Build.query(on: app.db).count()
@@ -888,7 +888,7 @@ extension AllTests.BuildTriggerTests {
888888
try await triggerBuilds(on: app.db, mode: .packageId(pkgId, force: false))
889889

890890
// validate
891-
#expect(triggerCount.value == 32)
891+
#expect(triggerCount.value == 34)
892892
}
893893
}
894894
}
@@ -950,7 +950,7 @@ extension AllTests.BuildTriggerTests {
950950
try await triggerBuilds(on: app.db, mode: .packageId(pkgId, force: false))
951951

952952
// validate
953-
#expect(triggerCount.value == 32)
953+
#expect(triggerCount.value == 34)
954954
}
955955
}
956956
}
@@ -991,7 +991,7 @@ extension AllTests.BuildTriggerTests {
991991
try await triggerBuilds(on: app.db, mode: .packageId(.id0, force: false))
992992

993993
// validate
994-
#expect(triggerCount.value == 32)
994+
#expect(triggerCount.value == 34)
995995
}
996996
}
997997
}
@@ -1235,7 +1235,7 @@ extension AllTests.BuildTriggerTests {
12351235

12361236
@Test func BuildPair_all() throws {
12371237
// Sanity checks for critical counts used in canadidate selection
1238-
#expect(BuildPair.all.count == 32)
1238+
#expect(BuildPair.all.count == 34)
12391239
#expect(BuildPair.all == [
12401240
.init(.iOS, .v1),
12411241
.init(.iOS, .v2),
@@ -1265,12 +1265,14 @@ extension AllTests.BuildTriggerTests {
12651265
.init(.linux, .v2),
12661266
.init(.linux, .v3),
12671267
.init(.linux, .v4),
1268+
.init(.wasm, .v2),
12681269
.init(.wasm, .v3),
12691270
.init(.wasm, .v4),
1271+
.init(.android, .v2),
12701272
.init(.android, .v3),
12711273
.init(.android, .v4),
12721274
])
1273-
#expect(BuildPair.allExceptLatestSwiftVersion.count == 23)
1275+
#expect(BuildPair.allExceptLatestSwiftVersion.count == 25)
12741276
}
12751277

12761278
@Test func BuildPair_Equatable() throws {
@@ -1315,7 +1317,7 @@ extension AllTests.BuildTriggerTests {
13151317
let res = try await findMissingBuilds(app.db, packageId: pkgId)
13161318
#expect(res.count == 1)
13171319
let triggerInfo = try #require(res.first)
1318-
#expect(triggerInfo.buildPairs.count == 31)
1320+
#expect(triggerInfo.buildPairs.count == 33)
13191321
#expect(!triggerInfo.buildPairs.contains(.init(.iOS, .v1)))
13201322
}
13211323
}

Tests/AppTests/Helpers/SwiftVersion+ext.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ extension SwiftVersion {
7171
/// ```
7272
///
7373
/// And then all that remains is to adjust the mapping below whenever we change the range of Swift versions.
74-
static var v1: Self { .v5_10 }
75-
static var v2: Self { .v6_0 }
76-
static var v3: Self { .v6_1 }
77-
static var v4: Self { .v6_2 }
74+
static var v1: Self { .v6_0 }
75+
static var v2: Self { .v6_1 }
76+
static var v3: Self { .v6_2 }
77+
static var v4: Self { .v6_3 }
7878

7979
func incrementingPatchVersion(by value: Int = 1) -> Self {
8080
.init(major, minor, patch + value)

Tests/AppTests/PackageCollectionTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ extension AllTests.PackageCollectionTests {
265265
#expect(res.version == "1.2.3")
266266
#expect(res.summary == "Bar")
267267
#expect(res.verifiedCompatibility == [
268-
.init(platform: .init(name: "ios"), swiftVersion: .init("5.10")),
269-
.init(platform: .init(name: "macos"), swiftVersion: .init("6.0")),
268+
.init(platform: .init(name: "ios"), swiftVersion: .init("6.0")),
269+
.init(platform: .init(name: "macos"), swiftVersion: .init("6.1")),
270270
])
271271
#expect(res.license == .init(name: "MIT", url: URL(string: "https://foo/mit")!))
272272
#expect(res.createdAt == Date(timeIntervalSince1970: 0))

0 commit comments

Comments
 (0)