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

Fix tests in main #4174

Merged
merged 6 commits into from
Aug 13, 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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ jobs:
spm-revenuecat-ui-ios-16:
executor:
name: macos-executor
xcode_version: '14.3.0'
xcode_version: '15.4.0'

Copy link
Member Author

Choose a reason for hiding this comment

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

this one didn't need Xcode 14, and we do intend to move to 15, so I figured it was worth moving it over

steps:
- checkout
Expand Down Expand Up @@ -653,7 +653,7 @@ jobs:
run-test-ios-16:
executor:
name: macos-executor
xcode_version: '14.3.0'
xcode_version: '15.4.0'
Copy link
Member Author

Choose a reason for hiding this comment

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

same here


steps:
- checkout
Expand Down
12 changes: 11 additions & 1 deletion RevenueCat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
2D222BAB27FB7008003D5F37 /* LocalReceiptParserStoreKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D222BAA27FB7008003D5F37 /* LocalReceiptParserStoreKitTests.swift */; };
2D22BF6826F3CC6D001AE2F9 /* XCTestCase+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D22BF6626F3CBFB001AE2F9 /* XCTestCase+Extensions.swift */; };
2D294E5C26DECFD500B8FE4F /* StoreKit2TransactionListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D294E5B26DECFD500B8FE4F /* StoreKit2TransactionListener.swift */; };
2D2AFE8D2C6A834D00D1B0B4 /* TestData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 887A5FDA2C1D037000E1A461 /* TestData.swift */; };
2D2AFE8F2C6A9D8700D1B0B4 /* CompatibilityContentUnavailableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D2AFE8E2C6A9D8700D1B0B4 /* CompatibilityContentUnavailableView.swift */; };
2D2AFE912C6A9EF500D1B0B4 /* Binding+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D2AFE902C6A9EF500D1B0B4 /* Binding+Extensions.swift */; };
Comment on lines +33 to +35
Copy link
Member Author

Choose a reason for hiding this comment

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

some of these files were added into the SPM package but not the Xcode project, so they wouldn't show up in the navigator and they'd fail to compile

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice find. I wish Xcode had the ability to add all sources in a particular path like SPM allows...

Copy link
Member Author

Choose a reason for hiding this comment

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

+100

