diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f901215..d0ab8e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -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 @@ -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 @@ -64,4 +81,5 @@ jobs: -project Tokenomics.xcodeproj \ -scheme TokenomicsIntegration \ -destination 'platform=macOS' \ - $XCODEBUILD_FLAGS + $XCODEBUILD_FLAGS \ + $TEST_TIMEOUT_FLAGS diff --git a/TokenomicsTests/WidgetWindowEntryTests.swift b/TokenomicsTests/WidgetWindowEntryTests.swift index 316abe9..7332103 100644 --- a/TokenomicsTests/WidgetWindowEntryTests.swift +++ b/TokenomicsTests/WidgetWindowEntryTests.swift @@ -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 diff --git a/TokenomicsTests/WindowUsageTests.swift b/TokenomicsTests/WindowUsageTests.swift index d8db975..6346e8e 100644 --- a/TokenomicsTests/WindowUsageTests.swift +++ b/TokenomicsTests/WindowUsageTests.swift @@ -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 — diff --git a/TokenomicsWidgets/TokenomicsWidgetEntryView.swift b/TokenomicsWidgets/TokenomicsWidgetEntryView.swift index d03593d..4806f96 100644 --- a/TokenomicsWidgets/TokenomicsWidgetEntryView.swift +++ b/TokenomicsWidgets/TokenomicsWidgetEntryView.swift @@ -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) } diff --git a/TokenomicsWidgets/TokenomicsWidgets.swift b/TokenomicsWidgets/TokenomicsWidgets.swift index 2e4b75d..021563d 100644 --- a/TokenomicsWidgets/TokenomicsWidgets.swift +++ b/TokenomicsWidgets/TokenomicsWidgets.swift @@ -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 } diff --git a/project.yml b/project.yml index 1c28f6c..f92baed 100644 --- a/project.yml +++ b/project.yml @@ -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: