From 7d8f0e0db631d90196e8d9fbd249e86334f02a28 Mon Sep 17 00:00:00 2001 From: NachoSoto Date: Wed, 6 Sep 2023 09:32:40 -0700 Subject: [PATCH] `CircleCI`: change all jobs to use `Xcode 14.x` and replace `xcode-install` with `xcodes` (#2421) `CircleCI` is deprecating `Xcode 13` soon. [`CircleCI` still recommends using `xcode-install`](https://support.circleci.com/hc/en-us/articles/360011880714-How-do-I-add-different-simulators-to-my-iOS-builds-), but [it breaks with Xcode 14](https://github.com/xcpretty/xcode-install/issues/466), so [it's been deprecated now](https://github.com/xcpretty/xcode-install/blob/master/MIGRATION.md#known-limitations). This replaces the runtime installation with [`xcodes`](https://github.com/RobotsAndPencils/xcodes). --- .circleci/config.yml | 71 +++++------- Brewfile | 2 + Brewfile.lock.json | 105 +++++++++++------- .../StoreKit2TransactionListener.swift | 6 + fastlane/Fastfile | 15 ++- 5 files changed, 113 insertions(+), 86 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 04ebd5ae82..f34fb63162 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -60,28 +60,16 @@ aliases: only: /^release\/.*\.0$/ commands: - install-and-create-sim: + install-runtime: parameters: - install-name: - type: string - sim-device-type: - type: string - sim-device-runtime: - type: string - sim-name: + runtime-name: type: string steps: - - run: - name: Install xcode-install - command: gem install xcode-install - run: name: Install simulator command: | # Print all available simulators and install required one - xcversion simulators - xcversion simulators --install="<< parameters.install-name >>" - - run: - name: Create simulator - command: xcrun simctl create '<< parameters.sim-name >>' com.apple.CoreSimulator.SimDeviceType.<< parameters.sim-device-type >> com.apple.CoreSimulator.SimRuntime.<< parameters.sim-device-runtime >> + xcodes runtimes + sudo xcodes runtimes install "<< parameters.runtime-name >>" install-bundle-dependencies: parameters: @@ -119,11 +107,15 @@ commands: dependency_name: 'xcbeautify' - install-brew-dependency: dependency_name: 'swiftlint' + - run: brew tap robotsandpencils/made + - install-brew-dependency: + dependency_name: 'xcodes' - save_cache: key: homebrew-cache-{{ checksum "Brewfile.lock.json" }} paths: - /usr/local/Cellar/swiftlint/ - /usr/local/Cellar/xcbeautify/ + - /usr/local/Caskroom/xcodes/ - /Users/$USER/Library/Caches/Homebrew/ install-brew-dependency: @@ -456,12 +448,14 @@ jobs: - checkout - install-dependencies - update-spm-installation-commit + - install-runtime: + runtime-name: iOS 14.5 - run: name: Run tests - command: bundle exec fastlane test_ios + command: bundle exec fastlane test_ios skip_sk_tests:true no_output_timeout: 5m environment: - SCAN_DEVICE: iPhone 8 (14.5) + SCAN_DEVICE: iPhone 12 (14.5) - compress_result_bundle: directory: fastlane/test_output/xctest/ios bundle_name: RevenueCat @@ -483,17 +477,14 @@ jobs: - checkout - install-dependencies - update-spm-installation-commit - - install-and-create-sim: - install-name: iOS 13.7 Simulator - sim-device-type: iPhone-8 - sim-device-runtime: iOS-13-7 - sim-name: iPhone 8 (13.7) + - install-runtime: + runtime-name: iOS 13.7 - run: name: Run tests command: bundle exec fastlane test_ios no_output_timeout: 5m environment: - SCAN_DEVICE: iPhone 8 (13.7) + SCAN_DEVICE: iPhone 11 (13.7) - compress_result_bundle: directory: fastlane/test_output/xctest/ios bundle_name: RevenueCat @@ -515,11 +506,8 @@ jobs: - checkout - install-dependencies - update-spm-installation-commit - - install-and-create-sim: - install-name: iOS 12.4 Simulator - sim-device-type: iPhone-6 - sim-device-runtime: iOS-12-4 - sim-name: iPhone 6 (12.4) + - install-runtime: + runtime-name: iOS 12.4 - run: name: Run tests command: bundle exec fastlane test_ios @@ -884,14 +872,11 @@ workflows: - run-test-ios-15: xcode_version: '14.3.0' - run-test-ios-14: - # Simulator fails to install on Xcode 14 - xcode_version: '13.4.1' + xcode_version: '14.2.0' - run-test-ios-13: - # Simulator fails to install on Xcode 14 - xcode_version: '13.4.1' + xcode_version: '14.2.0' - run-test-ios-12: - # Simulator fails to install on Xcode 14 - xcode_version: '13.4.1' + xcode_version: '14.2.0' build-test: when: and: @@ -922,16 +907,15 @@ workflows: xcode_version: '14.3.0' - run-test-tvos: xcode_version: '14.3.0' + # Pre-iOS 15 requires macOS 12 which requires Xcode 14.2 + # See https://circleci.com/docs/using-macos/#supported-xcode-versions - run-test-ios-14: - # Simulator fails to install on Xcode 14 - xcode_version: '13.4.1' + xcode_version: '14.2.0' - run-test-ios-13: - # Simulator fails to install on Xcode 14 - xcode_version: '13.4.1' + xcode_version: '14.2.0' <<: *release-branches-and-main - run-test-ios-12: - # Simulator fails to install on Xcode 14 - xcode_version: '13.4.1' + xcode_version: '14.2.0' <<: *release-branches-and-main - build-tv-watch-and-macos: xcode_version: '14.3.0' @@ -961,7 +945,7 @@ workflows: xcode_version: '14.3.0' <<: *release-branches - installation-tests-receipt-parser: - xcode_version: '14.1.0' + xcode_version: '14.3.0' <<: *release-branches - installation-tests-carthage: xcode_version: '14.3.0' @@ -988,9 +972,8 @@ workflows: xcode_version: '14.3.0' <<: *release-tags - push-pods: - # Xcode 14 not supported until https://github.com/CocoaPods/CocoaPods/issues/11558 is fixed. # This runs as its own job until https://github.com/CocoaPods/CocoaPods/issues/11621 is fixed. - xcode_version: '13.4.1' + xcode_version: '14.3.0' requires: - make-release <<: *release-tags diff --git a/Brewfile b/Brewfile index ed847b64e9..c3b20fa243 100644 --- a/Brewfile +++ b/Brewfile @@ -3,6 +3,8 @@ tap "homebrew/bundle" tap "homebrew/cask" tap "homebrew/core" +tap "robotsandpencils/made" brew "swiftlint" brew "xcbeautify" +brew "xcodes" diff --git a/Brewfile.lock.json b/Brewfile.lock.json index 416f55a436..01e06c8f46 100644 --- a/Brewfile.lock.json +++ b/Brewfile.lock.json @@ -2,95 +2,122 @@ "entries": { "tap": { "homebrew/bundle": { - "revision": "12f0d2771034484a69f776e1ac2bea578a6b64fd" + "revision": "cdf404a2c2bf496e918254ffe1a81480f0cafa2a" }, "homebrew/cask": { - "revision": "a979496bdc681373630b6aab2ea9fca128de94a0" + "revision": "ca8594cc635bdb24a89c53541d106b2269c23a82" }, "homebrew/core": { - "revision": "3f8a401283628ca6bdd1f3a12bc063912f5cd74d" + "revision": "ce9ea2c975d6f420a247b721fc75011c17987739" + }, + "robotsandpencils/made": { + "revision": "f3bbb413b422f22497c938de11bc7459899e9bce" } }, "brew": { "swiftlint": { - "version": "0.50.1", + "version": "0.51.0", "bottle": { "rebuild": 0, "root_url": "https://ghcr.io/v2/homebrew/core", "files": { "arm64_ventura": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:7d447fe250b531775462560ed2179b284addb279f7dd0b6d2533da12b3c9b42f", - "sha256": "7d447fe250b531775462560ed2179b284addb279f7dd0b6d2533da12b3c9b42f" + "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:512ecb595769f901cf75b32313b17a4e670940245ff24f755ff1a3977a15da83", + "sha256": "512ecb595769f901cf75b32313b17a4e670940245ff24f755ff1a3977a15da83" }, "arm64_monterey": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:77a486aa11b6a3cfea372752d945ff5a7f20a953261449199bdb0b0ed62da336", - "sha256": "77a486aa11b6a3cfea372752d945ff5a7f20a953261449199bdb0b0ed62da336" + "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:4341feca59da7d9918517c9017487bd810d4a32d3ea3125323c65f65945c9402", + "sha256": "4341feca59da7d9918517c9017487bd810d4a32d3ea3125323c65f65945c9402" }, "ventura": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:d2c6d79212a79f3b1acee88ab44018eccf20e9fce12c69c31c782536f92493d6", - "sha256": "d2c6d79212a79f3b1acee88ab44018eccf20e9fce12c69c31c782536f92493d6" + "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:2b2ce72f4e9b9f6a9f8014415d7a2662024cf3747f2e0a593375c2b3095e7033", + "sha256": "2b2ce72f4e9b9f6a9f8014415d7a2662024cf3747f2e0a593375c2b3095e7033" }, "monterey": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:af0964ac41d78b6dd2eb3affba7b1a01cdb43649196fe0bf139d72589195e110", - "sha256": "af0964ac41d78b6dd2eb3affba7b1a01cdb43649196fe0bf139d72589195e110" + "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:06926e0e327742f4dbbd7528b1a5a847a57227062780ec7502bb0d7e1ad3f9d8", + "sha256": "06926e0e327742f4dbbd7528b1a5a847a57227062780ec7502bb0d7e1ad3f9d8" }, "x86_64_linux": { "cellar": "/home/linuxbrew/.linuxbrew/Cellar", - "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:13328073f6c8f572ab9c5e5e1fe170b54ff43ac7038b13d602e361619cbea474", - "sha256": "13328073f6c8f572ab9c5e5e1fe170b54ff43ac7038b13d602e361619cbea474" + "url": "https://ghcr.io/v2/homebrew/core/swiftlint/blobs/sha256:ef46916b9f189ce18045273a0a0f2d155a1bb3bea1ac5e1c866f6df080d9dfbf", + "sha256": "ef46916b9f189ce18045273a0a0f2d155a1bb3bea1ac5e1c866f6df080d9dfbf" } } } }, "xcbeautify": { - "version": "0.16.0", + "version": "0.19.0", "bottle": { "rebuild": 0, "root_url": "https://ghcr.io/v2/homebrew/core", "files": { "arm64_ventura": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:b6bec8019161280b434f9e76d5ba08742d1d0b8dc236408d01554af2d327133a", - "sha256": "b6bec8019161280b434f9e76d5ba08742d1d0b8dc236408d01554af2d327133a" + "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:87f301017b3d76ad255d9c3c615135b1827f99dbb52522d82c454c7e404c2046", + "sha256": "87f301017b3d76ad255d9c3c615135b1827f99dbb52522d82c454c7e404c2046" }, "arm64_monterey": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:73f133729b9d2a40b3d4f162420fcae8425789905cc30ce4f81416ab792cc96f", - "sha256": "73f133729b9d2a40b3d4f162420fcae8425789905cc30ce4f81416ab792cc96f" + "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:ba78c805ee0cc3f239cbe17553e315c95d886f9c37147af1835b25fc5a97350f", + "sha256": "ba78c805ee0cc3f239cbe17553e315c95d886f9c37147af1835b25fc5a97350f" }, "arm64_big_sur": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:58d1037d0a4a6df88b5549973635d02e2adc4abbc2fef7cfc5302be5db7289cc", - "sha256": "58d1037d0a4a6df88b5549973635d02e2adc4abbc2fef7cfc5302be5db7289cc" + "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:ecfcb6e8ddccc2d7e6c59d4882fbdb372c9dd5211322f8cba52d4f3d1788917a", + "sha256": "ecfcb6e8ddccc2d7e6c59d4882fbdb372c9dd5211322f8cba52d4f3d1788917a" }, "ventura": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:901bea9761c40f4550b64978c7f0cfd92c1a6fbc55c4e155b1acbd400d649789", - "sha256": "901bea9761c40f4550b64978c7f0cfd92c1a6fbc55c4e155b1acbd400d649789" + "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:7e10dfa20b368a552c4a4b9c7dbda5b5f707b244792473b5262d961b4c462671", + "sha256": "7e10dfa20b368a552c4a4b9c7dbda5b5f707b244792473b5262d961b4c462671" }, "monterey": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:7e51ded6a1619f1e00032df16da653aa228790a93b14498a2b20885cd158294d", - "sha256": "7e51ded6a1619f1e00032df16da653aa228790a93b14498a2b20885cd158294d" + "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:e0623eecc23efad9e1c83b3b2adc992d0931ec16b1b312d929cc429180093807", + "sha256": "e0623eecc23efad9e1c83b3b2adc992d0931ec16b1b312d929cc429180093807" }, "big_sur": { "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:99b802ced5e8f9c16f2983315606f4512d3cf62b9cd43ba51079701edd36547f", - "sha256": "99b802ced5e8f9c16f2983315606f4512d3cf62b9cd43ba51079701edd36547f" - }, - "catalina": { - "cellar": ":any_skip_relocation", - "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:4c348994041017c4f18d3a5e39981204be679b756850b3bdd4e325aa3e71d711", - "sha256": "4c348994041017c4f18d3a5e39981204be679b756850b3bdd4e325aa3e71d711" + "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:2e00b12e6da090652f30a7b10ce4f71d34768f39ec0d51c9a1b8763b40ae245d", + "sha256": "2e00b12e6da090652f30a7b10ce4f71d34768f39ec0d51c9a1b8763b40ae245d" }, "x86_64_linux": { "cellar": "/home/linuxbrew/.linuxbrew/Cellar", - "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:2013cb7179eb9f8f5706f291b731d8fc5d5f1249d142ac492261efaeab0daec7", - "sha256": "2013cb7179eb9f8f5706f291b731d8fc5d5f1249d142ac492261efaeab0daec7" + "url": "https://ghcr.io/v2/homebrew/core/xcbeautify/blobs/sha256:6af0ff8f1a58266c3447057020b9cfb9ad400f5d3802d972b6525cad3abbab4d", + "sha256": "6af0ff8f1a58266c3447057020b9cfb9ad400f5d3802d972b6525cad3abbab4d" + } + } + } + }, + "xcodes": { + "version": "1.3.0", + "bottle": { + "rebuild": 0, + "root_url": "https://ghcr.io/v2/homebrew/core", + "files": { + "arm64_ventura": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/xcodes/blobs/sha256:609d22093d1401820279ad3262dde90e6385ee659143df65bf0a7d393a206c89", + "sha256": "609d22093d1401820279ad3262dde90e6385ee659143df65bf0a7d393a206c89" + }, + "arm64_monterey": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/xcodes/blobs/sha256:92f97acbcedde363cc8297f58f5301b37b56da77ae7fe0d61cec366a7a52546d", + "sha256": "92f97acbcedde363cc8297f58f5301b37b56da77ae7fe0d61cec366a7a52546d" + }, + "ventura": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/xcodes/blobs/sha256:cab3178d02cbbff0b9a5be1edeb430af4166564ae458d1834d1667b982911fc4", + "sha256": "cab3178d02cbbff0b9a5be1edeb430af4166564ae458d1834d1667b982911fc4" + }, + "monterey": { + "cellar": ":any_skip_relocation", + "url": "https://ghcr.io/v2/homebrew/core/xcodes/blobs/sha256:1589f9d3817627332ddaa3dc58de24bd8869198c3e728f8ba3b00562c634ae95", + "sha256": "1589f9d3817627332ddaa3dc58de24bd8869198c3e728f8ba3b00562c634ae95" } } } @@ -100,12 +127,12 @@ "system": { "macos": { "ventura": { - "HOMEBREW_VERSION": "3.6.14", + "HOMEBREW_VERSION": "4.0.14", "HOMEBREW_PREFIX": "/opt/homebrew", - "Homebrew/homebrew-core": "3f8a401283628ca6bdd1f3a12bc063912f5cd74d", - "CLT": "14.1.0.0.1.1666437224", - "Xcode": "14.1", - "macOS": "13.1" + "Homebrew/homebrew-core": "api", + "CLT": "14.3.0.0.1.1679647830", + "Xcode": "14.3", + "macOS": "13.3.1" } } } diff --git a/Sources/Purchasing/StoreKit2/StoreKit2TransactionListener.swift b/Sources/Purchasing/StoreKit2/StoreKit2TransactionListener.swift index 9ac8c083b1..cac832a374 100644 --- a/Sources/Purchasing/StoreKit2/StoreKit2TransactionListener.swift +++ b/Sources/Purchasing/StoreKit2/StoreKit2TransactionListener.swift @@ -12,7 +12,13 @@ // Created by Andrés Boedo on 31/8/21. import Foundation + +#if swift(<5.8) +// `Product.PurchaseResult` is not `Sendable` in Xcode 14.2 +@preconcurrency import StoreKit +#else import StoreKit +#endif @available(iOS 15.0, tvOS 15.0, macOS 12.0, watchOS 8.0, *) protocol StoreKit2TransactionListenerDelegate: AnyObject, Sendable { diff --git a/fastlane/Fastfile b/fastlane/Fastfile index bbfb5b7f24..bfb015e392 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -123,6 +123,16 @@ platform :ios do desc "Runs all the iOS tests" lane :test_ios do |options| generate_snapshots = ENV["CIRCLECI_TESTS_GENERATE_SNAPSHOTS"] == "true" + + if options[:skip_sk_tests] + # For platforms that fail to run StoreKit tests. + # See https://developer.apple.com/forums/thread/724068 and `FB12223404`. + test_plan = "CI-RevenueCat" + elsif generate_snapshots + test_plan = "CI-Snapshots" + else + test_plan = "CI-AllTests" + end scan( step_name: "scan - iPhone", @@ -132,7 +142,7 @@ platform :ios do prelaunch_simulator: true, output_types: 'junit', result_bundle: true, - testplan: generate_snapshots ? "CI-Snapshots" : "CI-AllTests", + testplan: test_plan, configuration: 'Debug', output_directory: "fastlane/test_output/xctest/ios", number_of_retries: generate_snapshots ? 0 : 5, @@ -825,8 +835,7 @@ lane :check_pods do pod_lib_lint( verbose: true, podspec:'RevenueCat.podspec', - # TODO: re-add watchOS when https://github.com/CocoaPods/CocoaPods/issues/11558 is fixed. - platforms:"ios,osx,tvos", + platforms:"ios,osx,tvos,watchos", fail_fast: true ) end