diff --git a/Sources/App/Core/AppEnvironment.swift b/Sources/App/Core/AppEnvironment.swift index 54efd59c1..c32530980 100644 --- a/Sources/App/Core/AppEnvironment.swift +++ b/Sources/App/Core/AppEnvironment.swift @@ -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 var runnerIds: @Sendable () -> [String] var setHTTPClient: @Sendable (Client) -> Void @@ -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") diff --git a/Sources/App/Views/PackageController/GetRoute.Model+ext.swift b/Sources/App/Views/PackageController/GetRoute.Model+ext.swift index 4fcc5145b..c574fc40e 100644 --- a/Sources/App/Views/PackageController/GetRoute.Model+ext.swift +++ b/Sources/App/Views/PackageController/GetRoute.Model+ext.swift @@ -546,6 +546,14 @@ extension API.PackageController.GetRoute.Model { var hasBuildInfo: Bool { swiftVersionBuildInfo != nil || platformBuildInfo != nil } + func compatibilityInformation() -> Node { + .div( + .class("matrices"), + swiftVersionCompatibilityList(), + platformCompatibilityList() + ) + } + func swiftVersionCompatibilityList() -> Node { guard let buildInfo = swiftVersionBuildInfo else { return .empty } let rows = Self.groupBuildInfo(buildInfo) @@ -591,6 +599,35 @@ extension API.PackageController.GetRoute.Model { ) ) } + + func noCompatibilityInformationExplainer() -> Node { + .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(".") + ) + )) + } } diff --git a/Sources/App/Views/PackageController/PackageShow+View.swift b/Sources/App/Views/PackageController/PackageShow+View.swift index 83da8f04e..1edbeb826 100644 --- a/Sources/App/Views/PackageController/PackageShow+View.swift +++ b/Sources/App/Views/PackageController/PackageShow+View.swift @@ -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()) ) } diff --git a/Tests/AppTests/Mocks/AppEnvironment+mock.swift b/Tests/AppTests/Mocks/AppEnvironment+mock.swift index e36ad2490..5d08bc4c4 100644 --- a/Tests/AppTests/Mocks/AppEnvironment+mock.swift +++ b/Tests/AppTests/Mocks/AppEnvironment+mock.swift @@ -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 }, diff --git a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_no_builds.1.html b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_no_builds.1.html index 60ba39935..1d363b83d 100644 --- a/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_no_builds.1.html +++ b/Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_PackageShowView_no_builds.1.html @@ -176,11 +176,10 @@

When working with a Swift Package Manager manifest:

Compatibility

Full Build Results -
-

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 - raise an issue. -

-
+

This package currently has no compatibility information. The build jobs that determine compatibility have been queued and compatibility information will appear when they complete.

+

If this message persists for more than an hour, please + raise an issue. +

diff --git a/app.yml b/app.yml index a9c272f64..0bebf8e6f 100644 --- a/app.yml +++ b/app.yml @@ -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}