Skip to content

Commit 5aafc04

Browse files
authored
Merge pull request #3250 from SwiftPackageIndex/improve-build-details
Improve build details
2 parents 86f00f5 + eb39b47 commit 5aafc04

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

Sources/App/Views/PackageController/Builds/BuildShow+Model.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ extension BuildShow {
6767
var swiftVersion: SwiftVersion
6868
var buildDate: Date?
6969
var commitHash: String?
70+
var swift6ErrorCount: Int?
7071

7172
init?(build: App.Build, logs: String?) {
7273
guard let swiftVersion = build.swiftVersion.compatibility else { return nil }
@@ -76,7 +77,8 @@ extension BuildShow {
7677
status: build.status,
7778
swiftVersion: swiftVersion,
7879
buildDate: build.buildDate,
79-
commitHash: build.commitHash)
80+
commitHash: build.commitHash,
81+
swift6ErrorCount: build.buildErrors?.numSwift6Errors)
8082
}
8183

8284
internal init(buildCommand: String,
@@ -85,14 +87,16 @@ extension BuildShow {
8587
status: App.Build.Status,
8688
swiftVersion: SwiftVersion,
8789
buildDate: Date? = nil,
88-
commitHash: String? = nil) {
90+
commitHash: String? = nil,
91+
swift6ErrorCount: Int?) {
8992
self.buildCommand = buildCommand
9093
self.logs = logs
9194
self.platform = platform
9295
self.status = status
9396
self.swiftVersion = swiftVersion
9497
self.buildDate = buildDate
9598
self.commitHash = commitHash
99+
self.swift6ErrorCount = swift6ErrorCount
96100
}
97101

98102
var xcodeVersion: String? {

Sources/App/Views/PackageController/Builds/BuildShow+View.swift

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ enum BuildShow {
7070
.href(model.packageURL),
7171
.text(model.packageName)
7272
),
73+
.unwrap(model.buildInfo.buildDetails) {
74+
.group(
75+
.text(", reference "),
76+
.strong("\(model.reference)"),
77+
.text(" ("),
78+
.code("\($0.commitHash.prefix(6))"),
79+
.text("),")
80+
)
81+
},
7382
.text(" with "),
7483
.strong(
7584
.text(model.buildInfo.swiftVersion.longDisplayName),
@@ -86,20 +95,20 @@ enum BuildShow {
8695
.unwrap(model.buildInfo.xcodeVersion) {
8796
.group(
8897
.text(" using "),
89-
.strong(.text($0)),
90-
.text(" at "),
91-
.strong(.text(model.reference))
98+
.strong(.text($0))
9299
)
93100
},
94101
.unwrap(model.buildInfo.buildDetails) {
95102
.group(
96-
.text(" (\($0.commitHash.prefix(6)))"),
97103
.text(" on "),
98104
.strong(.text(DateFormatter.utcFullDateTimeDateFormatter.string(from: $0.buildDate) + " UTC"))
99105
)
100106
},
101107
.text(".")
102108
),
109+
.unwrap(model.buildInfo.swift6ErrorCount) {
110+
.p(.strong("Swift 6 data race errors: \($0)"))
111+
},
103112
.h3("Build Command"),
104113
.pre(
105114
.code(

Tests/AppTests/Mocks/BuildShow+mock.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ extension BuildShow.Model {
2626
status: .ok,
2727
swiftVersion: .v2,
2828
buildDate: .t0,
29-
commitHash: "71b4d8e3445caa8623fa65169f83eae2a6111925"),
29+
commitHash: "71b4d8e3445caa8623fa65169f83eae2a6111925",
30+
swift6ErrorCount: nil),
3031
packageName: "Bar",
3132
repositoryOwner: "foo",
3233
repositoryOwnerName: "Foo",

Tests/AppTests/__Snapshots__/WebpageSnapshotTests/test_BuildShow.1.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,12 @@ <h1>
102102
<h2>Build Information</h2>
103103
<p>
104104
<strong class="green">Successful</strong> build of
105-
<a href="/foo/bar">Bar</a> with
105+
<a href="/foo/bar">Bar</a>, reference
106+
<strong>main</strong> (
107+
<code>71b4d8</code>), with
106108
<strong>Swift 5.9</strong> for
107109
<strong>iOS</strong> using
108-
<strong>Xcode 15.2</strong> at
109-
<strong>main</strong> (71b4d8) on
110+
<strong>Xcode 15.2</strong> on
110111
<strong>1 Jan 1970 00:00:00 UTC</strong>.
111112
</p>
112113
<h3>Build Command</h3>

0 commit comments

Comments
 (0)