Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CircleCI: change all jobs to M1 #3140

Merged
merged 8 commits into from
Jan 18, 2024
Merged
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
27 changes: 16 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
orbs:
macos: circleci/macos@2.0.1
slack: circleci/slack@4.10.1
codecov: codecov/codecov@3.3.0
# Disabled until compatible with M1: codecov: codecov/codecov@3.3.0
# codecov: codecov/codecov@3.3.0

version: 2.1

Expand All @@ -19,7 +20,7 @@ parameters:

aliases:
base-job: &base-job
resource_class: macos.x86.medium.gen2
resource_class: macos.m1.medium.gen1
macos:
xcode: << parameters.xcode_version >>
parameters:
Expand Down Expand Up @@ -375,7 +376,6 @@ jobs:

spm-revenuecat-ui-ios-15:
<<: *base-job
resource_class: macos.m1.medium.gen1
steps:
- checkout
- update-spm-installation-commit
Expand All @@ -400,7 +400,6 @@ jobs:

spm-revenuecat-ui-ios-16:
<<: *base-job
resource_class: macos.m1.medium.gen1
steps:
- checkout
- update-spm-installation-commit
Expand Down Expand Up @@ -432,7 +431,6 @@ jobs:

spm-revenuecat-ui-ios-17:
<<: *base-job
resource_class: macos.m1.medium.gen1
steps:
- checkout
- update-spm-installation-commit
Expand Down Expand Up @@ -483,7 +481,6 @@ jobs:

run-test-macos:
<<: *base-job
resource_class: macos.m1.medium.gen1
steps:
- checkout
- install-dependencies
Expand All @@ -506,7 +503,6 @@ jobs:

run-test-ios-17:
<<: *base-job
resource_class: macos.m1.medium.gen1
steps:
- checkout
- install-dependencies
Expand Down Expand Up @@ -541,8 +537,9 @@ jobs:
no_output_timeout: 5m
environment:
SCAN_DEVICE: iPhone 14 (16.4)
- codecov/upload:
xtra_args: "-v --xc --xp fastlane/test_output/xctest/ios/RevenueCat.xcresult --preventSymbolicLinks=true"
# Disabled until it's compatible with M1: https://github.com/codecov/feedback/issues/51
# - codecov/upload:
# xtra_args: "-v --xc --xp fastlane/test_output/xctest/ios/RevenueCat.xcresult --preventSymbolicLinks=true"
- compress_result_bundle:
directory: fastlane/test_output/xctest/ios
bundle_name: RevenueCat
Expand All @@ -558,6 +555,8 @@ jobs:

run-test-ios-15:
<<: *base-job
# Fix-me: running on M1 makes these tests crash
resource_class: macos.x86.medium.gen2
steps:
- checkout
- install-dependencies
Expand Down Expand Up @@ -646,6 +645,8 @@ jobs:

run-test-ios-13:
<<: *base-job
# M1 unsupported
resource_class: macos.x86.medium.gen2
steps:
- checkout
- install-dependencies
Expand Down Expand Up @@ -673,6 +674,8 @@ jobs:

run-test-ios-12:
<<: *base-job
# M1 unsupported
resource_class: macos.x86.medium.gen2
steps:
- checkout
- install-dependencies
Expand Down Expand Up @@ -710,7 +713,6 @@ jobs:

build-visionos:
<<: *base-job
resource_class: macos.m1.medium.gen1
steps:
- checkout
- install-dependencies
Expand All @@ -721,7 +723,6 @@ jobs:

backend-integration-tests-SK1:
<<: *base-job
resource_class: macos.m1.medium.gen1
steps:
- run-backend-tests:
test_plan: "BackendIntegrationTests-SK1"
Expand Down Expand Up @@ -752,6 +753,8 @@ jobs:

release-checks:
<<: *base-job
# Fix-me: Carthage can't build fat frameworks on Apple Silicon. See https://github.com/RevenueCat/purchases-ios/pull/3582
resource_class: macos.x86.medium.gen2
steps:
- checkout
- trust-github-key
Expand Down Expand Up @@ -791,6 +794,8 @@ jobs:

make-release:
<<: *base-job
# Fix-me: Carthage can't build fat frameworks on Apple Silicon. See https://github.com/RevenueCat/purchases-ios/pull/3582
resource_class: macos.x86.medium.gen2
steps:
- checkout
- trust-github-key
Expand Down
38 changes: 1 addition & 37 deletions Tests/BackendIntegrationTests/OtherIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,42 +31,6 @@ class OtherIntegrationTests: BaseBackendIntegrationTests {
expect(info.isComputedOffline) == false
}

func testGetCustomerInfoMultipleTimesInParallel() async throws {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't figure out a way to write this test in a way that can't suffer from race conditions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Luckily this is already covered by unit tests.

let requestCount = 3

let purchases = try self.purchases

// 1. Make sure any existing customer info requests finish
_ = try await purchases.customerInfo()
// 2. Invalidate cache
purchases.invalidateCustomerInfoCache()
self.logger.clearMessages()

// 3. Request customer info multiple times in parallel
await withThrowingTaskGroup(of: Void.self) {
for _ in 0..<requestCount {
$0.addTask { _ = try await purchases.customerInfo() }
}
}

// 4. Verify N-1 requests were de-duped
self.logger.verifyMessageWasLogged(
"Network operation 'GetCustomerInfoOperation' found with the same cache key",
level: .debug,
expectedCount: requestCount - 1
)
self.logger.verifyMessageWasLogged(
Strings.network.api_request_completed(
.init(method: .get,
path: .getCustomerInfo(appUserID: try self.purchases.appUserID)),
httpCode: .notModified,
metadata: nil
),
level: .debug,
expectedCount: 1
)
}

func testGetCustomerInfoCaching() async throws {
_ = try await self.purchases.customerInfo()

Expand Down Expand Up @@ -114,7 +78,7 @@ class OtherIntegrationTests: BaseBackendIntegrationTests {

func testCustomerInfoIsOnlyFetchedOnceOnAppLaunch() async throws {
// 1. Make sure any existing customer info requests finish
_ = try await purchases.customerInfo()
_ = try? await purchases.customerInfo(fetchPolicy: .fromCacheOnly)

// 2. Verify only one CustomerInfo request was done
try self.logger.verifyMessageWasLogged(
Expand Down