diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index cbaf8d1..c2f80d3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -24,7 +24,7 @@ body: attributes: label: Pullo version description: Settings › About. - placeholder: "0.12.0" + placeholder: "0.12.1" validations: required: true - type: input diff --git a/CHANGELOG.md b/CHANGELOG.md index 53c4baa..ebff8b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to Pullo are listed here, newest first. The format follows [ ## [Unreleased] +## [0.12.1] - 2026-11-23 + +### Changed +- CI progress shows beside the notch again by default. To show it below the notch, choose Below the notch in Settings › Appearance. +- Inside a job, the step that is running, or the last one that ran, is listed first, so you no longer scroll to see what is happening now. Steps that have not started stay at the end. + ## [0.12.0] - 2026-11-17 ### Changed @@ -325,7 +331,8 @@ All notable changes to Pullo are listed here, newest first. The format follows [ - An alert stays open while the pointer is over it. - Clicks only land on the visible part of the notch. Everywhere else they go to the app behind it. -[unreleased]: https://github.com/jordan-cod/pullo/compare/v0.12.0...HEAD +[unreleased]: https://github.com/jordan-cod/pullo/compare/v0.12.1...HEAD +[0.12.1]: https://github.com/jordan-cod/pullo/compare/v0.12.0...v0.12.1 [0.12.0]: https://github.com/jordan-cod/pullo/compare/v0.11.4...v0.12.0 [0.11.4]: https://github.com/jordan-cod/pullo/compare/v0.11.3...v0.11.4 [0.11.3]: https://github.com/jordan-cod/pullo/compare/v0.11.2...v0.11.3 diff --git a/Sources/Pullo/Domain/WorkflowJob.swift b/Sources/Pullo/Domain/WorkflowJob.swift index 98d64f0..4e2d719 100644 --- a/Sources/Pullo/Domain/WorkflowJob.swift +++ b/Sources/Pullo/Domain/WorkflowJob.swift @@ -9,6 +9,8 @@ struct WorkflowStep: Identifiable, Equatable { var id: Int { number } + var hasStarted: Bool { [.running, .passed, .failed, .cancelled].contains(state) } + func duration(now: Date) -> TimeInterval? { guard let startedAt, state != .skipped, state != .queued else { return nil } return (completedAt ?? now).timeIntervalSince(startedAt) @@ -28,6 +30,11 @@ struct WorkflowJob: Identifiable, Equatable { var currentStep: String? { steps.first { $0.state == .running }?.name } + var stepsLatestFirst: [WorkflowStep] { + guard let reached = steps.lastIndex(where: \.hasStarted) else { return steps } + return steps[...reached].reversed() + steps[(reached + 1)...] + } + var group: String { guard let open = name.range(of: " ("), name.hasSuffix(")") else { return name } return String(name[.. 24) + #expect(h.notch.layout.size(for: .closed).width > NotchGeometry.pillWidth) } } } diff --git a/Tests/PulloTests/LiveCITests.swift b/Tests/PulloTests/LiveCITests.swift index 855975a..47a0736 100644 --- a/Tests/PulloTests/LiveCITests.swift +++ b/Tests/PulloTests/LiveCITests.swift @@ -25,20 +25,20 @@ extension NotchBehavior { #expect(h.notch.liveCI?.othersRunning == 1) } - @Test func dropsBelowTheClosedNotchWhileChecksRun() async { + @Test func dropsBelowTheClosedNotchWhenShownBelowIt() async { let idle = await NotchHarness() let busy = await NotchHarness(mine: [Self.running("PR_1", minutesAgo: 1)]) - #expect(idle.notch.liveCI == nil) + busy.settings.liveCIPlacement = .below let closed = busy.notch.layout.size(for: .closed) #expect(closed.width == idle.notch.layout.size(for: .closed).width) #expect(closed.height == idle.notch.layout.size(for: .closed).height + LiveCI.dropHeight) #expect(busy.notch.layout.hitRect(for: .closed).height > idle.notch.layout.hitRect(for: .closed).height) } - @Test func widensTheClosedNotchWhenShownBesideIt() async { + @Test func widensTheClosedNotchWhileChecksRun() async { let idle = await NotchHarness() let busy = await NotchHarness(mine: [Self.running("PR_1", minutesAgo: 1)]) - busy.settings.liveCIPlacement = .beside + #expect(idle.notch.liveCI == nil) let closed = busy.notch.layout.size(for: .closed) #expect(closed.width > idle.notch.layout.size(for: .closed).width) #expect(closed.height == idle.notch.layout.size(for: .closed).height) @@ -47,6 +47,7 @@ extension NotchBehavior { @Test func growsWiderBelowANarrowNotchWhenTheLabelDoesNotFit() async { let h = await NotchHarness(mine: [Self.running("PR_1", minutesAgo: 1)]) + h.settings.liveCIPlacement = .below h.notch.geometry.notchSize.width = 60 h.settings.liveCILabel = .both #expect(h.notch.layout.size(for: .closed).width > 60) @@ -64,7 +65,6 @@ extension NotchBehavior { @Test func followsTheChosenLabel() async { let h = await NotchHarness(mine: [Self.running("PR_1", minutesAgo: 1)]) - h.settings.liveCIPlacement = .beside #expect(h.notch.liveCI?.trailingText == "#383") h.settings.liveCILabel = .checks #expect(h.notch.liveCI?.trailingText == "3/5") diff --git a/Tests/PulloTests/WorkflowRunTests.swift b/Tests/PulloTests/WorkflowRunTests.swift index 39d9b94..97724b3 100644 --- a/Tests/PulloTests/WorkflowRunTests.swift +++ b/Tests/PulloTests/WorkflowRunTests.swift @@ -101,6 +101,22 @@ struct WorkflowRunTests { #expect(jobs[2].steps.first?.number == 1) } + @Test func listsTheLatestStepFirstAndThePendingOnesLast() { + let step = { (number: Int, state: WorkflowRun.State) in + WorkflowStep(number: number, name: "Step \(number)", state: state, startedAt: nil, completedAt: nil) + } + let job = WorkflowJob( + id: 1, name: "test", state: .running, url: nil, startedAt: nil, completedAt: nil, + steps: [step(1, .passed), step(2, .skipped), step(3, .passed), step(4, .running), step(5, .queued), step(6, .queued)] + ) + #expect(job.stepsLatestFirst.map(\.number) == [4, 3, 2, 1, 5, 6]) + let waiting = WorkflowJob( + id: 2, name: "test", state: .queued, url: nil, startedAt: nil, completedAt: nil, + steps: [step(1, .queued), step(2, .queued)] + ) + #expect(waiting.stepsLatestFirst.map(\.number) == [1, 2]) + } + @Test func groupsMatrixJobsAndPutsFailuresFirst() { let groups = JobGroup.grouping([ .make(id: 1, name: "lint", state: .passed),