Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.gitlab.com/finestructure/spi-base:1.3.0
FROM registry.gitlab.com/finestructure/spi-base:2.0.0

# Install SPM build dependencies
RUN apt-get update && apt-get install -y curl git make unzip \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
name: Test
runs-on: ubuntu-latest
container:
image: registry.gitlab.com/finestructure/spi-base:1.3.0
image: registry.gitlab.com/finestructure/spi-base:2.0.0
options: --privileged
steps:
- name: GH Runner bug workaround
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
name: Release build
runs-on: ubuntu-latest
container:
image: registry.gitlab.com/finestructure/spi-base:1.3.0
image: registry.gitlab.com/finestructure/spi-base:2.0.0
options: --privileged
steps:
- name: GH Runner bug workaround
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/query-performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: registry.gitlab.com/finestructure/spi-base:1.3.0
image: registry.gitlab.com/finestructure/spi-base:2.0.0
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# ================================
# Build image
# ================================
FROM registry.gitlab.com/finestructure/spi-base:1.3.0 as build
FROM registry.gitlab.com/finestructure/spi-base:2.0.0 as build

# Set up a build area
WORKDIR /build
Expand Down Expand Up @@ -62,7 +62,7 @@ RUN [ -d /build/Resources ] && { mv /build/Resources ./Resources && chmod -R a-w
# ================================
# Run image
# ================================
FROM registry.gitlab.com/finestructure/spi-base:1.3.0
FROM registry.gitlab.com/finestructure/spi-base:2.0.0

# NB sas 2022-09-23: We're not using a dedicated `vapor` user to run the executable, because it
# makes managing the data in the checkouts volume difficult. See
Expand Down
2 changes: 1 addition & 1 deletion LOCAL_DEVELOPMENT_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ The trickiest part of this is to ensure the test or app container can connect to
So, in order to run the tests in a Linux container run:

```
docker run --rm -v "$PWD":/host -w /host --add-host=host.docker.internal:host-gateway registry.gitlab.com/finestructure/spi-base:1.3.0 swift test
docker run --rm -v "$PWD":/host -w /host --add-host=host.docker.internal:host-gateway registry.gitlab.com/finestructure/spi-base:2.0.0 swift test
```

Make sure you use the most recent `spi-base` image. You can find the latest image name in the `test-docker` target, which also provides a convenient way to run all all tests in a docker container.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ test-docker:
@# run tests inside a docker container
docker run --rm -v "$(PWD)":/host -w /host \
--add-host=host.docker.internal:host-gateway \
registry.gitlab.com/finestructure/spi-base:1.3.0 \
registry.gitlab.com/finestructure/spi-base:2.0.0 \
make test

test-e2e: db-reset reconcile ingest analyze
Expand Down
6 changes: 3 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
.package(url: "https://github.com/SwiftPackageIndex/Plot.git", branch: "main"),
.package(url: "https://github.com/SwiftPackageIndex/CanonicalPackageURL.git", from: "1.0.0"),
.package(url: "https://github.com/SwiftPackageIndex/DependencyResolution.git", from: "1.1.2"),
.package(url: "https://github.com/SwiftPackageIndex/SPIManifest.git", from: "1.9.0"),
.package(url: "https://github.com/SwiftPackageIndex/SPIManifest.git", from: "1.10.0"),
.package(url: "https://github.com/SwiftPackageIndex/SemanticVersion.git", from: "0.3.0"),
.package(url: "https://github.com/SwiftPackageIndex/ShellOut.git", from: "3.3.0"),
.package(url: "https://github.com/finestructure/swift-package-manager.git", branch: "release/6.1"),
Expand Down
3 changes: 1 addition & 2 deletions Sources/App/Commands/TriggerBuilds.swift
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,7 @@ struct BuildPair {
case .iOS, .linux, .macosSpm, .macosXcodebuild, .tvOS, .watchOS:
return BuildPair(platform, swiftVersion)
case .visionOS:
// visionOS is only available for Swift versions 5.9+
return swiftVersion >= .v5_9 ? BuildPair(platform, swiftVersion) : nil
return BuildPair(platform, swiftVersion)
case .wasm:
// Android is supported from Swift version 6.1+
return swiftVersion >= .v6_1 ? BuildPair(platform, swiftVersion) : nil
Expand Down
8 changes: 4 additions & 4 deletions Sources/App/Core/SwiftVersion+Build.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@ extension SwiftVersion {
// https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/1267#issuecomment-975379966
// Patch versions are irrelevant here but the underlying type requires one, so use 0
// in general.
static let v5_9: Self = .init(5, 9, 0)
static let v5_10: Self = .init(5, 10, 0)
static let v6_0: Self = .init(6, 0, 0)
static let v6_1: Self = .init(6, 1, 0)
static let v6_2: Self = .init(6, 2, 0)

/// Currently supported swift versions for building
static var allActive: [Self] {
[.v5_9, .v5_10, .v6_0, .v6_1]
[.v5_10, .v6_0, .v6_1, .v6_2]
}

var xcodeVersion: String? {
// NB: this is used for display purposes and not critical for compiler selection
switch self {
case .v5_9:
return "Xcode 15.2"
case .v5_10:
return "Xcode 15.4"
case .v6_0:
return "Xcode 16.2"
case .v6_1:
return "Xcode 16.3"
case .v6_2:
return "Xcode 26.0"
default:
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension SwiftVersion: BuildResultPresentable {
var longDisplayName: String { "Swift \(displayName)" }
var note: String? {
switch self {
// case .v6_0: return "beta"
case .v6_2: return "beta"
default: return nil
}
}
Expand Down
10 changes: 5 additions & 5 deletions Tests/AppTests/AlertingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ extension AllTests.AlertingTests {
Alerting.BuildInfo.mock(swiftVersion: $0)
}
#expect(all.validateSwiftVersionsPresent() == .ok)
#expect(all.filter { $0.swiftVersion != .v1 }.validateSwiftVersionsPresent() == .failed(reasons: ["Missing Swift version: 5.9"]))
#expect(all.filter { $0.swiftVersion != .v1 && $0.swiftVersion != .v2 }.validateSwiftVersionsPresent() == .failed(reasons: ["Missing Swift version: 5.9", "Missing Swift version: 5.10"]))
#expect(all.filter { $0.swiftVersion != .v1 }.validateSwiftVersionsPresent() == .failed(reasons: ["Missing Swift version: 5.10"]))
#expect(all.filter { $0.swiftVersion != .v1 && $0.swiftVersion != .v2 }.validateSwiftVersionsPresent() == .failed(reasons: ["Missing Swift version: 5.10", "Missing Swift version: 6.0"]))
}

@Test func validatePlatformsSuccessful() throws {
Expand All @@ -57,13 +57,13 @@ extension AllTests.AlertingTests {
Alerting.BuildInfo.mock(swiftVersion: $0, status: .ok)
}
#expect(all.validateSwiftVersionsSuccessful() == .ok)
#expect(all.filter { $0.swiftVersion != .v1 }.validateSwiftVersionsSuccessful() == .failed(reasons: ["Swift version without successful builds: 5.9"]))
#expect(all.filter { $0.swiftVersion != .v1 }.validateSwiftVersionsSuccessful() == .failed(reasons: ["Swift version without successful builds: 5.10"]))
#expect(
Array(all.filter { $0.swiftVersion != .v1 })
.appending(.mock(swiftVersion: .v1, status: .failed))
.validateSwiftVersionsSuccessful() == .failed(reasons: ["Swift version without successful builds: 5.9"])
.validateSwiftVersionsSuccessful() == .failed(reasons: ["Swift version without successful builds: 5.10"])
)
#expect(all.filter { $0.swiftVersion != .v1 && $0.swiftVersion != .v2 }.validateSwiftVersionsSuccessful() == .failed(reasons: ["Swift version without successful builds: 5.9", "Swift version without successful builds: 5.10"]))
#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"]))
}

@Test func validateRunnerIdsPresent() throws {
Expand Down
2 changes: 1 addition & 1 deletion Tests/AppTests/ApiTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ extension AllTests.ApiTests {
let badge = try res.content.decode(Badge.self)
#expect(badge.schemaVersion == 1)
#expect(badge.label == "Swift")
#expect(badge.message == "5.10 | 5.9")
#expect(badge.message == "6.0 | 5.10")
#expect(badge.isError == false)
#expect(badge.color == "blue")
#expect(badge.cacheSeconds == 6*3600)
Expand Down
2 changes: 1 addition & 1 deletion Tests/AppTests/BadgeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Testing
extension AllTests.BadgeTests {

@Test func badgeMessage_swiftVersions() throws {
#expect(Badge.badgeMessage(swiftVersions: [.v1, .v2, .v3, .v4]) == "6.1 | 6.0 | 5.10 | 5.9")
#expect(Badge.badgeMessage(swiftVersions: [.v1, .v2, .v3, .v4]) == "6.2 | 6.1 | 6.0 | 5.10")
#expect(Badge.badgeMessage(swiftVersions: []) == nil)
}

Expand Down
4 changes: 2 additions & 2 deletions Tests/AppTests/BuildIndexModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ extension AllTests.BuildIndexModelTests {
let matrix = model.buildMatrix

// validate
#expect(matrix.values.keys.count == 30)
#expect(matrix.values.keys.count == 32)
#expect(
matrix.values[.init(swiftVersion: .v3, platform: .iOS)]?.map(\.column.label) == ["1.2.3", "2.0.0-b1", "main"]
)
Expand Down Expand Up @@ -141,7 +141,7 @@ extension AllTests.BuildIndexModelTests {
let matrix = model.buildMatrix

// validate
#expect(matrix.values.keys.count == 30)
#expect(matrix.values.keys.count == 32)
#expect(
matrix.values[.init(swiftVersion: .v3, platform: .iOS)]?.map(\.column.label) == ["1.2.3", "main"]
)
Expand Down
50 changes: 26 additions & 24 deletions Tests/AppTests/BuildTriggerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ extension AllTests.BuildTriggerTests {
"\(v) could not be converted to a SPIManifest Swift version")
}
// Check the values specifically (which we can't easily do in the loop above)
#expect(BuildPair(.iOS, .v5_9).manifestSwiftVersion == .v5_9)
#expect(BuildPair(.iOS, .v5_10).manifestSwiftVersion == .v5_10)
#expect(BuildPair(.iOS, .v6_0).manifestSwiftVersion == .v6_0)
#expect(BuildPair(.iOS, .v6_1).manifestSwiftVersion == .v6_1)
#expect(BuildPair(.iOS, .v6_2).manifestSwiftVersion == .v6_2)
}

@Test func SPIManifest_docPairs() throws {
Expand All @@ -289,9 +289,9 @@ extension AllTests.BuildTriggerTests {
configs:
- documentation_targets: [t0]
platform: ios
swift_version: 5.9
swift_version: 5.10
""")
#expect(manifest.docPairs == [.init(.iOS, .v5_9)])
#expect(manifest.docPairs == [.init(.iOS, .v5_10)])
}
do {
let manifest = try SPIManifest.Manifest(yml: """
Expand All @@ -301,12 +301,12 @@ extension AllTests.BuildTriggerTests {
configs:
- documentation_targets: [t0]
platform: ios
swift_version: 5.9
swift_version: 5.10
- documentation_targets: [t0]
platform: macos-spm
swift_version: 5.10
swift_version: 6.0
""")
#expect(manifest.docPairs == [.init(.iOS, .v5_9), .init(.macosSpm, .v5_10)])
#expect(manifest.docPairs == [.init(.iOS, .v5_10), .init(.macosSpm, .v6_0)])
}
}

Expand Down Expand Up @@ -389,7 +389,7 @@ extension AllTests.BuildTriggerTests {
#expect(queries.count == 1)
#expect(queries.value.map { $0.variables["VERSION_ID"] } == [versionId.uuidString])
#expect(queries.value.map { $0.variables["BUILD_PLATFORM"] } == ["ios"])
#expect(queries.value.map { $0.variables["SWIFT_VERSION"] } == ["5.9"])
#expect(queries.value.map { $0.variables["SWIFT_VERSION"] } == ["5.10"])

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

// validate
// ensure Gitlab requests go out
#expect(queries.count == 30)
#expect(queries.value.map { $0.variables["VERSION_ID"] } == Array(repeating: versionId.uuidString, count: 30))
#expect(queries.count == 32)
#expect(queries.value.map { $0.variables["VERSION_ID"] } == Array(repeating: versionId.uuidString, count: 32))
let buildPlatforms = queries.value.compactMap { $0.variables["BUILD_PLATFORM"] }
#expect(Dictionary(grouping: buildPlatforms, by: { $0 })
.mapValues(\.count) == ["android": 1,
.mapValues(\.count) == ["android": 2,
"ios": 4,
"macos-spm": 4,
"macos-xcodebuild": 4,
"linux": 4,
"wasm": 1,
"wasm": 2,
"watchos": 4,
"visionos": 4,
"tvos": 4])
let swiftVersions = queries.value.compactMap { $0.variables["SWIFT_VERSION"] }
#expect(Dictionary(grouping: swiftVersions, by: { $0 })
.mapValues(\.count) == [SwiftVersion.v1.description(droppingZeroes: .patch): 7,
SwiftVersion.v2.description(droppingZeroes: .patch): 7,
SwiftVersion.v3.description(droppingZeroes: .patch): 7,
SwiftVersion.v3.description(droppingZeroes: .patch): 9,
SwiftVersion.v4.description(droppingZeroes: .patch): 9])

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

// ensure re-selection is empty
let candidates = try await fetchBuildCandidates(app.db)
Expand Down Expand Up @@ -597,11 +597,11 @@ extension AllTests.BuildTriggerTests {
try await triggerBuilds(on: app.db, mode: .packageId(pkgId, force: false))

// validate
#expect(triggerCount.value == 30)
#expect(triggerCount.value == 32)
// ensure builds are now in progress
let v = try await Version.find(versionId, on: app.db)
try await v?.$builds.load(on: app.db)
#expect(v?.builds.count == 30)
#expect(v?.builds.count == 32)
}
}

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

// validate
#expect(triggerCount.value == 30)
#expect(triggerCount.value == 32)
// ensure builds are now in progress
let v = try await Version.find(versionId, on: app.db)
try await v?.$builds.load(on: app.db)
#expect(v?.builds.count == 30)
#expect(v?.builds.count == 32)
}
}
}
Expand Down Expand Up @@ -671,7 +671,7 @@ extension AllTests.BuildTriggerTests {
try await triggerBuilds(on: app.db, mode: .limit(4))

// validate - only the first batch must be allowed to trigger
#expect(triggerCount.value == 30)
#expect(triggerCount.value == 32)
}
}
}
Expand Down Expand Up @@ -883,7 +883,7 @@ extension AllTests.BuildTriggerTests {
try await triggerBuilds(on: app.db, mode: .packageId(pkgId, force: false))

// validate
#expect(triggerCount.value == 30)
#expect(triggerCount.value == 32)
}
}
}
Expand Down Expand Up @@ -945,7 +945,7 @@ extension AllTests.BuildTriggerTests {
try await triggerBuilds(on: app.db, mode: .packageId(pkgId, force: false))

// validate
#expect(triggerCount.value == 30)
#expect(triggerCount.value == 32)
}
}
}
Expand Down Expand Up @@ -986,7 +986,7 @@ extension AllTests.BuildTriggerTests {
try await triggerBuilds(on: app.db, mode: .packageId(.id0, force: false))

// validate
#expect(triggerCount.value == 30)
#expect(triggerCount.value == 32)
}
}
}
Expand Down Expand Up @@ -1230,7 +1230,7 @@ extension AllTests.BuildTriggerTests {

@Test func BuildPair_all() throws {
// Sanity checks for critical counts used in canadidate selection
#expect(BuildPair.all.count == 30)
#expect(BuildPair.all.count == 32)
#expect(BuildPair.all == [
.init(.iOS, .v1),
.init(.iOS, .v2),
Expand Down Expand Up @@ -1260,10 +1260,12 @@ extension AllTests.BuildTriggerTests {
.init(.linux, .v2),
.init(.linux, .v3),
.init(.linux, .v4),
.init(.wasm, .v3),
.init(.wasm, .v4),
.init(.android, .v3),
.init(.android, .v4),
])
#expect(BuildPair.allExceptLatestSwiftVersion.count == 21)
#expect(BuildPair.allExceptLatestSwiftVersion.count == 23)
}

@Test func BuildPair_Equatable() throws {
Expand Down Expand Up @@ -1308,7 +1310,7 @@ extension AllTests.BuildTriggerTests {
let res = try await findMissingBuilds(app.db, packageId: pkgId)
#expect(res.count == 1)
let triggerInfo = try #require(res.first)
#expect(triggerInfo.buildPairs.count == 29)
#expect(triggerInfo.buildPairs.count == 31)
#expect(!triggerInfo.buildPairs.contains(.init(.iOS, .v1)))
}
}
Expand Down
Loading
Loading