diff --git a/.github/workflows/sessions.yml b/.github/workflows/sessions.yml index f5372a2091b..055f604457b 100644 --- a/.github/workflows/sessions.yml +++ b/.github/workflows/sessions.yml @@ -39,10 +39,17 @@ jobs: - os: macos-14 xcode: Xcode_16.2 tests: + swift_version: 5.9 # Flaky tests on CI - os: macos-15 xcode: Xcode_16.3 tests: --skip-tests + swift_version: 5.9 + # Flaky tests on CI + - os: macos-15 + xcode: Xcode_16.2 + tests: --skip-tests + swift_version: 6.0 runs-on: ${{ matrix.build-env.os }} steps: - uses: actions/checkout@v4 @@ -51,6 +58,8 @@ jobs: run: scripts/setup_bundler.sh - name: Xcode run: sudo xcode-select -s /Applications/${{ matrix.build-env.xcode }}.app/Contents/Developer + - name: Set Swift swift_version + run: sed -i "" "s/s.swift_version[[:space:]]*=[[:space:]]*'5.9'/s.swift_version = '${{ matrix.build-env.swift_version }}'/" FirebaseSessions.podspec - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3 with: timeout_minutes: 120 diff --git a/FirebaseSessions/Tests/Unit/FirebaseSessionsTests+BaseBehaviors.swift b/FirebaseSessions/Tests/Unit/FirebaseSessionsTests+BaseBehaviors.swift index 2c453a4518a..c1b02cc38aa 100644 --- a/FirebaseSessions/Tests/Unit/FirebaseSessionsTests+BaseBehaviors.swift +++ b/FirebaseSessions/Tests/Unit/FirebaseSessionsTests+BaseBehaviors.swift @@ -87,7 +87,7 @@ final class FirebaseSessionsTestsBase_BaseBehaviors: FirebaseSessionsTestsBase { // We wanted to make sure that since we've introduced promises, // once the promise has been fulfilled, that .then'ing on the promise // in future initiations still results in a log - func test_multipleInitiations_logsSessionEventEachInitiation() { + @MainActor func test_multipleInitiations_logsSessionEventEachInitiation() { var loggedCount = 0 var lastLoggedSessionID = "" let loggedTwiceExpectation = expectation(description: "Sessions SDK logged events twice") diff --git a/FirebaseSessions/Tests/Unit/InitiatorTests.swift b/FirebaseSessions/Tests/Unit/InitiatorTests.swift index c3b17fb3dde..ebb6be2b5bc 100644 --- a/FirebaseSessions/Tests/Unit/InitiatorTests.swift +++ b/FirebaseSessions/Tests/Unit/InitiatorTests.swift @@ -58,7 +58,7 @@ class InitiatorTests: XCTestCase { XCTAssert(initiateCalled) } - func test_appForegrounded_initiatesNewSession() throws { + @MainActor func test_appForegrounded_initiatesNewSession() throws { // Given var pausedClock = date let initiator = SessionInitiator( diff --git a/FirebaseSessions/Tests/Unit/Library/LifecycleNotifications.swift b/FirebaseSessions/Tests/Unit/Library/LifecycleNotifications.swift index 80c6f7c38f9..e2ea9d54e9d 100644 --- a/FirebaseSessions/Tests/Unit/Library/LifecycleNotifications.swift +++ b/FirebaseSessions/Tests/Unit/Library/LifecycleNotifications.swift @@ -37,18 +37,7 @@ import Dispatch #endif // swift(>=5.9) extension XCTestCase { - func postBackgroundedNotification() { - // On Catalyst, the notifications can only be called on a the main thread - if Thread.isMainThread { - postBackgroundedNotificationInternal() - } else { - DispatchQueue.main.sync { - self.postBackgroundedNotificationInternal() - } - } - } - - private func postBackgroundedNotificationInternal() { + @MainActor func postBackgroundedNotification() { let notificationCenter = NotificationCenter.default #if os(iOS) || os(tvOS) notificationCenter.post(name: UIApplication.didEnterBackgroundNotification, object: nil) @@ -74,18 +63,7 @@ extension XCTestCase { #endif // swift(>=5.9) } - func postForegroundedNotification() { - // On Catalyst, the notifications can only be called on a the main thread - if Thread.isMainThread { - postForegroundedNotificationInternal() - } else { - DispatchQueue.main.sync { - self.postForegroundedNotificationInternal() - } - } - } - - private func postForegroundedNotificationInternal() { + @MainActor func postForegroundedNotification() { let notificationCenter = NotificationCenter.default #if os(iOS) || os(tvOS) notificationCenter.post(name: UIApplication.didBecomeActiveNotification, object: nil)