diff --git a/.circleci/config.yml b/.circleci/config.yml index 2ac513e163..11bf2c48fa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ orbs: macos: circleci/macos@2.0.1 slack: circleci/slack@4.10.1 - codecov: codecov/codecov@3.2.5 + codecov: codecov/codecov@3.3.0 version: 2.1 @@ -454,7 +454,7 @@ jobs: environment: SCAN_DEVICE: iPhone 14 (16.4) - codecov/upload: - xtra_args: "-v --xc --xp fastlane/test_output/xctest/ios/RevenueCat.xcresult" + 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 diff --git a/RevenueCat.xcodeproj/project.pbxproj b/RevenueCat.xcodeproj/project.pbxproj index bdaceff5b0..9fc56b19df 100644 --- a/RevenueCat.xcodeproj/project.pbxproj +++ b/RevenueCat.xcodeproj/project.pbxproj @@ -1057,6 +1057,7 @@ 4FD368B52AA7D09C00F63354 /* PaywallEventSerializer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaywallEventSerializer.swift; sourceTree = ""; }; 4FD7E8652AABC4470055406F /* PurchasesPaywallEventsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PurchasesPaywallEventsTests.swift; sourceTree = ""; }; 4FDA13662A33D13700C45CFE /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; + 4FDE95A92A769E9E006E7D2D /* XC-AllTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = "XC-AllTests.xctestplan"; path = "Tests/TestPlans/XC-AllTests.xctestplan"; sourceTree = ""; }; 4FDF10E62A725EA6004F3680 /* ExternalPurchasesManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalPurchasesManager.swift; sourceTree = ""; }; 4FDF10E92A726269004F3680 /* ObserverModeManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObserverModeManager.swift; sourceTree = ""; }; 4FDF10EC2A726291004F3680 /* SK1ProductFetcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SK1ProductFetcher.swift; sourceTree = ""; }; @@ -2566,6 +2567,7 @@ B3DB3EA828862898008EB151 /* CI-BackendIntegration.xctestplan */, 57910CBD29C393A6006209D5 /* CI-RevenueCat.xctestplan */, 2C646C282A0EBD0300E5936E /* CI-Snapshots.xctestplan */, + 4FDE95A92A769E9E006E7D2D /* XC-AllTests.xctestplan */, 570896B427595C8100296F1C /* Coverage.xctestplan */, 570896B327595C8100296F1C /* RevenueCat.xctestplan */, 570896B527595C8100296F1C /* UnitTests.xctestplan */, diff --git a/RevenueCat.xcodeproj/xcshareddata/xcschemes/RevenueCat.xcscheme b/RevenueCat.xcodeproj/xcshareddata/xcschemes/RevenueCat.xcscheme index 3db7e6ea95..4c76bf1920 100644 --- a/RevenueCat.xcodeproj/xcshareddata/xcschemes/RevenueCat.xcscheme +++ b/RevenueCat.xcodeproj/xcshareddata/xcschemes/RevenueCat.xcscheme @@ -120,6 +120,9 @@ + + =5.8) && canImport(SwiftUI) import SwiftUI @@ -21,6 +22,73 @@ import SwiftUI @testable import RevenueCat +// MARK: - Overloads for Xcode Cloud support + +func assertSnapshot( + matching value: @autoclosure () throws -> Value, + as snapshotting: Snapshotting, + named name: String? = nil, + record recording: Bool = false, + timeout: TimeInterval = 5, + file: StaticString = #file, + testName: String = #function, + line: UInt = #line +) { + let failure = verifySnapshot( + matching: try value(), + as: snapshotting, + named: name, + record: recording, + timeout: timeout, + file: file, + testName: testName, + line: line + ) + + if let message = failure { + XCTFail(message, file: file, line: line) + } +} + +func verifySnapshot( + matching value: @autoclosure () throws -> Value, + as snapshotting: Snapshotting, + named name: String? = nil, + record recording: Bool = false, + timeout: TimeInterval = 5, + file: StaticString = #file, + testName: String = #function, + line: UInt = #line +) -> String? { + let snapshotDirectory: String? + + if ProcessInfo.isXcodeCloud { + let ciPathPrefix = "/Volumes/workspace/repository/ci_scripts/" + let components = URL(string: file.description)!.pathComponents + let projectIndex = components.firstIndex(of: "repository")! + let folders = components[(projectIndex + 1)..