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
4 changes: 4 additions & 0 deletions Sources/App/Core/AppEnvironment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct AppEnvironment: Sendable {
var metricsPushGatewayUrl: @Sendable () -> String?
var plausibleBackendReportingSiteID: @Sendable () -> String?
var postPlausibleEvent: @Sendable (Client, Plausible.Event.Kind, Plausible.Path, User?) async throws -> Void
var processingBuildBacklog: @Sendable () -> Bool
var random: @Sendable (_ range: ClosedRange<Double>) -> Double
var runnerIds: @Sendable () -> [String]
var setHTTPClient: @Sendable (Client) -> Void
Expand Down Expand Up @@ -201,6 +202,9 @@ extension AppEnvironment {
metricsPushGatewayUrl: { Environment.get("METRICS_PUSHGATEWAY_URL") },
plausibleBackendReportingSiteID: { Environment.get("PLAUSIBLE_BACKEND_REPORTING_SITE_ID") },
postPlausibleEvent: { client, kind, path, user in try await Plausible.postEvent(client: client, kind: kind, path: path, user: user) },
processingBuildBacklog: {
Environment.get("PROCESSING_BUILD_BACKLOG").flatMap(\.asBool) ?? false
},
random: { range in Double.random(in: range) },
runnerIds: {
Environment.get("RUNNER_IDS")
Expand Down
37 changes: 37 additions & 0 deletions Sources/App/Views/PackageController/GetRoute.Model+ext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,14 @@ extension API.PackageController.GetRoute.Model {

var hasBuildInfo: Bool { swiftVersionBuildInfo != nil || platformBuildInfo != nil }

func compatibilityInformation() -> Node<HTML.BodyContext> {
.div(
.class("matrices"),
swiftVersionCompatibilityList(),
platformCompatibilityList()
)
}

func swiftVersionCompatibilityList() -> Node<HTML.BodyContext> {
guard let buildInfo = swiftVersionBuildInfo else { return .empty }
let rows = Self.groupBuildInfo(buildInfo)
Expand Down Expand Up @@ -591,6 +599,35 @@ extension API.PackageController.GetRoute.Model {
)
)
}

func noCompatibilityInformationExplainer() -> Node<HTML.BodyContext> {
.if(Current.processingBuildBacklog(),
.group(
.p(
.text("This package currently has no compatibility information. "),
.strong("We are currently processing a large build job backlog and it may take much longer than usual for compatibility information to appear.")
),
.p(
.text("You can see what builds the system is currently processing by checking the "),
.a(
.href(SiteURL.buildMonitor.relativeURL()),
.text("build system monitoring page")
),
.text(".")
)
),
else: .group(
.p("This package currently has no compatibility information. The build jobs that determine compatibility have been queued and compatibility information will appear when they complete."),
.p(
.text("If this message persists for more than an hour, please "),
.a(
.href(ExternalURL.raiseNewIssue),
.text("raise an issue")
),
.text(".")
)
))
}
}


Expand Down
21 changes: 2 additions & 19 deletions Sources/App/Views/PackageController/PackageShow+View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -221,25 +221,8 @@ extension PackageShow {
.text("Full Build Results")
)
),
.div(
.class("matrices"),
.if(model.hasBuildInfo,
.group(
model.swiftVersionCompatibilityList(),
model.platformCompatibilityList()
),
else: .group(
.p(
"This package currently has no compatibility information. Builds to determine package compatibility are starting, and compatibility information will appear soon. If this message persists for more than a few minutes, please ",
.a(
.href(ExternalURL.raiseNewIssue),
"raise an issue"
),
"."
)
)
)
)
.if(model.hasBuildInfo, model.compatibilityInformation(),
else: model.noCompatibilityInformationExplainer())
)
}

Expand Down
1 change: 1 addition & 0 deletions Tests/AppTests/Mocks/AppEnvironment+mock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ extension AppEnvironment {
metricsPushGatewayUrl: { "http://pushgateway:9091" },
plausibleBackendReportingSiteID: { nil },
postPlausibleEvent: { _, _, _, _ in },
processingBuildBacklog: { false },
random: { range in Double.random(in: range) },
runnerIds: { [] },
setHTTPClient: { client in Self.httpClient = client },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,10 @@ <h4>When working with a Swift Package Manager manifest:</h4>
<h3>Compatibility</h3>
<a href="/Alamo/Alamofire/builds">Full Build Results</a>
</div>
<div class="matrices">
<p>This package currently has no compatibility information. Builds to determine package compatibility are starting, and compatibility information will appear soon. If this message persists for more than a few minutes, please
<a href="https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/new/choose">raise an issue</a>.
</p>
</div>
<p>This package currently has no compatibility information. The build jobs that determine compatibility have been queued and compatibility information will appear when they complete.</p>
<p>If this message persists for more than an hour, please
<a href="https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/new/choose">raise an issue</a>.
</p>
</section>
</section>
<section>
Expand Down
1 change: 1 addition & 0 deletions app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ x-shared: &shared
MASTODON_ACCESS_TOKEN: ${MASTODON_ACCESS_TOKEN}
METRICS_PUSHGATEWAY_URL: ${METRICS_PUSHGATEWAY_URL}
PLAUSIBLE_BACKEND_REPORTING_SITE_ID: ${PLAUSIBLE_BACKEND_REPORTING_SITE_ID}
PROCESSING_BUILD_BACKLOG: ${PROCESSING_BUILD_BACKLOG}
RUNNER_IDS: ${RUNNER_IDS}
SITE_URL: ${SITE_URL}
SWIFT_BACKTRACE: ${SWIFT_BACKTRACE}
Expand Down
Loading