diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42043e4..73d4ba5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,3 +63,65 @@ jobs: - name: Build package run: yarn prepack + + # Compiles the library's Swift (ios/) against the Courier_iOS version pinned in + # courier-react-native.podspec. Nothing else in CI builds iOS, so a Courier_iOS bump that breaks + # the Swift bridge would otherwise pass. Build-only: no secrets, no signing. + build-ios: + runs-on: macos-15 + timeout-minutes: 60 + concurrency: + group: build-ios-${{ github.ref }} + cancel-in-progress: true + env: + DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer + LANG: en_US.UTF-8 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + bundler-cache: true + working-directory: example-085 + + - name: Cache CocoaPods + uses: actions/cache@v4 + with: + path: | + ~/Library/Caches/CocoaPods + ~/.cocoapods + key: ${{ runner.os }}-pods-${{ hashFiles('example-085/ios/Podfile.lock', 'courier-react-native.podspec') }} + restore-keys: | + ${{ runner.os }}-pods- + + # `pod update Courier_iOS` rather than `pod install`: bump PRs change the podspec pin without + # touching example-085/ios/Podfile.lock, and install would refuse the stale lock. + - name: Install pods + working-directory: example-085/ios + run: bundle exec pod update Courier_iOS + + - name: Check resolved Courier_iOS matches the podspec pin + run: | + PINNED=$(sed -nE 's/.*s\.dependency "Courier_iOS", "([^"]+)".*/\1/p' courier-react-native.podspec) + RESOLVED=$(sed -nE 's/^ - Courier_iOS \(([^)]+)\)$/\1/p' example-085/ios/Podfile.lock) + echo "Pinned: $PINNED Resolved: $RESOLVED" + [ -n "$PINNED" ] && [ "$PINNED" = "$RESOLVED" ] + + # ARCHS=arm64 keeps the generic simulator destination from also building x86_64. + - name: Build example app for iOS Simulator + working-directory: example-085/ios + run: | + xcodebuild build \ + -workspace CourierReactNativeExample.xcworkspace \ + -scheme CourierReactNativeExample \ + -configuration Debug \ + -destination 'generic/platform=iOS Simulator' \ + ARCHS=arm64 \ + CODE_SIGNING_ALLOWED=NO \ + -quiet diff --git a/example-085/ios/Podfile b/example-085/ios/Podfile index 7b239a4..a0323f0 100644 --- a/example-085/ios/Podfile +++ b/example-085/ios/Podfile @@ -14,8 +14,6 @@ if linkage != nil use_frameworks! :linkage => linkage.to_sym end -pod 'Courier_iOS', :git => 'https://github.com/trycourier/courier-ios.git', :tag => '5.8.3' - target 'CourierReactNativeExample' do config = use_native_modules! diff --git a/example-085/ios/Podfile.lock b/example-085/ios/Podfile.lock index e8c3917..508ae65 100644 --- a/example-085/ios/Podfile.lock +++ b/example-085/ios/Podfile.lock @@ -21,8 +21,8 @@ PODS: - ReactCommon/turbomodule/core - ReactNativeDependencies - Yoga - - courier-react-native (6.0.0): - - Courier_iOS (= 5.8.3) + - courier-react-native (6.0.5): + - Courier_iOS (= 5.8.6) - hermes-engine - RCTRequired - RCTTypeSafety @@ -44,7 +44,7 @@ PODS: - ReactCommon/turbomodule/core - ReactNativeDependencies - Yoga - - Courier_iOS (5.8.3) + - Courier_iOS (5.8.6) - FBLazyVector (0.85.3) - hermes-engine (250829098.0.10): - hermes-engine/Pre-built (= 250829098.0.10) @@ -2046,7 +2046,6 @@ PODS: DEPENDENCIES: - "AsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)" - courier-react-native (from `../..`) - - Courier_iOS (from `https://github.com/trycourier/courier-ios.git`, tag `5.8.3`) - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) - hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`) - RCTDeprecation (from `../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation`) @@ -2132,6 +2131,7 @@ DEPENDENCIES: SPEC REPOS: trunk: + - Courier_iOS - SwiftUIIntrospect EXTERNAL SOURCES: @@ -2139,9 +2139,6 @@ EXTERNAL SOURCES: :path: "../node_modules/@react-native-async-storage/async-storage" courier-react-native: :path: "../.." - Courier_iOS: - :git: https://github.com/trycourier/courier-ios.git - :tag: 5.8.3 FBLazyVector: :path: "../node_modules/react-native/Libraries/FBLazyVector" hermes-engine: @@ -2306,15 +2303,10 @@ EXTERNAL SOURCES: Yoga: :path: "../node_modules/react-native/ReactCommon/yoga" -CHECKOUT OPTIONS: - Courier_iOS: - :git: https://github.com/trycourier/courier-ios.git - :tag: 5.8.3 - SPEC CHECKSUMS: AsyncStorage: 3159283852d8bfabb4653cf17f1a1fef2a8a0eb6 - courier-react-native: 5b84aa07199ce2eead79853c01b02c26f9f19115 - Courier_iOS: f254b899c73d591b68dc39ff82cbe1f300c2b6f7 + courier-react-native: 002b85d85bf12d5106c0661dbe2bab9d2f2aaf45 + Courier_iOS: dbbf8a240064a7e5cfa5f9b1400de1ff44dfde7f FBLazyVector: 24e62c765683b8d89006a88a2c8f5cf019f0074d hermes-engine: 14b3c4d35cacb173ac74f56426c9062c4e9dbcb4 RCTDeprecation: a4c521821fab57cbb125b36effe84d897d0dfa12 @@ -2398,6 +2390,6 @@ SPEC CHECKSUMS: SwiftUIIntrospect: fee9aa07293ee280373a591e1824e8ddc869ba5d Yoga: 77dfa8673de2874e1855002ae59c68b8be9b007b -PODFILE CHECKSUM: 7ceeb28a915fdc1b064aed5f632a7beaf9fb07b7 +PODFILE CHECKSUM: 4861888da3f9f2329f8c6cfcebd2ef724bf0ab29 COCOAPODS: 1.16.2 diff --git a/ios/CourierClientModule.swift b/ios/CourierClientModule.swift index d40820e..0f00e5e 100644 --- a/ios/CourierClientModule.swift +++ b/ios/CourierClientModule.swift @@ -72,7 +72,7 @@ internal class CourierClientModule: CourierReactNativeEventEmitter { try await client.tokens.putUserToken( token: token, provider: provider, - device: courierDevice + device: courierDevice ?? CourierDevice() ) resolve(nil) } catch {