2D34D9D227481D9B00C05DB6 /* TrialOrIntroPriceEligibilityCheckerSK2Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D34D9D127481D9B00C05DB6 /* TrialOrIntroPriceEligibilityCheckerSK2Tests.swift */; };
2D3BFAD126DEA45C00370B11 /* MockSK1Product.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DDF41E524F6F5DC005BC22D /* MockSK1Product.swift */; };
2D3BFAD226DEA46600370B11 /* MockProductsRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37E35B08709090FBBFB16EBD /* MockProductsRequest.swift */; };
Expand Down Expand Up @@ -1140,6 +1143,8 @@
2D222BAA27FB7008003D5F37 /* LocalReceiptParserStoreKitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalReceiptParserStoreKitTests.swift; sourceTree = "<group>"; };
2D22BF6626F3CBFB001AE2F9 /* XCTestCase+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCTestCase+Extensions.swift"; sourceTree = "<group>"; };
2D294E5B26DECFD500B8FE4F /* StoreKit2TransactionListener.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreKit2TransactionListener.swift; sourceTree = "<group>"; };
2D2AFE8E2C6A9D8700D1B0B4 /* CompatibilityContentUnavailableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompatibilityContentUnavailableView.swift; sourceTree = "<group>"; };
2D2AFE902C6A9EF500D1B0B4 /* Binding+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Binding+Extensions.swift"; path = "RevenueCatUI/Binding+Extensions.swift"; sourceTree = SOURCE_ROOT; };
2D34D9D127481D9B00C05DB6 /* TrialOrIntroPriceEligibilityCheckerSK2Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrialOrIntroPriceEligibilityCheckerSK2Tests.swift; sourceTree = "<group>"; };
2D43017726EBFD7100BAB891 /* UnitTestsConfiguration.storekit */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = UnitTestsConfiguration.storekit; sourceTree = "<group>"; };
2D4C60F02C5AD1C300A29FD2 /* AllAPITests.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = AllAPITests.xcodeproj; path = Tests/APITesters/AllAPITests/AllAPITests.xcodeproj; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1946,7 +1951,7 @@
887A63212C1D174200E1A461 /* RevenueCatUITestsDev.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RevenueCatUITestsDev.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
887A63482C1D17A200E1A461 /* RevenueCatUIDev.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = RevenueCatUIDev.xctestplan; path = RevenueCatUI/RevenueCatUIDev.xctestplan; sourceTree = SOURCE_ROOT; };
887E7B582C13CD2C002977DE /* PurchasesAreCompletedBy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PurchasesAreCompletedBy.swift; sourceTree = "<group>"; };
88A543DE2C37A45B0039C6A5 /* TemplatePackageSetting.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TemplatePackageSetting.swift; path = RevenueCatUI/TemplatePackageSetting.swift; sourceTree = SOURCE_ROOT; };
88A543DE2C37A45B0039C6A5 /* TemplatePackageSetting.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TemplatePackageSetting.swift; path = RevenueCatUI/Views/TemplatePackageSetting.swift; sourceTree = SOURCE_ROOT; };
88A543E02C37A4820039C6A5 /* TemplateView+MultiTier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TemplateView+MultiTier.swift"; sourceTree = "<group>"; };
88A543E22C37A4970039C6A5 /* Template7View.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Template7View.swift; sourceTree = "<group>"; };
88A543E42C37A4AF0039C6A5 /* ConsistentTierContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConsistentTierContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3131,6 +3136,7 @@
353756602C382C2800A1B8D6 /* Views */ = {
isa = PBXGroup;
children = (
2D2AFE8E2C6A9D8700D1B0B4 /* CompatibilityContentUnavailableView.swift */,
3537565B2C382C2800A1B8D6 /* CustomerCenterView.swift */,
35C200B02C39254100B9778B /* FeedbackSurveyView.swift */,
3537565C2C382C2800A1B8D6 /* ManageSubscriptionsView.swift */,
Expand Down Expand Up @@ -4044,6 +4050,7 @@
887A604F2C1D037000E1A461 /* Templates */,
887A60522C1D037000E1A461 /* UIKit */,
887A605F2C1D037000E1A461 /* Views */,
2D2AFE902C6A9EF500D1B0B4 /* Binding+Extensions.swift */,
887A60602C1D037000E1A461 /* PaywallFontProvider.swift */,
887A60612C1D037000E1A461 /* PaywallView.swift */,
887A60622C1D037000E1A461 /* View+PresentPaywall.swift */,
Expand Down Expand Up @@ -5804,7 +5811,9 @@
887A60BC2C1D037000E1A461 /* Template5View.swift in Sources */,
887A60BE2C1D037000E1A461 /* PaywallFooterViewController.swift in Sources */,
887A608A2C1D037000E1A461 /* PurchaseHandler.swift in Sources */,
2D2AFE8D2C6A834D00D1B0B4 /* TestData.swift in Sources */,
887A60C92C1D037000E1A461 /* PurchaseButton.swift in Sources */,
2D2AFE912C6A9EF500D1B0B4 /* Binding+Extensions.swift in Sources */,
887A60812C1D037000E1A461 /* PaywallData+Default.swift in Sources */,
887A606A2C1D037000E1A461 /* TrialOrIntroEligibilityChecker.swift in Sources */,
3546355F2C391F4D001D7E85 /* PromotionalOfferView.swift in Sources */,
Expand All @@ -5814,6 +5823,7 @@
887A60892C1D037000E1A461 /* PaywallPurchasesType.swift in Sources */,
3537566F2C382C2800A1B8D6 /* WrongPlatformView.swift in Sources */,
887A60C22C1D037000E1A461 /* ErrorDisplay.swift in Sources */,
2D2AFE8F2C6A9D8700D1B0B4 /* CompatibilityContentUnavailableView.swift in Sources */,
3537566E2C382C2800A1B8D6 /* RestorePurchasesAlert.swift in Sources */,
887A60692C1D037000E1A461 /* IntroEligibilityViewModel.swift in Sources */,
88A543E32C37A4970039C6A5 /* Template7View.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import SwiftUI
#if os(iOS)

/// A SwiftUI view for displaying a message about unavailable content
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, *)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
Comment on lines -22 to 25
Copy link
Member Author

Choose a reason for hiding this comment

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

this availability was redundant and we were marking it first available and then unavailable for the same platforms

Expand All @@ -30,12 +30,20 @@ struct CompatibilityContentUnavailableView: View {

var body: some View {

if #available(iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0, *) {
ContentUnavailableView(
title,
systemImage: systemImage,
description: Text(description)
)
if #available(iOS 17.0, *) {
#if swift(>=5.9)
Copy link
Member Author

Choose a reason for hiding this comment

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

this is an old trick that's useful for these Xcode transitions - you point to the min swift version that's packed with the newest xcode, and it effectively works as "if xcode is greater than 15"

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool!

ContentUnavailableView(
title,
systemImage: systemImage,
description: Text(description)
)
#else
// In Xcode 14, any references to ContentUnavailableView would fail to compile since that entity
// was included with Xcode 15 and later.
// Although Xcode 15 is required for App Store builds, we have some CI processes that run in Xcode 14
// so this retains compatibility while not affecting any real world usage.
EmptyView()
#endif
} else {
VStack {
Image(systemName: systemImage)
Expand Down
2 changes: 1 addition & 1 deletion RevenueCatUI/CustomerCenter/Views/CustomerCenterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import SwiftUI
#if os(iOS)

/// A SwiftUI view for displaying a customer support common tasks
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, *)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
Expand Down
2 changes: 1 addition & 1 deletion RevenueCatUI/CustomerCenter/Views/WrongPlatformView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import SwiftUI

#if os(iOS)

@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, *)
@available(macOS, unavailable)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
Expand Down
30 changes: 3 additions & 27 deletions fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,37 +154,13 @@ archive

archive all platforms

### ios build_swift_api_tester
### ios run_api_tests

```sh
[bundle exec] fastlane ios build_swift_api_tester
[bundle exec] fastlane ios run_api_tests
```

build Swift API tester

### ios build_objc_api_tester

```sh
[bundle exec] fastlane ios build_objc_api_tester
```

build ObjC API tester

### ios build_custom_entitlement_computation_api_tester

```sh
[bundle exec] fastlane ios build_custom_entitlement_computation_api_tester
```

build CustomEntitlementComputation API tester

### ios build_revenuecatui_api_tester

```sh
[bundle exec] fastlane ios build_revenuecatui_api_tester
```

build RevenueCatUI API tester
run API Tests

Comment on lines -157 to 164
Copy link
Member Author

Choose a reason for hiding this comment

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

just automatic and left over from fastlane lane updates from other PRs

### ios replace_api_key_integration_tests

Expand Down