From d28670a644436d4a9d45efe633a5e8acaac609ce Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 9 Oct 2024 16:59:50 +0200 Subject: [PATCH 01/15] Add TestSample and Maestro Mobile --- .github/workflows/eval-ui-tests-p0.yml | 121 ++++++ .pre-commit-config.yaml | 7 +- .../iOS-ObjectiveC.xcodeproj/project.pbxproj | 2 +- .../iOS-Swift.xcodeproj/project.pbxproj | 2 +- .../iOS-SwiftUI.xcodeproj/project.pbxproj | 2 +- .../macOS-Swift.xcodeproj/project.pbxproj | 6 +- .../tvOS-Swift.xcodeproj/project.pbxproj | 2 +- .../watchOS-Swift.xcodeproj/project.pbxproj | 8 +- Sentry.xcodeproj/project.pbxproj | 11 - Sentry.xcworkspace/contents.xcworkspacedata | 23 +- .../Shared => Shared}/GitInjections.swift | 0 {Samples/Shared => Shared}/inject-git-info.sh | 0 {Samples/Shared => Shared}/reset-git-info.sh | 0 TestSamples/.swiftlint.yml | 4 + TestSamples/SwiftUITestSample/.gitignore | 1 + .../Maestro/corruptEnvelope.yaml | 9 + .../SwiftUITestSample/Maestro/crash.yaml | 6 + .../project.pbxproj | 385 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../SwiftUITestSampleApp.swift | 69 ++++ fastlane/Fastfile | 19 +- 21 files changed, 655 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/eval-ui-tests-p0.yml rename {Samples/Shared => Shared}/GitInjections.swift (100%) rename {Samples/Shared => Shared}/inject-git-info.sh (100%) rename {Samples/Shared => Shared}/reset-git-info.sh (100%) create mode 100644 TestSamples/.swiftlint.yml create mode 100644 TestSamples/SwiftUITestSample/.gitignore create mode 100644 TestSamples/SwiftUITestSample/Maestro/corruptEnvelope.yaml create mode 100644 TestSamples/SwiftUITestSample/Maestro/crash.yaml create mode 100644 TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj create mode 100644 TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 TestSamples/SwiftUITestSample/SwiftUITestSample/SwiftUITestSampleApp.swift diff --git a/.github/workflows/eval-ui-tests-p0.yml b/.github/workflows/eval-ui-tests-p0.yml new file mode 100644 index 00000000000..59717e6a954 --- /dev/null +++ b/.github/workflows/eval-ui-tests-p0.yml @@ -0,0 +1,121 @@ +name: Maestro UI Tests +on: + push: + branches: + - main + + pull_request: + paths: + - 'Sources/**' + - '.github/workflows/eval-ui-tests-p0.yml' + - 'fastlane/**' + - 'Shared/**' + - 'TestSamples/**' + +# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build-sample-for-maestro: + strategy: + fail-fast: false + matrix: + include: + - sample-name: iOS-ObjectiveC + lane_name: build_ios_objc_for_sim_tests + artifact-name: maestro-ios-objc + app_path: DerivedData/Build/Products/Debug-iphonesimulator/iOS-ObjectiveC.app + - sample-name: iOS-Swift + lane_name: build_ios_swift_for_sim_tests + artifact-name: maestro-ios-swift + app_path: DerivedData/Build/Products/Debug-iphonesimulator/iOS-Swift.app + - sample-name: iOS-SwiftUI + lane_name: build_ios_swift_ui_for_sim_tests + artifact-name: maestro-ios-swift-ui + app_path: DerivedData/Build/Products/Debug-iphonesimulator/iOS-SwiftUI.app + name: Build ${{matrix.sample-name}} Sample + runs-on: macos-14 + + steps: + - uses: actions/checkout@v4 + - run: ./scripts/ci-select-xcode.sh 15.4 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - run: bundle exec fastlane build_ios_swift_ui_test_sample + - uses: actions/upload-artifact@v4 + with: + name: SwiftUITestSample + path: DerivedData/Build/Products/Debug-iphonesimulator/SwiftUITestSample.app + + eval-run-maestro-tests: + name: Test iOS ${{matrix.os-version}} on ${{matrix.device}} Simulator + needs: [build-sample-for-maestro] + runs-on: ${{matrix.runs-on}} + env: + APP_ARTIFACT_NAME: "SwiftUITestSample" + APP_PATH: "Sample.app" + + MAESTRO_FLOWS_PATH: "TestSamples/SwiftUITestSample/Maestro" + MAESTRO_LOGS_PATH: "MaestroLogs" + + # https://github.com/facebook/react-native/blob/24e7f7d25629a7af6d877a0b79fed2faaab96437/.github/actions/maestro-ios/action.yml#L57 + MAESTRO_DRIVER_STARTUP_TIMEOUT: 1500000 # 25 min, CI can be slow at times + MAX_ATTEMPTS: 3 # Maestro test suits re runs in case of flakyness + strategy: + fail-fast: false + matrix: + include: + - runs-on: macos-12 + xcode: "13.4.1" + device: "iPhone 8" + os-version: "15.5" + - runs-on: macos-13 + xcode: "14.3.1" + device: "iPhone 14" + os-version: "16.4" + - runs-on: macos-14 + xcode: "15.4" + device: "iPhone 15" + os-version: "17.5" + + steps: + - uses: actions/checkout@v4 + - name: Create ${{matrix.device}} (${{matrix.os-version}}) Simulator using Xcode ${{matrix.xcode}} + run: ./scripts/create-simulator.sh "${{matrix.xcode}}" "${{matrix.os-version}}" "${{matrix.device}}" + - name: Install Maestro + run: brew tap mobile-dev-inc/tap && brew install mobile-dev-inc/tap/maestro@1.38 + - name: Install iDB Companion + run: brew tap facebook/fb && brew install facebook/fb/idb-companion + + - uses: actions/download-artifact@v4 + with: + name: ${{env.APP_ARTIFACT_NAME}} + path: ${{env.APP_PATH}} + - uses: futureware-tech/simulator-action@bfa03d93ec9de6dacb0c5553bbf8da8afc6c2ee9 # pin@v3 + with: + model: ${{matrix.device}} + os_version: ${{matrix.os-version}} + - name: Run Maestro Flows + run: | + xcrun simctl install booted ${{env.APP_PATH}} + + # Avoid exit after command fails + set +e + # Add retries for flakyness + CURR_ATTEMPT=0 + RESULT=1 + while [[ $CURR_ATTEMPT -lt $MAX_ATTEMPTS ]] && [[ $RESULT -ne 0 ]]; do + maestro test ${{env.MAESTRO_FLOWS_PATH}} --format junit --debug-output ${{env.MAESTRO_LOGS_PATH}} + RESULT=$? + done + exit $RESULT + + - name: Store Maestro Logs + uses: actions/upload-artifact@v4 + if: failure() + with: + name: maestro-logs-${{matrix.device}}-${{matrix.os-version}} + path: ${{env.MAESTRO_LOGS_PATH}} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a5a5fdb7d3..8561c2ed7e4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: fail_fast: true args: - "check-versions" - + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.3.0 hooks: @@ -20,6 +20,7 @@ repos: - id: check-symlinks - id: check-xml - id: check-yaml + args: [--allow-multiple-documents] - id: detect-private-key - id: end-of-file-fixer - id: no-commit-to-branch @@ -30,7 +31,7 @@ repos: - id: check-github-actions - id: check-github-workflows args: [--verbose] - + - repo: https://github.com/shellcheck-py/shellcheck-py rev: v0.10.0.1 hooks: @@ -45,7 +46,7 @@ repos: types_or: ["objective-c", "objective-c++", "c", "c++"] args: - "format-clang" - + - id: format-swift name: Format Swift entry: make diff --git a/Samples/iOS-ObjectiveC/iOS-ObjectiveC.xcodeproj/project.pbxproj b/Samples/iOS-ObjectiveC/iOS-ObjectiveC.xcodeproj/project.pbxproj index 45484f91824..b798e46475e 100644 --- a/Samples/iOS-ObjectiveC/iOS-ObjectiveC.xcodeproj/project.pbxproj +++ b/Samples/iOS-ObjectiveC/iOS-ObjectiveC.xcodeproj/project.pbxproj @@ -211,7 +211,7 @@ 84BA72A92C9369A40045B828 /* GitInjections.swift */, ); name = Shared; - path = ../Shared; + path = ../../Shared; sourceTree = ""; }; /* End PBXGroup section */ diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index 3c89ed2f6ac..1e4b3cd7461 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -560,7 +560,7 @@ 84BA72A52C93698E0045B828 /* GitInjections.swift */, ); name = Shared; - path = ../Shared; + path = ../../Shared; sourceTree = ""; }; D8269A3A274C095E00BD5BD5 /* iOS13-Swift */ = { diff --git a/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj b/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj index 61505ecbb5a..31db2da9b6b 100644 --- a/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj +++ b/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj @@ -267,7 +267,7 @@ 84BA72B32C9369C80045B828 /* GitInjections.swift */, ); name = Shared; - path = ../Shared; + path = ../../Shared; sourceTree = ""; }; 84D4FEAB28ECD52E00EDAAFE /* Products */ = { diff --git a/Samples/macOS-Swift/macOS-Swift.xcodeproj/project.pbxproj b/Samples/macOS-Swift/macOS-Swift.xcodeproj/project.pbxproj index a82a6f6d39a..70a6916dfef 100644 --- a/Samples/macOS-Swift/macOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/macOS-Swift/macOS-Swift.xcodeproj/project.pbxproj @@ -16,8 +16,8 @@ 7B3427FE25876DE700056519 /* Tongariro.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 7B3427FC25876DE700056519 /* Tongariro.jpg */; }; 7B948A06275E459C00F04173 /* CppSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B948A04275E459C00F04173 /* CppSample.cpp */; }; 7B948A0A275E4A9900F04173 /* CppWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B948A09275E4A9900F04173 /* CppWrapper.m */; }; - 924D21562C89FE2D00E0FEFD /* DiskWriteException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924D21552C89FE2D00E0FEFD /* DiskWriteException.swift */; }; 84BA72AE2C9369B80045B828 /* GitInjections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA72AC2C9369B80045B828 /* GitInjections.swift */; }; + 924D21562C89FE2D00E0FEFD /* DiskWriteException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924D21552C89FE2D00E0FEFD /* DiskWriteException.swift */; }; 924D21682C8A01F800E0FEFD /* SentrySwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 924D215D2C89FE2D00E0FEFD /* SentrySwiftUI.framework */; }; 924D21692C8A01F800E0FEFD /* SentrySwiftUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 924D215D2C89FE2D00E0FEFD /* SentrySwiftUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 924D216B2C8A020C00E0FEFD /* SwiftUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924D216A2C8A020C00E0FEFD /* SwiftUIView.swift */; }; @@ -106,9 +106,9 @@ 7B948A05275E459C00F04173 /* CppSample.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CppSample.hpp; sourceTree = ""; }; 7B948A08275E498E00F04173 /* CppWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CppWrapper.h; sourceTree = ""; }; 7B948A09275E4A9900F04173 /* CppWrapper.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = CppWrapper.m; sourceTree = ""; }; + 84BA72AC2C9369B80045B828 /* GitInjections.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitInjections.swift; sourceTree = ""; }; 924D21552C89FE2D00E0FEFD /* DiskWriteException.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiskWriteException.swift; sourceTree = ""; }; 924D216A2C8A020C00E0FEFD /* SwiftUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIView.swift; sourceTree = ""; }; - 84BA72AC2C9369B80045B828 /* GitInjections.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitInjections.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -191,7 +191,7 @@ 84BA72AC2C9369B80045B828 /* GitInjections.swift */, ); name = Shared; - path = ../Shared; + path = ../../Shared; sourceTree = ""; }; /* End PBXGroup section */ diff --git a/Samples/tvOS-Swift/tvOS-Swift.xcodeproj/project.pbxproj b/Samples/tvOS-Swift/tvOS-Swift.xcodeproj/project.pbxproj index c74bcb36113..fa186243fb6 100644 --- a/Samples/tvOS-Swift/tvOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/tvOS-Swift/tvOS-Swift.xcodeproj/project.pbxproj @@ -250,7 +250,7 @@ 84BA72AF2C9369C00045B828 /* GitInjections.swift */, ); name = Shared; - path = ../Shared; + path = ../../Shared; sourceTree = ""; }; 84D4FEB728ECD8A100EDAAFE /* Products */ = { diff --git a/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/project.pbxproj b/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/project.pbxproj index fdd54efdfdf..b6c489bcfa6 100644 --- a/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ @@ -20,8 +20,8 @@ 7B82C4A024C98A95002CA6D1 /* NotificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B82C49F24C98A95002CA6D1 /* NotificationView.swift */; }; 7B82C4A224C98A96002CA6D1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B82C4A124C98A96002CA6D1 /* Assets.xcassets */; }; 7B82C4A524C98A96002CA6D1 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B82C4A424C98A96002CA6D1 /* Preview Assets.xcassets */; }; - 9273C09E2C89E76B0006FD34 /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9273C09C2C89E76B0006FD34 /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 84BA72BB2C9369D70045B828 /* GitInjections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA72B92C9369D70045B828 /* GitInjections.swift */; }; + 9273C09E2C89E76B0006FD34 /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9273C09C2C89E76B0006FD34 /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -148,8 +148,8 @@ 7B82C4BA24C98CFC002CA6D1 /* Sentry.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Sentry.xcframework; path = libs/Sentry.xcframework; sourceTree = ""; }; 7B82C4BF24C99340002CA6D1 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7B82C4C224C9939A002CA6D1 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9273C09C2C89E76B0006FD34 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 84BA72B92C9369D70045B828 /* GitInjections.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitInjections.swift; sourceTree = ""; }; + 9273C09C2C89E76B0006FD34 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -252,7 +252,7 @@ 84BA72B92C9369D70045B828 /* GitInjections.swift */, ); name = Shared; - path = ../Shared; + path = ../../Shared; sourceTree = ""; }; /* End PBXGroup section */ diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index da002f2c39b..7e2c516110e 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -83,11 +83,6 @@ 621D9F2F2B9B0320003D94DE /* SentryCurrentDateProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 621D9F2E2B9B0320003D94DE /* SentryCurrentDateProvider.swift */; }; 621F61F12BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 621F61F02BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift */; }; 6221BBCA2CAA932100C627CA /* SentryANRType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6221BBC92CAA932100C627CA /* SentryANRType.swift */; }; - 62262B862BA1C46D004DA3DD /* SentryStatsdClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 62262B852BA1C46D004DA3DD /* SentryStatsdClient.h */; }; - 62262B882BA1C490004DA3DD /* SentryStatsdClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 62262B872BA1C490004DA3DD /* SentryStatsdClient.m */; }; - 62262B8B2BA1C4C1004DA3DD /* EncodeMetrics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62262B8A2BA1C4C1004DA3DD /* EncodeMetrics.swift */; }; - 62262B8D2BA1C4DB004DA3DD /* Metric.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62262B8C2BA1C4DB004DA3DD /* Metric.swift */; }; - 62262B912BA1C520004DA3DD /* CounterMetric.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62262B902BA1C520004DA3DD /* CounterMetric.swift */; }; 6229416A2BB2F123004765D1 /* SentryNSDataUtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 622941692BB2F123004765D1 /* SentryNSDataUtilsTests.swift */; }; 622C08D829E546F4002571D4 /* SentryTraceOrigins.h in Headers */ = {isa = PBXBuildFile; fileRef = 622C08D729E546F4002571D4 /* SentryTraceOrigins.h */; }; 622C08DB29E554B9002571D4 /* SentrySpanContext+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 622C08D929E554B9002571D4 /* SentrySpanContext+Private.h */; }; @@ -1077,12 +1072,6 @@ 621D9F2E2B9B0320003D94DE /* SentryCurrentDateProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCurrentDateProvider.swift; sourceTree = ""; }; 621F61F02BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryEnabledFeaturesBuilder.swift; sourceTree = ""; }; 6221BBC92CAA932100C627CA /* SentryANRType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryANRType.swift; sourceTree = ""; }; - 62262B852BA1C46D004DA3DD /* SentryStatsdClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryStatsdClient.h; path = include/SentryStatsdClient.h; sourceTree = ""; }; - 62262B872BA1C490004DA3DD /* SentryStatsdClient.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryStatsdClient.m; sourceTree = ""; }; - 62262B8A2BA1C4C1004DA3DD /* EncodeMetrics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncodeMetrics.swift; sourceTree = ""; }; - 62262B8C2BA1C4DB004DA3DD /* Metric.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Metric.swift; sourceTree = ""; }; - 62262B902BA1C520004DA3DD /* CounterMetric.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterMetric.swift; sourceTree = ""; }; - 62262B952BA1C564004DA3DD /* EncodeMetricTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncodeMetricTests.swift; sourceTree = ""; }; 622941692BB2F123004765D1 /* SentryNSDataUtilsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryNSDataUtilsTests.swift; sourceTree = ""; }; 622C08D729E546F4002571D4 /* SentryTraceOrigins.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryTraceOrigins.h; path = include/SentryTraceOrigins.h; sourceTree = ""; }; 622C08D929E554B9002571D4 /* SentrySpanContext+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentrySpanContext+Private.h"; path = "include/SentrySpanContext+Private.h"; sourceTree = ""; }; diff --git a/Sentry.xcworkspace/contents.xcworkspacedata b/Sentry.xcworkspace/contents.xcworkspacedata index 86899cc107d..1fa7bce2cd2 100644 --- a/Sentry.xcworkspace/contents.xcworkspacedata +++ b/Sentry.xcworkspace/contents.xcworkspacedata @@ -4,9 +4,6 @@ - - @@ -38,4 +35,24 @@ + + + + + + + + + + + + diff --git a/Samples/Shared/GitInjections.swift b/Shared/GitInjections.swift similarity index 100% rename from Samples/Shared/GitInjections.swift rename to Shared/GitInjections.swift diff --git a/Samples/Shared/inject-git-info.sh b/Shared/inject-git-info.sh similarity index 100% rename from Samples/Shared/inject-git-info.sh rename to Shared/inject-git-info.sh diff --git a/Samples/Shared/reset-git-info.sh b/Shared/reset-git-info.sh similarity index 100% rename from Samples/Shared/reset-git-info.sh rename to Shared/reset-git-info.sh diff --git a/TestSamples/.swiftlint.yml b/TestSamples/.swiftlint.yml new file mode 100644 index 00000000000..facb6102408 --- /dev/null +++ b/TestSamples/.swiftlint.yml @@ -0,0 +1,4 @@ +parent_config: ../.swiftlint.yml + +disabled_rules: + - force_unwrapping diff --git a/TestSamples/SwiftUITestSample/.gitignore b/TestSamples/SwiftUITestSample/.gitignore new file mode 100644 index 00000000000..ba93d3fb9ae --- /dev/null +++ b/TestSamples/SwiftUITestSample/.gitignore @@ -0,0 +1 @@ +MaestroLogs/ diff --git a/TestSamples/SwiftUITestSample/Maestro/corruptEnvelope.yaml b/TestSamples/SwiftUITestSample/Maestro/corruptEnvelope.yaml new file mode 100644 index 00000000000..7b0c90b62a0 --- /dev/null +++ b/TestSamples/SwiftUITestSample/Maestro/corruptEnvelope.yaml @@ -0,0 +1,9 @@ +appId: io.sentry.tests.SwiftUITestSample +--- +- launchApp +- tapOn: "Write Corrupted Envelope" +- tapOn: "Close SDK" +- tapOn: "Write Corrupted Envelope" +- stopApp +- launchApp +- assertVisible: "Welcome!" diff --git a/TestSamples/SwiftUITestSample/Maestro/crash.yaml b/TestSamples/SwiftUITestSample/Maestro/crash.yaml new file mode 100644 index 00000000000..d44042d68ef --- /dev/null +++ b/TestSamples/SwiftUITestSample/Maestro/crash.yaml @@ -0,0 +1,6 @@ +appId: io.sentry.tests.SwiftUITestSample +--- +- launchApp +- tapOn: "Crash" +- launchApp +- assertVisible: "Welcome!" diff --git a/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..632532c2f46 --- /dev/null +++ b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj @@ -0,0 +1,385 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + 330854EE2CB6C1DA00D06618 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 330854ED2CB6C1DA00D06618 /* Sentry.framework */; }; + 330854EF2CB6C1DA00D06618 /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 330854ED2CB6C1DA00D06618 /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 330855072CB6CAEB00D06618 /* GitInjections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 330855032CB6CAEB00D06618 /* GitInjections.swift */; }; + 330855282CB6CC3C00D06618 /* .gitignore in Resources */ = {isa = PBXBuildFile; fileRef = 330855272CB6CC3400D06618 /* .gitignore */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 330854F02CB6C1DA00D06618 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 330854EF2CB6C1DA00D06618 /* Sentry.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 330854C22CB6B5CF00D06618 /* SwiftUITestSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftUITestSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 330854ED2CB6C1DA00D06618 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 330855032CB6CAEB00D06618 /* GitInjections.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitInjections.swift; sourceTree = ""; }; + 330855252CB6CC0B00D06618 /* crash.yaml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = crash.yaml; sourceTree = ""; }; + 330855262CB6CC1700D06618 /* corruptEnvelope.yaml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = corruptEnvelope.yaml; sourceTree = ""; }; + 330855272CB6CC3400D06618 /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 330854C42CB6B5CF00D06618 /* SwiftUITestSample */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = SwiftUITestSample; + sourceTree = ""; + }; +/* End PBXFileSystemSynchronizedRootGroup section */ + +/* Begin PBXFrameworksBuildPhase section */ + 330854BF2CB6B5CF00D06618 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 330854EE2CB6C1DA00D06618 /* Sentry.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 330854B92CB6B5CF00D06618 = { + isa = PBXGroup; + children = ( + 330855272CB6CC3400D06618 /* .gitignore */, + 330855242CB6CC0600D06618 /* Maestro */, + 330855062CB6CAEB00D06618 /* Shared */, + 330854C42CB6B5CF00D06618 /* SwiftUITestSample */, + 330854EC2CB6C1DA00D06618 /* Frameworks */, + 330854C32CB6B5CF00D06618 /* Products */, + ); + sourceTree = ""; + }; + 330854C32CB6B5CF00D06618 /* Products */ = { + isa = PBXGroup; + children = ( + 330854C22CB6B5CF00D06618 /* SwiftUITestSample.app */, + ); + name = Products; + sourceTree = ""; + }; + 330854EC2CB6C1DA00D06618 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 330854ED2CB6C1DA00D06618 /* Sentry.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 330855062CB6CAEB00D06618 /* Shared */ = { + isa = PBXGroup; + children = ( + 330855032CB6CAEB00D06618 /* GitInjections.swift */, + ); + name = Shared; + path = ../../Shared; + sourceTree = SOURCE_ROOT; + }; + 330855242CB6CC0600D06618 /* Maestro */ = { + isa = PBXGroup; + children = ( + 330855262CB6CC1700D06618 /* corruptEnvelope.yaml */, + 330855252CB6CC0B00D06618 /* crash.yaml */, + ); + path = Maestro; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 330854C12CB6B5CF00D06618 /* SwiftUITestSample */ = { + isa = PBXNativeTarget; + buildConfigurationList = 330854D02CB6B5DB00D06618 /* Build configuration list for PBXNativeTarget "SwiftUITestSample" */; + buildPhases = ( + 330854BE2CB6B5CF00D06618 /* Sources */, + 330854BF2CB6B5CF00D06618 /* Frameworks */, + 330854C02CB6B5CF00D06618 /* Resources */, + 330854F02CB6C1DA00D06618 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + fileSystemSynchronizedGroups = ( + 330854C42CB6B5CF00D06618 /* SwiftUITestSample */, + ); + name = SwiftUITestSample; + packageProductDependencies = ( + ); + productName = SwiftUITestSample; + productReference = 330854C22CB6B5CF00D06618 /* SwiftUITestSample.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 330854BA2CB6B5CF00D06618 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1600; + LastUpgradeCheck = 1600; + TargetAttributes = { + 330854C12CB6B5CF00D06618 = { + CreatedOnToolsVersion = 16.0; + }; + }; + }; + buildConfigurationList = 330854BD2CB6B5CF00D06618 /* Build configuration list for PBXProject "SwiftUITestSample" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 330854B92CB6B5CF00D06618; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 330854C32CB6B5CF00D06618 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 330854C12CB6B5CF00D06618 /* SwiftUITestSample */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 330854C02CB6B5CF00D06618 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 330855282CB6CC3C00D06618 /* .gitignore in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 330854BE2CB6B5CF00D06618 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 330855072CB6CAEB00D06618 /* GitInjections.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 330854CE2CB6B5DB00D06618 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 330854CF2CB6B5DB00D06618 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.0; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 330854D12CB6B5DB00D06618 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.tests.SwiftUITestSample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 330854D22CB6B5DB00D06618 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = io.sentry.tests.SwiftUITestSample; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 330854BD2CB6B5CF00D06618 /* Build configuration list for PBXProject "SwiftUITestSample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 330854CE2CB6B5DB00D06618 /* Debug */, + 330854CF2CB6B5DB00D06618 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 330854D02CB6B5DB00D06618 /* Build configuration list for PBXNativeTarget "SwiftUITestSample" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 330854D12CB6B5DB00D06618 /* Debug */, + 330854D22CB6B5DB00D06618 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 330854BA2CB6B5CF00D06618 /* Project object */; +} diff --git a/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..919434a6254 --- /dev/null +++ b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/TestSamples/SwiftUITestSample/SwiftUITestSample/SwiftUITestSampleApp.swift b/TestSamples/SwiftUITestSample/SwiftUITestSample/SwiftUITestSampleApp.swift new file mode 100644 index 00000000000..f26c74047ae --- /dev/null +++ b/TestSamples/SwiftUITestSample/SwiftUITestSample/SwiftUITestSampleApp.swift @@ -0,0 +1,69 @@ +import Sentry +import SwiftUI + +struct Options { + static var dsnHash: String? + static var cacheDirPath: String? +} + +@main +struct SwiftUITestSampleApp: App { + init() { + SentrySDK.start { options in + options.debug = true + options.dsn = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" + options.initialScope = { scope in + scope.injectGitInformation() + return scope + } + Options.dsnHash = options.parsedDsn?.getHash() + Options.cacheDirPath = options.cacheDirectoryPath + } + } + + var body: some Scene { + WindowGroup { + ContentView() + } + } +} + +struct ContentView: View { + var body: some View { + VStack { + Text("Welcome!") + Button("Crash") { + SentrySDK.crash() + } + Button("Close SDK") { + SentrySDK.close() + } + Button("Write Corrupted Envelope") { + guard let dsnHash = Options.dsnHash else { + fatalError("dsnHash can not be nil!") + } + + guard let cachePath = Options.cacheDirPath else { + fatalError("cacheDirPath can not be nil!") + } + + let envelopePath = "\(cachePath)/io.sentry/\(dsnHash)/envelopes/corrupted-envelope.json" + let corruptedEnvelopeData = """ + {"event_id":"1990b5bc31904b7395fd07feb72daf1c","sdk":{"name":"sentry.cocoa","version":"8.33.0"}} + {"type":"test","length":50} + """.data(using: .utf8)! + + do { + try corruptedEnvelopeData.write(to: URL(fileURLWithPath: envelopePath)) + print("Corrupted envelope saved to: " + envelopePath) + } catch { + fatalError("Error while writing corrupted envelope to: " + envelopePath) + } + } + } + } +} + +#Preview { + ContentView() +} diff --git a/fastlane/Fastfile b/fastlane/Fastfile index c8e396ba27f..0428c213922 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -21,7 +21,7 @@ platform :ios do ) new_version = version.split("-", -1)[0] - # We also need to replace the MARKETING_VERSION otherwise the build will fail with + # We also need to replace the MARKETING_VERSION otherwise the build will fail with # error: The CFBundleShortVersionString of an App Clip ('8.9.0-beta.1') must match that of its containing parent app ('8.9.0'). sh "sed -i '' 's/MARKETING_VERSION = #{version}/MARKETING_VERSION = #{new_version}/g' ../Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj" @@ -161,6 +161,23 @@ platform :ios do delete_keychain(name: "fastlane_tmp_keychain") unless is_ci end + lane :build_ios_swift_ui_test_sample do + + setup_ci( + force: true + ) + + build_app( + workspace: "Sentry.xcworkspace", + scheme: "SwiftUITestSample", + configuration: "Debug", + derived_data_path: "DerivedData", + destination: "generic/platform=iOS Simulator", + xcargs: "-sdk 'iphonesimulator'", + skip_archive: true + ) + end + desc "Upload iOS-Swift to TestFlight and symbols to Sentry" lane :ios_swift_to_testflight do From 26acd51afa0da40c7d9dabec845c8420143ec3c5 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 9 Oct 2024 17:03:30 +0200 Subject: [PATCH 02/15] remove matrix from build --- .github/workflows/eval-ui-tests-p0.yml | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/.github/workflows/eval-ui-tests-p0.yml b/.github/workflows/eval-ui-tests-p0.yml index 59717e6a954..feef280a00f 100644 --- a/.github/workflows/eval-ui-tests-p0.yml +++ b/.github/workflows/eval-ui-tests-p0.yml @@ -19,25 +19,8 @@ concurrency: jobs: build-sample-for-maestro: - strategy: - fail-fast: false - matrix: - include: - - sample-name: iOS-ObjectiveC - lane_name: build_ios_objc_for_sim_tests - artifact-name: maestro-ios-objc - app_path: DerivedData/Build/Products/Debug-iphonesimulator/iOS-ObjectiveC.app - - sample-name: iOS-Swift - lane_name: build_ios_swift_for_sim_tests - artifact-name: maestro-ios-swift - app_path: DerivedData/Build/Products/Debug-iphonesimulator/iOS-Swift.app - - sample-name: iOS-SwiftUI - lane_name: build_ios_swift_ui_for_sim_tests - artifact-name: maestro-ios-swift-ui - app_path: DerivedData/Build/Products/Debug-iphonesimulator/iOS-SwiftUI.app - name: Build ${{matrix.sample-name}} Sample + name: Build SwiftUITestSample Sample runs-on: macos-14 - steps: - uses: actions/checkout@v4 - run: ./scripts/ci-select-xcode.sh 15.4 From af9372b182b577e2f3c9cf18a0bd5584c0e5e5b1 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 9 Oct 2024 17:34:06 +0200 Subject: [PATCH 03/15] Revert Shared changes --- .../Shared}/GitInjections.swift | 0 {Shared => Samples/Shared}/inject-git-info.sh | 0 {Shared => Samples/Shared}/reset-git-info.sh | 0 .../iOS-ObjectiveC.xcodeproj/project.pbxproj | 2 +- .../iOS-Swift.xcodeproj/project.pbxproj | 2 +- .../iOS-SwiftUI.xcodeproj/project.pbxproj | 2 +- .../macOS-Swift.xcodeproj/project.pbxproj | 6 +++--- .../tvOS-Swift.xcodeproj/project.pbxproj | 2 +- .../watchOS-Swift.xcodeproj/project.pbxproj | 8 ++++---- Sentry.xcodeproj/project.pbxproj | 11 ++++++++++ Sentry.xcworkspace/contents.xcworkspacedata | 20 +++++-------------- .../project.pbxproj | 13 ------------ .../SwiftUITestSampleApp.swift | 4 ---- 13 files changed, 27 insertions(+), 43 deletions(-) rename {Shared => Samples/Shared}/GitInjections.swift (100%) rename {Shared => Samples/Shared}/inject-git-info.sh (100%) rename {Shared => Samples/Shared}/reset-git-info.sh (100%) diff --git a/Shared/GitInjections.swift b/Samples/Shared/GitInjections.swift similarity index 100% rename from Shared/GitInjections.swift rename to Samples/Shared/GitInjections.swift diff --git a/Shared/inject-git-info.sh b/Samples/Shared/inject-git-info.sh similarity index 100% rename from Shared/inject-git-info.sh rename to Samples/Shared/inject-git-info.sh diff --git a/Shared/reset-git-info.sh b/Samples/Shared/reset-git-info.sh similarity index 100% rename from Shared/reset-git-info.sh rename to Samples/Shared/reset-git-info.sh diff --git a/Samples/iOS-ObjectiveC/iOS-ObjectiveC.xcodeproj/project.pbxproj b/Samples/iOS-ObjectiveC/iOS-ObjectiveC.xcodeproj/project.pbxproj index b798e46475e..45484f91824 100644 --- a/Samples/iOS-ObjectiveC/iOS-ObjectiveC.xcodeproj/project.pbxproj +++ b/Samples/iOS-ObjectiveC/iOS-ObjectiveC.xcodeproj/project.pbxproj @@ -211,7 +211,7 @@ 84BA72A92C9369A40045B828 /* GitInjections.swift */, ); name = Shared; - path = ../../Shared; + path = ../Shared; sourceTree = ""; }; /* End PBXGroup section */ diff --git a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj index 1e4b3cd7461..3c89ed2f6ac 100644 --- a/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj @@ -560,7 +560,7 @@ 84BA72A52C93698E0045B828 /* GitInjections.swift */, ); name = Shared; - path = ../../Shared; + path = ../Shared; sourceTree = ""; }; D8269A3A274C095E00BD5BD5 /* iOS13-Swift */ = { diff --git a/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj b/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj index 31db2da9b6b..61505ecbb5a 100644 --- a/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj +++ b/Samples/iOS-SwiftUI/iOS-SwiftUI.xcodeproj/project.pbxproj @@ -267,7 +267,7 @@ 84BA72B32C9369C80045B828 /* GitInjections.swift */, ); name = Shared; - path = ../../Shared; + path = ../Shared; sourceTree = ""; }; 84D4FEAB28ECD52E00EDAAFE /* Products */ = { diff --git a/Samples/macOS-Swift/macOS-Swift.xcodeproj/project.pbxproj b/Samples/macOS-Swift/macOS-Swift.xcodeproj/project.pbxproj index 70a6916dfef..a82a6f6d39a 100644 --- a/Samples/macOS-Swift/macOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/macOS-Swift/macOS-Swift.xcodeproj/project.pbxproj @@ -16,8 +16,8 @@ 7B3427FE25876DE700056519 /* Tongariro.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 7B3427FC25876DE700056519 /* Tongariro.jpg */; }; 7B948A06275E459C00F04173 /* CppSample.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7B948A04275E459C00F04173 /* CppSample.cpp */; }; 7B948A0A275E4A9900F04173 /* CppWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B948A09275E4A9900F04173 /* CppWrapper.m */; }; - 84BA72AE2C9369B80045B828 /* GitInjections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA72AC2C9369B80045B828 /* GitInjections.swift */; }; 924D21562C89FE2D00E0FEFD /* DiskWriteException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924D21552C89FE2D00E0FEFD /* DiskWriteException.swift */; }; + 84BA72AE2C9369B80045B828 /* GitInjections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA72AC2C9369B80045B828 /* GitInjections.swift */; }; 924D21682C8A01F800E0FEFD /* SentrySwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 924D215D2C89FE2D00E0FEFD /* SentrySwiftUI.framework */; }; 924D21692C8A01F800E0FEFD /* SentrySwiftUI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 924D215D2C89FE2D00E0FEFD /* SentrySwiftUI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 924D216B2C8A020C00E0FEFD /* SwiftUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924D216A2C8A020C00E0FEFD /* SwiftUIView.swift */; }; @@ -106,9 +106,9 @@ 7B948A05275E459C00F04173 /* CppSample.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = CppSample.hpp; sourceTree = ""; }; 7B948A08275E498E00F04173 /* CppWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CppWrapper.h; sourceTree = ""; }; 7B948A09275E4A9900F04173 /* CppWrapper.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = CppWrapper.m; sourceTree = ""; }; - 84BA72AC2C9369B80045B828 /* GitInjections.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitInjections.swift; sourceTree = ""; }; 924D21552C89FE2D00E0FEFD /* DiskWriteException.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiskWriteException.swift; sourceTree = ""; }; 924D216A2C8A020C00E0FEFD /* SwiftUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIView.swift; sourceTree = ""; }; + 84BA72AC2C9369B80045B828 /* GitInjections.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitInjections.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -191,7 +191,7 @@ 84BA72AC2C9369B80045B828 /* GitInjections.swift */, ); name = Shared; - path = ../../Shared; + path = ../Shared; sourceTree = ""; }; /* End PBXGroup section */ diff --git a/Samples/tvOS-Swift/tvOS-Swift.xcodeproj/project.pbxproj b/Samples/tvOS-Swift/tvOS-Swift.xcodeproj/project.pbxproj index fa186243fb6..c74bcb36113 100644 --- a/Samples/tvOS-Swift/tvOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/tvOS-Swift/tvOS-Swift.xcodeproj/project.pbxproj @@ -250,7 +250,7 @@ 84BA72AF2C9369C00045B828 /* GitInjections.swift */, ); name = Shared; - path = ../../Shared; + path = ../Shared; sourceTree = ""; }; 84D4FEB728ECD8A100EDAAFE /* Products */ = { diff --git a/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/project.pbxproj b/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/project.pbxproj index b6c489bcfa6..fdd54efdfdf 100644 --- a/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/project.pbxproj +++ b/Samples/watchOS-Swift/watchOS-Swift.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -20,8 +20,8 @@ 7B82C4A024C98A95002CA6D1 /* NotificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B82C49F24C98A95002CA6D1 /* NotificationView.swift */; }; 7B82C4A224C98A96002CA6D1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B82C4A124C98A96002CA6D1 /* Assets.xcassets */; }; 7B82C4A524C98A96002CA6D1 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B82C4A424C98A96002CA6D1 /* Preview Assets.xcassets */; }; - 84BA72BB2C9369D70045B828 /* GitInjections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA72B92C9369D70045B828 /* GitInjections.swift */; }; 9273C09E2C89E76B0006FD34 /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9273C09C2C89E76B0006FD34 /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 84BA72BB2C9369D70045B828 /* GitInjections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84BA72B92C9369D70045B828 /* GitInjections.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -148,8 +148,8 @@ 7B82C4BA24C98CFC002CA6D1 /* Sentry.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = Sentry.xcframework; path = libs/Sentry.xcframework; sourceTree = ""; }; 7B82C4BF24C99340002CA6D1 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7B82C4C224C9939A002CA6D1 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 84BA72B92C9369D70045B828 /* GitInjections.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitInjections.swift; sourceTree = ""; }; 9273C09C2C89E76B0006FD34 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 84BA72B92C9369D70045B828 /* GitInjections.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GitInjections.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -252,7 +252,7 @@ 84BA72B92C9369D70045B828 /* GitInjections.swift */, ); name = Shared; - path = ../../Shared; + path = ../Shared; sourceTree = ""; }; /* End PBXGroup section */ diff --git a/Sentry.xcodeproj/project.pbxproj b/Sentry.xcodeproj/project.pbxproj index 7e2c516110e..da002f2c39b 100644 --- a/Sentry.xcodeproj/project.pbxproj +++ b/Sentry.xcodeproj/project.pbxproj @@ -83,6 +83,11 @@ 621D9F2F2B9B0320003D94DE /* SentryCurrentDateProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 621D9F2E2B9B0320003D94DE /* SentryCurrentDateProvider.swift */; }; 621F61F12BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 621F61F02BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift */; }; 6221BBCA2CAA932100C627CA /* SentryANRType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6221BBC92CAA932100C627CA /* SentryANRType.swift */; }; + 62262B862BA1C46D004DA3DD /* SentryStatsdClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 62262B852BA1C46D004DA3DD /* SentryStatsdClient.h */; }; + 62262B882BA1C490004DA3DD /* SentryStatsdClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 62262B872BA1C490004DA3DD /* SentryStatsdClient.m */; }; + 62262B8B2BA1C4C1004DA3DD /* EncodeMetrics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62262B8A2BA1C4C1004DA3DD /* EncodeMetrics.swift */; }; + 62262B8D2BA1C4DB004DA3DD /* Metric.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62262B8C2BA1C4DB004DA3DD /* Metric.swift */; }; + 62262B912BA1C520004DA3DD /* CounterMetric.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62262B902BA1C520004DA3DD /* CounterMetric.swift */; }; 6229416A2BB2F123004765D1 /* SentryNSDataUtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 622941692BB2F123004765D1 /* SentryNSDataUtilsTests.swift */; }; 622C08D829E546F4002571D4 /* SentryTraceOrigins.h in Headers */ = {isa = PBXBuildFile; fileRef = 622C08D729E546F4002571D4 /* SentryTraceOrigins.h */; }; 622C08DB29E554B9002571D4 /* SentrySpanContext+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 622C08D929E554B9002571D4 /* SentrySpanContext+Private.h */; }; @@ -1072,6 +1077,12 @@ 621D9F2E2B9B0320003D94DE /* SentryCurrentDateProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCurrentDateProvider.swift; sourceTree = ""; }; 621F61F02BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryEnabledFeaturesBuilder.swift; sourceTree = ""; }; 6221BBC92CAA932100C627CA /* SentryANRType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryANRType.swift; sourceTree = ""; }; + 62262B852BA1C46D004DA3DD /* SentryStatsdClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryStatsdClient.h; path = include/SentryStatsdClient.h; sourceTree = ""; }; + 62262B872BA1C490004DA3DD /* SentryStatsdClient.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryStatsdClient.m; sourceTree = ""; }; + 62262B8A2BA1C4C1004DA3DD /* EncodeMetrics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncodeMetrics.swift; sourceTree = ""; }; + 62262B8C2BA1C4DB004DA3DD /* Metric.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Metric.swift; sourceTree = ""; }; + 62262B902BA1C520004DA3DD /* CounterMetric.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CounterMetric.swift; sourceTree = ""; }; + 62262B952BA1C564004DA3DD /* EncodeMetricTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncodeMetricTests.swift; sourceTree = ""; }; 622941692BB2F123004765D1 /* SentryNSDataUtilsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryNSDataUtilsTests.swift; sourceTree = ""; }; 622C08D729E546F4002571D4 /* SentryTraceOrigins.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryTraceOrigins.h; path = include/SentryTraceOrigins.h; sourceTree = ""; }; 622C08D929E554B9002571D4 /* SentrySpanContext+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentrySpanContext+Private.h"; path = "include/SentrySpanContext+Private.h"; sourceTree = ""; }; diff --git a/Sentry.xcworkspace/contents.xcworkspacedata b/Sentry.xcworkspace/contents.xcworkspacedata index 1fa7bce2cd2..518b71c0383 100644 --- a/Sentry.xcworkspace/contents.xcworkspacedata +++ b/Sentry.xcworkspace/contents.xcworkspacedata @@ -4,6 +4,9 @@ + + @@ -36,23 +39,10 @@ location = "group:Sentry.xcodeproj"> - - - - - - - - + location = "group:TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj"> diff --git a/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj index 632532c2f46..9aa32984add 100644 --- a/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj +++ b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj @@ -9,7 +9,6 @@ /* Begin PBXBuildFile section */ 330854EE2CB6C1DA00D06618 /* Sentry.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 330854ED2CB6C1DA00D06618 /* Sentry.framework */; }; 330854EF2CB6C1DA00D06618 /* Sentry.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 330854ED2CB6C1DA00D06618 /* Sentry.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 330855072CB6CAEB00D06618 /* GitInjections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 330855032CB6CAEB00D06618 /* GitInjections.swift */; }; 330855282CB6CC3C00D06618 /* .gitignore in Resources */ = {isa = PBXBuildFile; fileRef = 330855272CB6CC3400D06618 /* .gitignore */; }; /* End PBXBuildFile section */ @@ -30,7 +29,6 @@ /* Begin PBXFileReference section */ 330854C22CB6B5CF00D06618 /* SwiftUITestSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftUITestSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 330854ED2CB6C1DA00D06618 /* Sentry.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Sentry.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 330855032CB6CAEB00D06618 /* GitInjections.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitInjections.swift; sourceTree = ""; }; 330855252CB6CC0B00D06618 /* crash.yaml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = crash.yaml; sourceTree = ""; }; 330855262CB6CC1700D06618 /* corruptEnvelope.yaml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = corruptEnvelope.yaml; sourceTree = ""; }; 330855272CB6CC3400D06618 /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; @@ -61,7 +59,6 @@ children = ( 330855272CB6CC3400D06618 /* .gitignore */, 330855242CB6CC0600D06618 /* Maestro */, - 330855062CB6CAEB00D06618 /* Shared */, 330854C42CB6B5CF00D06618 /* SwiftUITestSample */, 330854EC2CB6C1DA00D06618 /* Frameworks */, 330854C32CB6B5CF00D06618 /* Products */, @@ -84,15 +81,6 @@ name = Frameworks; sourceTree = ""; }; - 330855062CB6CAEB00D06618 /* Shared */ = { - isa = PBXGroup; - children = ( - 330855032CB6CAEB00D06618 /* GitInjections.swift */, - ); - name = Shared; - path = ../../Shared; - sourceTree = SOURCE_ROOT; - }; 330855242CB6CC0600D06618 /* Maestro */ = { isa = PBXGroup; children = ( @@ -178,7 +166,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 330855072CB6CAEB00D06618 /* GitInjections.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/TestSamples/SwiftUITestSample/SwiftUITestSample/SwiftUITestSampleApp.swift b/TestSamples/SwiftUITestSample/SwiftUITestSample/SwiftUITestSampleApp.swift index f26c74047ae..a8c3bbf7656 100644 --- a/TestSamples/SwiftUITestSample/SwiftUITestSample/SwiftUITestSampleApp.swift +++ b/TestSamples/SwiftUITestSample/SwiftUITestSample/SwiftUITestSampleApp.swift @@ -12,10 +12,6 @@ struct SwiftUITestSampleApp: App { SentrySDK.start { options in options.debug = true options.dsn = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" - options.initialScope = { scope in - scope.injectGitInformation() - return scope - } Options.dsnHash = options.parsedDsn?.getHash() Options.cacheDirPath = options.cacheDirectoryPath } From b55686b9da12369d09423fb287140bf3c2f8f83c Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 9 Oct 2024 17:40:28 +0200 Subject: [PATCH 04/15] Add SwiftUITestSample scheme to the workspace --- .../xcschemes/SwiftUITestSample.xcscheme | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/xcshareddata/xcschemes/SwiftUITestSample.xcscheme diff --git a/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/xcshareddata/xcschemes/SwiftUITestSample.xcscheme b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/xcshareddata/xcschemes/SwiftUITestSample.xcscheme new file mode 100644 index 00000000000..729b49b69ce --- /dev/null +++ b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/xcshareddata/xcschemes/SwiftUITestSample.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 2da69a4a2ce0519a06c25b010d6bd5d4a784172d Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 9 Oct 2024 18:16:20 +0200 Subject: [PATCH 05/15] make project xcode 15.3 compatible --- .../SwiftUITestSample.xcodeproj/project.pbxproj | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj index 9aa32984add..c1eaeae2729 100644 --- a/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj +++ b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 77; + objectVersion = 70; objects = { /* Begin PBXBuildFile section */ @@ -35,11 +35,7 @@ /* End PBXFileReference section */ /* Begin PBXFileSystemSynchronizedRootGroup section */ - 330854C42CB6B5CF00D06618 /* SwiftUITestSample */ = { - isa = PBXFileSystemSynchronizedRootGroup; - path = SwiftUITestSample; - sourceTree = ""; - }; + 330854C42CB6B5CF00D06618 /* SwiftUITestSample */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = SwiftUITestSample; sourceTree = ""; }; /* End PBXFileSystemSynchronizedRootGroup section */ /* Begin PBXFrameworksBuildPhase section */ @@ -132,6 +128,7 @@ }; }; buildConfigurationList = 330854BD2CB6B5CF00D06618 /* Build configuration list for PBXProject "SwiftUITestSample" */; + compatibilityVersion = "Xcode 15.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( @@ -140,7 +137,6 @@ ); mainGroup = 330854B92CB6B5CF00D06618; minimizedProjectReferenceProxies = 1; - preferredProjectObjectVersion = 77; productRefGroup = 330854C32CB6B5CF00D06618 /* Products */; projectDirPath = ""; projectRoot = ""; From 6d6a04074681a6ebefd32930b8476cded6e42926 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 9 Oct 2024 18:19:35 +0200 Subject: [PATCH 06/15] Try Xcode 16 --- .github/workflows/eval-ui-tests-p0.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/eval-ui-tests-p0.yml b/.github/workflows/eval-ui-tests-p0.yml index feef280a00f..e595ce811cf 100644 --- a/.github/workflows/eval-ui-tests-p0.yml +++ b/.github/workflows/eval-ui-tests-p0.yml @@ -23,7 +23,7 @@ jobs: runs-on: macos-14 steps: - uses: actions/checkout@v4 - - run: ./scripts/ci-select-xcode.sh 15.4 + - run: ./scripts/ci-select-xcode.sh 16 - uses: ruby/setup-ruby@v1 with: bundler-cache: true From aa638eaa9b15b2165c9d3291688f1fe929f57901 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 9 Oct 2024 19:29:30 +0200 Subject: [PATCH 07/15] Fix create simulator script --- .github/workflows/ui-tests.yml | 10 +++++----- scripts/create-simulator.sh | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index b51d55ac9fd..a9468125d0c 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -79,9 +79,9 @@ jobs: path: | ~/Library/Logs/scan/*.log ./fastlane/test_output/** - - ios-swift-ui-tests: - name: iOS-Swift UI Tests ${{matrix.device}} + + ui-tests-swift: + name: UI Tests for iOS-Swift ${{matrix.device}} Simulator runs-on: ${{matrix.runs-on}} strategy: fail-fast: false @@ -105,10 +105,10 @@ jobs: - name: Create iOS 16.4 simulator if: ${{ matrix.device == 'iPhone 14 (16.4)' }} - run: ./scripts/create-simulator.sh 14.3.1 16.4 16-4 + run: ./scripts/create-simulator.sh 14.3.1 16.4 "iPhone 14" - name: Run Fastlane - run: fastlane ui_tests_ios_swift device:"${{matrix.device}}" + run: fastlane ui_tests_ios_swift device:"${{matrix.device}}" - name: Archiving Raw Test Logs uses: actions/upload-artifact@v4 diff --git a/scripts/create-simulator.sh b/scripts/create-simulator.sh index c612068f1ba..ec9a1fb3069 100755 --- a/scripts/create-simulator.sh +++ b/scripts/create-simulator.sh @@ -5,8 +5,10 @@ set -euo pipefail XCODE_VERSION="${1}" SIM_RUNTIME="${2}" -SIM_RUNTIME_WITH_DASH="${3}" +DEVICE_TYPE="${3}" # A valid available device type. Find these by running "xcrun simctl list devicetypes". + +SIM_RUNTIME_WITH_DASH="${SIM_RUNTIME//./-}" sudo mkdir -p /Library/Developer/CoreSimulator/Profiles/Runtimes sudo ln -s "/Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime" "/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS ${SIM_RUNTIME}.simruntime" -xcrun simctl create custom-test-device "iPhone 8" "com.apple.CoreSimulator.SimRuntime.iOS-${SIM_RUNTIME_WITH_DASH}" +xcrun simctl create custom-test-device "${DEVICE_TYPE}" "com.apple.CoreSimulator.SimRuntime.iOS-${SIM_RUNTIME_WITH_DASH}" From 452d2ba392b765b8e678cfe8526fe51cc88d887d Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Wed, 9 Oct 2024 19:43:08 +0200 Subject: [PATCH 08/15] Set ios min to ios 15 --- .../SwiftUITestSample.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj index c1eaeae2729..b9cff85c4be 100644 --- a/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj +++ b/TestSamples/SwiftUITestSample/SwiftUITestSample.xcodeproj/project.pbxproj @@ -301,6 +301,7 @@ INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -328,6 +329,7 @@ INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", From 3dda607fa713b651f4d63566eda072e548f8d2ef Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Thu, 10 Oct 2024 10:46:49 +0200 Subject: [PATCH 09/15] fix naming --- .../{eval-ui-tests-p0.yml => ui-tests-critical.yml} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename .github/workflows/{eval-ui-tests-p0.yml => ui-tests-critical.yml} (97%) diff --git a/.github/workflows/eval-ui-tests-p0.yml b/.github/workflows/ui-tests-critical.yml similarity index 97% rename from .github/workflows/eval-ui-tests-p0.yml rename to .github/workflows/ui-tests-critical.yml index e595ce811cf..24551d93230 100644 --- a/.github/workflows/eval-ui-tests-p0.yml +++ b/.github/workflows/ui-tests-critical.yml @@ -1,4 +1,4 @@ -name: Maestro UI Tests +name: UI Tests Critical on: push: branches: @@ -18,7 +18,7 @@ concurrency: cancel-in-progress: true jobs: - build-sample-for-maestro: + build-sample: name: Build SwiftUITestSample Sample runs-on: macos-14 steps: @@ -33,7 +33,7 @@ jobs: name: SwiftUITestSample path: DerivedData/Build/Products/Debug-iphonesimulator/SwiftUITestSample.app - eval-run-maestro-tests: + run-tests: name: Test iOS ${{matrix.os-version}} on ${{matrix.device}} Simulator needs: [build-sample-for-maestro] runs-on: ${{matrix.runs-on}} From 24ba4bc0ef34da9905d436af4a2bd5c817ee0d7e Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Thu, 10 Oct 2024 10:47:04 +0200 Subject: [PATCH 10/15] only create sim when needed --- .github/workflows/ui-tests-critical.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ui-tests-critical.yml b/.github/workflows/ui-tests-critical.yml index 24551d93230..c0339299b0c 100644 --- a/.github/workflows/ui-tests-critical.yml +++ b/.github/workflows/ui-tests-critical.yml @@ -55,10 +55,12 @@ jobs: xcode: "13.4.1" device: "iPhone 8" os-version: "15.5" + create-simulator: true - runs-on: macos-13 xcode: "14.3.1" device: "iPhone 14" os-version: "16.4" + create-simulator: true - runs-on: macos-14 xcode: "15.4" device: "iPhone 15" @@ -67,6 +69,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Create ${{matrix.device}} (${{matrix.os-version}}) Simulator using Xcode ${{matrix.xcode}} + if: ${{matrix.create-simulator}} run: ./scripts/create-simulator.sh "${{matrix.xcode}}" "${{matrix.os-version}}" "${{matrix.device}}" - name: Install Maestro run: brew tap mobile-dev-inc/tap && brew install mobile-dev-inc/tap/maestro@1.38 From c5ac6f9d9a01c59aa720f26c45a3ddad6b28c92c Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Thu, 10 Oct 2024 10:47:22 +0200 Subject: [PATCH 11/15] fix current attempt counter --- .github/workflows/ui-tests-critical.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ui-tests-critical.yml b/.github/workflows/ui-tests-critical.yml index c0339299b0c..9c57cbeebe0 100644 --- a/.github/workflows/ui-tests-critical.yml +++ b/.github/workflows/ui-tests-critical.yml @@ -94,6 +94,8 @@ jobs: CURR_ATTEMPT=0 RESULT=1 while [[ $CURR_ATTEMPT -lt $MAX_ATTEMPTS ]] && [[ $RESULT -ne 0 ]]; do + CURR_ATTEMPT=$((CURR_ATTEMPT+1)) + echo "Attempt number $CURR_ATTEMPT" maestro test ${{env.MAESTRO_FLOWS_PATH}} --format junit --debug-output ${{env.MAESTRO_LOGS_PATH}} RESULT=$? done From 140ab15101df5cf4ff9fe553704421094d8c6be2 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Thu, 10 Oct 2024 10:48:02 +0200 Subject: [PATCH 12/15] remove the retry code --- .github/workflows/ui-tests-critical.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/ui-tests-critical.yml b/.github/workflows/ui-tests-critical.yml index 9c57cbeebe0..0c4c547b330 100644 --- a/.github/workflows/ui-tests-critical.yml +++ b/.github/workflows/ui-tests-critical.yml @@ -88,18 +88,7 @@ jobs: run: | xcrun simctl install booted ${{env.APP_PATH}} - # Avoid exit after command fails - set +e - # Add retries for flakyness - CURR_ATTEMPT=0 - RESULT=1 - while [[ $CURR_ATTEMPT -lt $MAX_ATTEMPTS ]] && [[ $RESULT -ne 0 ]]; do - CURR_ATTEMPT=$((CURR_ATTEMPT+1)) - echo "Attempt number $CURR_ATTEMPT" - maestro test ${{env.MAESTRO_FLOWS_PATH}} --format junit --debug-output ${{env.MAESTRO_LOGS_PATH}} - RESULT=$? - done - exit $RESULT + maestro test ${{env.MAESTRO_FLOWS_PATH}} --format junit --debug-output ${{env.MAESTRO_LOGS_PATH}} - name: Store Maestro Logs uses: actions/upload-artifact@v4 From 13d6ba3c42cc6b82b4dec81822605f81c4d7330b Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Thu, 10 Oct 2024 10:57:51 +0200 Subject: [PATCH 13/15] add ios 18 sim --- .github/workflows/ui-tests-critical.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ui-tests-critical.yml b/.github/workflows/ui-tests-critical.yml index 0c4c547b330..19a3e776b66 100644 --- a/.github/workflows/ui-tests-critical.yml +++ b/.github/workflows/ui-tests-critical.yml @@ -65,6 +65,10 @@ jobs: xcode: "15.4" device: "iPhone 15" os-version: "17.5" + - runs-on: macos-15 + xcode: "16" + device: "iPhone 16" + os-version: "18.0" steps: - uses: actions/checkout@v4 From 1de5dad10ca819d8261e363cd63d10cf09dfdc12 Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Thu, 10 Oct 2024 10:59:59 +0200 Subject: [PATCH 14/15] fix workflow trigger --- .github/workflows/ui-tests-critical.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui-tests-critical.yml b/.github/workflows/ui-tests-critical.yml index 19a3e776b66..d564ab4fb3f 100644 --- a/.github/workflows/ui-tests-critical.yml +++ b/.github/workflows/ui-tests-critical.yml @@ -7,7 +7,7 @@ on: pull_request: paths: - 'Sources/**' - - '.github/workflows/eval-ui-tests-p0.yml' + - '.github/workflows/ui-tests-critical.yml' - 'fastlane/**' - 'Shared/**' - 'TestSamples/**' From 0a25f2488923d4b01a42c2459c3f75452c2db5ca Mon Sep 17 00:00:00 2001 From: Krystof Woldrich Date: Thu, 10 Oct 2024 11:03:20 +0200 Subject: [PATCH 15/15] fix workflow --- .github/workflows/ui-tests-critical.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ui-tests-critical.yml b/.github/workflows/ui-tests-critical.yml index d564ab4fb3f..a1d74943dc0 100644 --- a/.github/workflows/ui-tests-critical.yml +++ b/.github/workflows/ui-tests-critical.yml @@ -9,7 +9,6 @@ on: - 'Sources/**' - '.github/workflows/ui-tests-critical.yml' - 'fastlane/**' - - 'Shared/**' - 'TestSamples/**' # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value @@ -35,7 +34,7 @@ jobs: run-tests: name: Test iOS ${{matrix.os-version}} on ${{matrix.device}} Simulator - needs: [build-sample-for-maestro] + needs: [build-sample] runs-on: ${{matrix.runs-on}} env: APP_ARTIFACT_NAME: "SwiftUITestSample"