Skip to content
Draft
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
26 changes: 22 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ concurrency:
jobs:
test:
name: Build & Test
runs-on: macos-15
# The app uses macOS 27 SDK symbols (the extra-large portrait widget
# size), so CI needs the newest Xcode, not macos-15's default 16.4.
runs-on: macos-26
timeout-minutes: 20

env:
Expand All @@ -23,13 +25,27 @@ jobs:
CODE_SIGN_IDENTITY=-
CODE_SIGNING_REQUIRED=NO
CODE_SIGNING_ALLOWED=NO
# A hung test fails by name after a minute instead of eating the
# whole job timeout with no clue which test it was.
TEST_TIMEOUT_FLAGS: >-
-test-timeouts-enabled YES
-default-test-execution-time-allowance 60
-maximum-test-execution-time-allowance 120

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Select newest Xcode
run: |
XCODE=$(ls -d /Applications/Xcode_*.app | grep -vi beta | sort -V | tail -1)
echo "Using $XCODE"
sudo xcode-select -s "$XCODE/Contents/Developer"

- name: Show Xcode version
run: xcodebuild -version
run: |
xcodebuild -version
swift --version

- name: Install xcodegen
run: brew install xcodegen
Expand All @@ -52,7 +68,8 @@ jobs:
-project Tokenomics.xcodeproj \
-scheme Tokenomics \
-destination 'platform=macOS' \
$XCODEBUILD_FLAGS
$XCODEBUILD_FLAGS \
$TEST_TIMEOUT_FLAGS

# Widget-sync tests use a temp file (no App Group entitlement needed),
# so they run in CI alongside NotificationPostingTests. Set repository variable
Expand All @@ -64,4 +81,5 @@ jobs:
-project Tokenomics.xcodeproj \
-scheme TokenomicsIntegration \
-destination 'platform=macOS' \
$XCODEBUILD_FLAGS
$XCODEBUILD_FLAGS \
$TEST_TIMEOUT_FLAGS
8 changes: 6 additions & 2 deletions TokenomicsTests/WidgetWindowEntryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ final class WidgetWindowEntryTests: XCTestCase {
resetsAt: .distantFuture,
windowDuration: 5 * 3600
)
XCTAssertEqual(window.shortTimeUntilReset, "Sun",
"distantFuture's abbreviated weekday is Sun — why every nil-resetsAt window must set sublabelOverride")
// distantFuture's weekday depends on the time zone (Sun in US zones,
// Mon in UTC as on CI), so compare against the local weekday.
let weekday = DateFormatter()
weekday.dateFormat = "EEE"
XCTAssertEqual(window.shortTimeUntilReset, weekday.string(from: .distantFuture),
"distantFuture leaks an abbreviated weekday — why every nil-resetsAt window must set sublabelOverride")
}

/// With the override, shortTimeUntilReset returns it verbatim — no countdown
Expand Down
8 changes: 6 additions & 2 deletions TokenomicsTests/WindowUsageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ final class WindowUsageTests: XCTestCase {
resetsAt: .distantFuture,
windowDuration: 5 * 3600
)
XCTAssertEqual(window.timeUntilReset, "Resets Sunday",
"distantFuture formats as Sunday — this is why every nil-resetsAt window must set sublabelOverride")
// distantFuture's weekday depends on the time zone (Sunday in US zones,
// Monday in UTC as on CI), so compare against the local weekday.
let weekday = DateFormatter()
weekday.dateFormat = "EEEE"
XCTAssertEqual(window.timeUntilReset, "Resets \(weekday.string(from: .distantFuture))",
"distantFuture formats as a weekday — this is why every nil-resetsAt window must set sublabelOverride")
}

/// With the override in place, no weekday name can leak into the sublabel —
Expand Down
2 changes: 2 additions & 0 deletions TokenomicsWidgets/TokenomicsWidgetEntryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ struct TokenomicsWidgetEntryView: View {
MediumWidgetView(entry: entry)
case .systemLarge:
LargeWidgetView(entry: entry)
#if !PRE_MACOS27_SDK
case .systemExtraLargePortrait:
// Same layout as large, with room for every pool instead of "+N in app".
LargeWidgetView(entry: entry, maxRows: 14)
#endif
default:
MediumWidgetView(entry: entry)
}
Expand Down
2 changes: 2 additions & 0 deletions TokenomicsWidgets/TokenomicsWidgets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ struct TokenomicsWidget: Widget {
/// Extra-large portrait (a tall column) arrived in macOS 27.
private static var families: [WidgetFamily] {
var families: [WidgetFamily] = [.systemSmall, .systemMedium, .systemLarge]
#if !PRE_MACOS27_SDK
if #available(macOS 27.0, *) {
families.append(.systemExtraLargePortrait)
}
#endif
return families
}

Expand Down
5 changes: 5 additions & 0 deletions project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ targets:
SWIFT_STRICT_CONCURRENCY: complete
MACOSX_DEPLOYMENT_TARGET: "14.0"
SWIFT_ACTIVE_COMPILATION_CONDITIONS: "$(inherited) WIDGET_EXTENSION"
# The extra-large portrait widget size needs the macOS 27 SDK. Older
# SDKs (Xcode 16 and 26, e.g. on CI) either lack it or mark it
# unavailable on macOS, so those builds leave it out.
"SWIFT_ACTIVE_COMPILATION_CONDITIONS[sdk=macosx15*]": "$(inherited) WIDGET_EXTENSION PRE_MACOS27_SDK"
"SWIFT_ACTIVE_COMPILATION_CONDITIONS[sdk=macosx26*]": "$(inherited) WIDGET_EXTENSION PRE_MACOS27_SDK"
LD_RUNPATH_SEARCH_PATHS: "$(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks"
configs:
debug:
Expand Down
Loading