From f16834077f69580967182ecb67a76fd6fe2c0a5a Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Tue, 18 Apr 2023 10:23:17 +0200 Subject: [PATCH] Chore: Removing integration tests (#2916) Both Alamofire and Home Assistant integration tests are causing more trouble then helping, we will remove this CI tests. Co-authored-by: Philipp Hofmann --- .github/workflows/integration-tests.yml | 141 -------------- Makefile | 6 + develop-docs/README.md | 13 ++ ...ch => add-local-sentry-to-alamofire.patch} | 110 +++++------ scripts/add-local-sentry-to-homekit.patch | 176 ++++++++++++++++++ scripts/add-sentry-to-homekit.patch | 114 ------------ scripts/add-sentry-to-vlc.patch | 171 ----------------- scripts/apply-patch.sh | 26 --- scripts/no-changes-in-high-risk-files.sh | 15 +- scripts/test-alamofire.sh | 53 ++++++ scripts/test-homekit.sh | 46 +++++ 11 files changed, 354 insertions(+), 517 deletions(-) delete mode 100644 .github/workflows/integration-tests.yml rename scripts/{add-sentry-to-alamofire.patch => add-local-sentry-to-alamofire.patch} (51%) create mode 100644 scripts/add-local-sentry-to-homekit.patch delete mode 100644 scripts/add-sentry-to-homekit.patch delete mode 100644 scripts/add-sentry-to-vlc.patch delete mode 100755 scripts/apply-patch.sh create mode 100755 scripts/test-alamofire.sh create mode 100755 scripts/test-homekit.sh diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml deleted file mode 100644 index f1aff7719e5..00000000000 --- a/.github/workflows/integration-tests.yml +++ /dev/null @@ -1,141 +0,0 @@ -name: Integration Tests -on: - push: - branches: - - main - - pull_request: - paths: - - 'Sources/**' - - 'Tests/**' - - 'scripts/**' - - '.github/workflows/integration-tests.yml' - - 'fastlane/**' - -jobs: - # Ensure the swizzling of network classes doesn't break the normal functionality of web requests. - # We borrow the tests of Alamofire under the MIT license: https://github.com/Alamofire/Alamofire. - # The following steps checkout Alamofire and apply a github patch to the project. The patch adds - # Sentry to the tests with auto performance monitoring enabled. While the tests are running a - # transaction is bound to the scope, so the Sentry SDK adds spans to the transaction. This doesn't - # validate if the Sentry SDK adds proper spans. It only validates that the swizzling logic - # doesn't break web requests. - web-request-tests: - name: Integration Web Requests - runs-on: macos-11 - timeout-minutes: 15 - steps: - - uses: actions/checkout@v3 - with: - repository: 'Alamofire/Alamofire' - ref: 'f82c23a8a7ef8dc1a49a8bfc6a96883e79121864' - - # Use github.event.pull_request.head.sha instead of github.sha when available as - # the github.sha is the pre merge commit id for PRs. - # See https://github.community/t/github-sha-isnt-the-value-expected/17903/17906. - - name: Download Apply Patch Script - run: >- - if [[ "${{ github.event.pull_request.head.sha }}" != "" ]]; then - curl https://raw.githubusercontent.com/getsentry/sentry-cocoa/${{ github.event.pull_request.head.sha }}/scripts/apply-patch.sh --output apply-patch.sh - else - curl https://raw.githubusercontent.com/getsentry/sentry-cocoa/${{ github.sha }}/scripts/apply-patch.sh --output apply-patch.sh - fi - - chmod +x apply-patch.sh - shell: bash - - - name: Download and Apply Patch - run: ./apply-patch.sh "${{ github.event.pull_request.head.sha }}" "${{ github.sha }}" add-sentry-to-alamofire - - - name: Download Firewalk - run: curl "https://github.com/Alamofire/Firewalk/releases/download/0.8.1/firewalk.zip" --output firewalk.zip -L - - - name: Unzip Firewalk - run: Unzip "firewalk.zip" - - - name: Start Firewalk - run: ./firewalk & - - - name: Validate Firewalk is running - run: curl http://localhost:8080/ - - - name: Run tests - # Run the tests twice, because they are sometimes flaky. - # We skip two tests because it also fails sometimes when not adding Sentry to Alamofire. - run: | - for i in {1..2}; do \ - set -o pipefail && env NSUnbufferedIO=YES \ - xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire iOS" -destination "OS=15.2,name=iPhone 13 Pro" \ - -skip-testing:"Alamofire iOS Tests/AuthenticationInterceptorTestCase/testThatInterceptorThrowsMissingCredentialErrorWhenCredentialIsNilAndRequestShouldBeRetried" \ - -skip-testing:"Alamofire iOS Tests/AuthenticationInterceptorTestCase/testThatInterceptorRetriesRequestThatFailedWithOutdatedCredential" \ - test | xcpretty \ - && break ; done - - # We borrow the tests of Home Assistant under the Apache license: https://github.com/home-assistant/iOS. - # The following steps checkout Home Assistant and apply a github patch to the project. The patch adds - # Sentry to the app with auto performance monitoring enabled. We then run the UI tests to make sure - # adding our SDK doesn't cause any major issues. - home-assistant-tests: - runs-on: macos-11 - timeout-minutes: 60 - env: - DEVELOPER_DIR: /Applications/Xcode_13.2.app/Contents/Developer - steps: - - uses: actions/checkout@v3 - with: - repository: 'home-assistant/iOS' - ref: '6d6606aed63a778c5a2bd64f8981823433a7f2fa' - - # Use github.event.pull_request.head.sha instead of github.sha when available as - # the github.sha is the pre merge commit id for PRs. - # See https://github.community/t/github-sha-isnt-the-value-expected/17903/17906. - - name: Download Apply Patch Script - run: >- - if [[ "${{ github.event.pull_request.head.sha }}" != "" ]]; then - curl https://raw.githubusercontent.com/getsentry/sentry-cocoa/${{ github.event.pull_request.head.sha }}/scripts/apply-patch.sh --output apply-patch.sh - else - curl https://raw.githubusercontent.com/getsentry/sentry-cocoa/${{ github.sha }}/scripts/apply-patch.sh --output apply-patch.sh - fi - - chmod +x apply-patch.sh - shell: bash - - - name: Download and Apply Patch - run: ./apply-patch.sh "${{ github.event.pull_request.head.sha }}" "${{ github.sha }}" add-sentry-to-homekit - - - uses: actions/cache@v3 - name: 'Cache: Gems' - id: cache_gems - with: - path: vendor/bundle - key: home-assistant-integration-gems-${{ runner.os }}-${{ env.ImageVersion }}-${{ env.DEVELOPER_DIR }}-${{ hashFiles('**/Gemfile.lock') }} - - - uses: actions/cache@v3 - name: 'Cache: Pods' - id: cache_pods - if: steps.cache_gems.outputs.cache-hit == 'true' - with: - path: | - Pods - Podfile - Podfile.lock - Tools/** - key: home-assistant-tests-pods-${{ runner.os }}-${{ env.ImageVersion }}-${{ env.DEVELOPER_DIR }}-${{ hashFiles('Podfile', '**/Podfile.lock', 'Tools/**') }} - - - name: Install Gems - if: steps.cache_gems.outputs.cache-hit != 'true' - run: | - bundle config set --local path 'vendor/bundle' - bundle install --jobs 4 --retry 3 - - - name: Install Pods Release - if: steps.cache_pods.outputs.cache-hit != 'true' - run: | - bundle config set --local path 'vendor/bundle' - bundle exec pod install --repo-update - - - name: Run tests - # Run the tests twice in case they are flaky. - run: | - bundle config set --local path 'vendor/bundle' - for i in {1..2}; do bundle exec fastlane test && break ; done diff --git a/Makefile b/Makefile index def0d43e4c9..dd3347aba86 100644 --- a/Makefile +++ b/Makefile @@ -48,6 +48,12 @@ run-test-server: cd ./test-server && swift run & .PHONY: run-test-server +test-alamofire: + ./scripts/test-alamofire.sh + +test-homekit: + ./scripts/test-homekit.sh + analyze: rm -rf analyzer xcodebuild analyze -workspace Sentry.xcworkspace -scheme Sentry -configuration Release CLANG_ANALYZER_OUTPUT=html CLANG_ANALYZER_OUTPUT_DIR=analyzer -destination "platform=iOS Simulator,OS=latest,name=iPhone 11" CODE_SIGNING_ALLOWED="NO" | xcpretty -t && [[ -z `find analyzer -name "*.html"` ]] diff --git a/develop-docs/README.md b/develop-docs/README.md index 4782dd8afd7..844096e4261 100644 --- a/develop-docs/README.md +++ b/develop-docs/README.md @@ -225,3 +225,16 @@ For the swizzling of UIViewControllers and NSURLSession, we have UI tests runnin tests on iOS 12 simulators is acceptable. This decision reverts [manually installing iOS 12 simulators](#ios-12-simulators). Related to [GH-2862](https://github.com/getsentry/sentry-cocoa/issues/2862) and + +### Remove integration tests from CI + +Date: April 17th 2023 +Contributors: @brustolin @philipphofmann + +Both Alamofire and Home Assistance integration tests are no longer reliable as they keep failing and causing more problems than adding value. +These tests used to work for a while, and we know that the Sentry SDK was not breaking these projects. +Therefore, we have decided to remove the tests and add some key files to our list of risk files. +This way, if these files are changed, we will be reminded to test the changes with other projects. +Additionally, two new 'make' commands(test-alamofire, test-homekit) are being added to the project to assist in testing the Sentry SDK in third-party projects. + +Related to [GH-2916](https://github.com/getsentry/sentry-cocoa/pull/2916) diff --git a/scripts/add-sentry-to-alamofire.patch b/scripts/add-local-sentry-to-alamofire.patch similarity index 51% rename from scripts/add-sentry-to-alamofire.patch rename to scripts/add-local-sentry-to-alamofire.patch index f3cf3a35bfc..12442691378 100644 --- a/scripts/add-sentry-to-alamofire.patch +++ b/scripts/add-local-sentry-to-alamofire.patch @@ -1,94 +1,81 @@ diff --git a/Alamofire.xcodeproj/project.pbxproj b/Alamofire.xcodeproj/project.pbxproj -index 3882645..56fea58 100644 +index 3882645e..a1c24fdf 100644 --- a/Alamofire.xcodeproj/project.pbxproj +++ b/Alamofire.xcodeproj/project.pbxproj -@@ -409,6 +409,7 @@ - 4CFB030E1D7D2FA20056F249 /* utf8_string.txt in Resources */ = {isa = PBXBuildFile; fileRef = 4CFB02F41D7D2FA20056F249 /* utf8_string.txt */; }; +@@ -410,6 +410,7 @@ 4CFB030F1D7D2FA20056F249 /* utf8_string.txt in Resources */ = {isa = PBXBuildFile; fileRef = 4CFB02F41D7D2FA20056F249 /* utf8_string.txt */; }; 4DD67C251A5C590000ED2280 /* Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = F897FF4019AA800700AB5182 /* Alamofire.swift */; }; -+ 7B4C98B52743C1FE00B03EC9 /* Sentry in Frameworks */ = {isa = PBXBuildFile; productRef = 7B4C98B42743C1FE00B03EC9 /* Sentry */; }; 8035DB621BAB492500466CB3 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8111E3319A95C8B0040E7D1 /* Alamofire.framework */; }; ++ D8D0FEC029ED312200BA68B6 /* Sentry in Frameworks */ = {isa = PBXBuildFile; productRef = D8D0FEBF29ED312200BA68B6 /* Sentry */; }; E4202FD01B667AA100C997FB /* ParameterEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CE2724E1AF88FB500F1D59A /* ParameterEncoding.swift */; }; E4202FD21B667AA100C997FB /* ResponseSerialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CDE2C451AF89FF300BABAE5 /* ResponseSerialization.swift */; }; -@@ -623,6 +624,7 @@ - isa = PBXFrameworksBuildPhase; + E4202FD41B667AA100C997FB /* Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = F897FF4019AA800700AB5182 /* Alamofire.swift */; }; +@@ -570,6 +571,7 @@ + B39E2F871C1A72F8002DA1A9 /* certPEM.crt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = certPEM.crt; path = selfSignedAndMalformedCerts/certPEM.crt; sourceTree = ""; }; + B39E2F891C1A72F8002DA1A9 /* randomGibberish.crt */ = {isa = PBXFileReference; lastKnownFileType = file; name = randomGibberish.crt; path = selfSignedAndMalformedCerts/randomGibberish.crt; sourceTree = ""; }; + B39E2F8A1C1A72F8002DA1A9 /* keyDER.der */ = {isa = PBXFileReference; lastKnownFileType = file; name = keyDER.der; path = selfSignedAndMalformedCerts/keyDER.der; sourceTree = ""; }; ++ D8D0FEBD29ED310A00BA68B6 /* sentry-cocoa */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "sentry-cocoa"; path = ../..; sourceTree = ""; }; + E4202FE01B667AA100C997FB /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F8111E3319A95C8B0040E7D1 /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F8111E3719A95C8B0040E7D1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +@@ -638,6 +640,7 @@ buildActionMask = 2147483647; files = ( -+ 7B4C98B52743C1FE00B03EC9 /* Sentry in Frameworks */, + 8035DB621BAB492500466CB3 /* Alamofire.framework in Frameworks */, ++ D8D0FEC029ED312200BA68B6 /* Sentry in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; -@@ -962,6 +964,13 @@ - path = String; +@@ -976,14 +979,31 @@ + name = "Varying Encoding Types and Extensions"; sourceTree = ""; }; -+ 7BF0E78F274B938400873798 /* Frameworks */ = { ++ D8D0FEBC29ED310A00BA68B6 /* Packages */ = { ++ isa = PBXGroup; ++ children = ( ++ D8D0FEBD29ED310A00BA68B6 /* sentry-cocoa */, ++ ); ++ name = Packages; ++ sourceTree = ""; ++ }; ++ D8D0FEBE29ED312200BA68B6 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; - B39E2F821C1A72E5002DA1A9 /* Varying Encoding Types and Extensions */ = { + F8111E2919A95C8B0040E7D1 = { isa = PBXGroup; children = ( -@@ -984,6 +993,7 @@ ++ D8D0FEBC29ED310A00BA68B6 /* Packages */, + 4CE292381EF4B116008DA555 /* Deployment */, + 4CE292301EF4A386008DA555 /* Documentation */, F8111E3519A95C8B0040E7D1 /* Source */, F8111E3F19A95C8B0040E7D1 /* Tests */, F8111E3419A95C8B0040E7D1 /* Products */, -+ 7BF0E78F274B938400873798 /* Frameworks */, ++ D8D0FEBE29ED312200BA68B6 /* Frameworks */, ); indentWidth = 4; sourceTree = ""; -@@ -1152,6 +1162,8 @@ - dependencies = ( +@@ -1206,6 +1226,9 @@ + F8111E6619A967880040E7D1 /* PBXTargetDependency */, ); - name = "Alamofire macOS"; + name = "Alamofire iOS Tests"; + packageProductDependencies = ( ++ D8D0FEBF29ED312200BA68B6 /* Sentry */, + ); - productName = AlamofireOSX; - productReference = 4DD67C0B1A5C55C900ED2280 /* Alamofire.framework */; - productType = "com.apple.product-type.framework"; -@@ -1188,6 +1200,9 @@ - dependencies = ( - ); - name = "Alamofire iOS"; -+ packageProductDependencies = ( -+ 7B4C98B42743C1FE00B03EC9 /* Sentry */, -+ ); - productName = Alamofire; - productReference = F8111E3319A95C8B0040E7D1 /* Alamofire.framework */; - productType = "com.apple.product-type.framework"; -@@ -1281,6 +1296,9 @@ - Base, - ); - mainGroup = F8111E2919A95C8B0040E7D1; -+ packageReferences = ( -+ 7B4C98B32743C1FE00B03EC9 /* XCRemoteSwiftPackageReference "sentry-cocoa" */, -+ ); - productRefGroup = F8111E3419A95C8B0040E7D1 /* Products */; - projectDirPath = ""; - projectRoot = ""; -@@ -2379,6 +2397,25 @@ + productName = AlamofireTests; + productReference = F8111E3E19A95C8B0040E7D1 /* Alamofire iOS Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; +@@ -2379,6 +2402,13 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + -+/* Begin XCRemoteSwiftPackageReference section */ -+ 7B4C98B32743C1FE00B03EC9 /* XCRemoteSwiftPackageReference "sentry-cocoa" */ = { -+ isa = XCRemoteSwiftPackageReference; -+ repositoryURL = "https://github.com/getsentry/sentry-cocoa"; -+ requirement = { -+ kind = revision; -+ revision = __GITHUB_REVISION_PLACEHOLDER__; -+ }; -+ }; -+/* End XCRemoteSwiftPackageReference section */ -+ +/* Begin XCSwiftPackageProductDependency section */ -+ 7B4C98B42743C1FE00B03EC9 /* Sentry */ = { ++ D8D0FEBF29ED312200BA68B6 /* Sentry */ = { + isa = XCSwiftPackageProductDependency; -+ package = 7B4C98B32743C1FE00B03EC9 /* XCRemoteSwiftPackageReference "sentry-cocoa" */; + productName = Sentry; + }; +/* End XCSwiftPackageProductDependency section */ @@ -96,10 +83,10 @@ index 3882645..56fea58 100644 rootObject = F8111E2A19A95C8B0040E7D1 /* Project object */; } diff --git a/Tests/BaseTestCase.swift b/Tests/BaseTestCase.swift -index 1eeafe7..f5f3dea 100644 +index 1eeafe7a..d24465ec 100644 --- a/Tests/BaseTestCase.swift +++ b/Tests/BaseTestCase.swift -@@ -25,8 +25,38 @@ +@@ -25,8 +25,37 @@ import Alamofire import Foundation import XCTest @@ -108,12 +95,11 @@ index 1eeafe7..f5f3dea 100644 +private var SentryInitialized = false class BaseTestCase: XCTestCase { -+ + private static var transaction: Span! -+ ++ + override class func setUp() { + super.setUp() -+ ++ + if (!SentryInitialized) { + SentrySDK.start { options in + options.dsn = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" @@ -122,19 +108,19 @@ index 1eeafe7..f5f3dea 100644 + options.enableFileIOTracing = true + options.profilesSampleRate = 1.0 + } -+ ++ + SentryInitialized = true + } -+ ++ + // Bind transaction to scope so we add spans to it + transaction = SentrySDK.startTransaction(name: "Alamofire", operation: "alamofire", bindToScope: true) + } -+ ++ + override class func tearDown() { + super.tearDown() + transaction.finish() + } -+ ++ let timeout: TimeInterval = 10 var testDirectoryURL: URL { diff --git a/scripts/add-local-sentry-to-homekit.patch b/scripts/add-local-sentry-to-homekit.patch new file mode 100644 index 00000000000..e4d5026774d --- /dev/null +++ b/scripts/add-local-sentry-to-homekit.patch @@ -0,0 +1,176 @@ +diff --git a/Configuration/HomeAssistant.xcconfig b/Configuration/HomeAssistant.xcconfig +index 2b1cdd31..962ec867 100644 +--- a/Configuration/HomeAssistant.xcconfig ++++ b/Configuration/HomeAssistant.xcconfig +@@ -92,3 +92,5 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES + CLANG_ANALYZER_NONNULL = YES + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES + GCC_NO_COMMON_BLOCKS = YES ++ ++OTHER_LDFLAGS[sdk=watch*] = $(inherited) -framework WatchKit +diff --git a/HomeAssistant.xcodeproj/project.pbxproj b/HomeAssistant.xcodeproj/project.pbxproj +index 64a81356..da0e3ede 100644 +--- a/HomeAssistant.xcodeproj/project.pbxproj ++++ b/HomeAssistant.xcodeproj/project.pbxproj +@@ -311,7 +311,6 @@ + 11AF4D26249D1931006C74C0 /* LastUpdateSensor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11AF4D24249D1931006C74C0 /* LastUpdateSensor.swift */; }; + 11AF4D2A249D88C5006C74C0 /* ActivitySensor.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11AF4D29249D88C5006C74C0 /* ActivitySensor.test.swift */; }; + 11AF4D2C249D965C006C74C0 /* BatterySensor.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11AF4D2B249D965C006C74C0 /* BatterySensor.test.swift */; }; +- 11AF4D2E249DA5AF006C74C0 /* GeocoderSensor.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11AF4D2D249DA5AF006C74C0 /* GeocoderSensor.test.swift */; }; + 11AF4D30249DCA88006C74C0 /* ConnectivitySensor.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11AF4D2F249DCA87006C74C0 /* ConnectivitySensor.test.swift */; }; + 11B1FFC524CCD72F00F9BCB2 /* VoiceShortcutRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B1FFC424CCD72F00F9BCB2 /* VoiceShortcutRow.swift */; }; + 11B38EDF275BE29F00205C7B /* ConnectionInfo.test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11B38EDE275BE29F00205C7B /* ConnectionInfo.test.swift */; }; +@@ -1381,7 +1380,6 @@ + 11AF4D24249D1931006C74C0 /* LastUpdateSensor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LastUpdateSensor.swift; sourceTree = ""; }; + 11AF4D29249D88C5006C74C0 /* ActivitySensor.test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivitySensor.test.swift; sourceTree = ""; }; + 11AF4D2B249D965C006C74C0 /* BatterySensor.test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BatterySensor.test.swift; sourceTree = ""; }; +- 11AF4D2D249DA5AF006C74C0 /* GeocoderSensor.test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeocoderSensor.test.swift; sourceTree = ""; }; + 11AF4D2F249DCA87006C74C0 /* ConnectivitySensor.test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectivitySensor.test.swift; sourceTree = ""; }; + 11B1FFC424CCD72F00F9BCB2 /* VoiceShortcutRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoiceShortcutRow.swift; sourceTree = ""; }; + 11B38EDE275BE29F00205C7B /* ConnectionInfo.test.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectionInfo.test.swift; sourceTree = ""; }; +@@ -2639,7 +2637,6 @@ + 11AF4D29249D88C5006C74C0 /* ActivitySensor.test.swift */, + 11AF4D2B249D965C006C74C0 /* BatterySensor.test.swift */, + 11AF4D2F249DCA87006C74C0 /* ConnectivitySensor.test.swift */, +- 11AF4D2D249DA5AF006C74C0 /* GeocoderSensor.test.swift */, + 11CB98C5249DE15B00B05222 /* LastUpdateSensor.test.swift */, + 11CB98C7249DE24000B05222 /* PedometerSensor.test.swift */, + 119385A6249E9F930097F497 /* StorageSensor.test.swift */, +@@ -5744,7 +5741,6 @@ + 11A3F08C24ECE88C0018D84F /* WebhookUpdateLocation.test.swift in Sources */, + 11B7DC1F266C5D3E0090BD3B /* LocalPushManager.test.swift in Sources */, + 11CB98CD249E637300B05222 /* Version+HA.test.swift in Sources */, +- 11AF4D2E249DA5AF006C74C0 /* GeocoderSensor.test.swift in Sources */, + 114FACAE24B2ABA2006C581F /* Promise+WebhookJson.test.swift in Sources */, + 115AD72D267C57DA0090B243 /* FocusSensor.test.swift in Sources */, + 11CB98C6249DE15B00B05222 /* LastUpdateSensor.test.swift in Sources */, +diff --git a/Podfile b/Podfile +index d2d83b14..d73adf17 100644 +--- a/Podfile ++++ b/Podfile +@@ -30,7 +30,8 @@ pod 'ObjectMapper', git: 'https://github.com/tristanhimmelman/ObjectMapper.git', + pod 'PromiseKit' + + pod 'RealmSwift' +-pod 'Sentry' ++pod 'Sentry', :path => '../../' ++pod 'SentryPrivate', :path => '../../' + pod 'UIColor_Hex_Swift' + pod 'Version' + pod 'XCGLogger' +@@ -111,7 +112,7 @@ post_install do |installer| + target.build_configurations.each do |config| + config.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = '5.0' + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' +- config.build_settings['SWIFT_INSTALL_OBJC_HEADER'] = 'NO' ++ config.build_settings['SWIFT_INSTALL_OBJC_HEADER'] = 'NO' unless target.name.include? 'Sentry' + end + + # Fix bundle targets' 'Signing Certificate' to 'Sign to Run Locally' +diff --git a/Sources/App/AppDelegate.swift b/Sources/App/AppDelegate.swift +index 8e0e35f4..96650a6f 100644 +--- a/Sources/App/AppDelegate.swift ++++ b/Sources/App/AppDelegate.swift +@@ -13,6 +13,7 @@ import SafariServices + import Shared + import UIKit + import XCGLogger ++import Sentry + + let keychain = Constants.Keychain + +@@ -125,6 +126,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate { + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { ++ SentrySDK.start { options in ++ options.dsn = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" ++ options.environment = "integration-tests" ++ options.tracesSampleRate = 1.0 ++ options.enableFileIOTracing = true ++ options.profilesSampleRate = 1.0 ++ } ++ + if NSClassFromString("XCTest") != nil { + return true + } +diff --git a/Sources/Shared/Environment/CrashReporter.swift b/Sources/Shared/Environment/CrashReporter.swift +index b8eb37f0..046e7851 100644 +--- a/Sources/Shared/Environment/CrashReporter.swift ++++ b/Sources/Shared/Environment/CrashReporter.swift +@@ -20,34 +20,6 @@ public class CrashReporterImpl: CrashReporter { + Current.Log.add(destination: with(SentryLogDestination()) { + $0.outputLevel = .warning + }) +- +- SentrySDK.start { options in +- options.dsn = "https://762c198b86594fa2b6bedf87028db34d@o427061.ingest.sentry.io/5372775" +- options.debug = Current.appConfiguration == .Debug +- options.enableAutoSessionTracking = Current.settingsStore.privacy.analytics +- options.maxBreadcrumbs = 1000 +- +- var integrations = type(of: options).defaultIntegrations() +- +- let analyticsIntegrations = Set([ +- "SentryAutoBreadcrumbTrackingIntegration", +- "SentryAutoSessionTrackingIntegration", +- ]) +- +- let crashesIntegrations = Set([ +- "SentryCrashIntegration", +- ]) +- +- if !Current.settingsStore.privacy.crashes { +- integrations.removeAll(where: { crashesIntegrations.contains($0) }) +- } +- +- if !Current.settingsStore.privacy.analytics { +- integrations.removeAll(where: { analyticsIntegrations.contains($0) }) +- } +- +- options.integrations = integrations +- } + } + + public func setUserProperty(value: String?, name: String) { +diff --git a/Sources/Shared/Environment/SentryLogDestination.swift b/Sources/Shared/Environment/SentryLogDestination.swift +index fb0d965b..d7c9924a 100644 +--- a/Sources/Shared/Environment/SentryLogDestination.swift ++++ b/Sources/Shared/Environment/SentryLogDestination.swift +@@ -10,7 +10,7 @@ open class SentryLogDestination: BaseQueuedDestination { + + let breadcrumb = Breadcrumb(level: .init(xcgLogLevel: logDetails.level), category: "log") + breadcrumb.message = message +- SentrySDK.addBreadcrumb(crumb: breadcrumb) ++ SentrySDK.addBreadcrumb(breadcrumb) + } + } + +diff --git a/fastlane/Fastfile b/fastlane/Fastfile +index 3a21ee25..0bb5778a 100644 +--- a/fastlane/Fastfile ++++ b/fastlane/Fastfile +@@ -287,23 +287,6 @@ end + + desc 'Find unused localized strings' + lane :unused_strings do +- files = [ +- '../Sources/App/Resources/en.lproj/Localizable.strings' +- ] +- files.each do |file| +- puts "Looking at #{file}" +- unused_strings = File.read(file) +- # grab the keys only +- .scan(/"([^"]+)" = [^;]+;/) +- # replace _ in the keys with nothing, which is what swiftgen does +- .map { |s| [s[0], s[0].gsub('_', '')] } +- # ignore any keys at the root level (aka like ok_label) +- .select { |full, _key| full.include?('.') } +- # find any strings that don't have matches in code +- .select { |_full, key| system("git grep --ignore-case --quiet #{key} -- ../*.swift") == false } +- unused_strings.each { |full, _key| puts full } +- puts "- Found #{unused_strings.count} unused strings" +- end + end + + desc 'Upload App Store Connect metadata to Lokalise' diff --git a/scripts/add-sentry-to-homekit.patch b/scripts/add-sentry-to-homekit.patch deleted file mode 100644 index 9fafc3c8db4..00000000000 --- a/scripts/add-sentry-to-homekit.patch +++ /dev/null @@ -1,114 +0,0 @@ -git diff HomeAssistant.xcconfig -diff --git a/Configuration/HomeAssistant.xcconfig b/Configuration/HomeAssistant.xcconfig -index 2b1cdd31..962ec867 100644 ---- a/Configuration/HomeAssistant.xcconfig -+++ b/Configuration/HomeAssistant.xcconfig -@@ -92,3 +92,5 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES - CLANG_ANALYZER_NONNULL = YES - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES - GCC_NO_COMMON_BLOCKS = YES -+ -+OTHER_LDFLAGS[sdk=watch*] = $(inherited) -framework WatchKit - -diff --git a/Podfile b/Podfile -index d2d83b14..6756f31b 100644 ---- a/Podfile -+++ b/Podfile -@@ -30,7 +30,8 @@ pod 'ObjectMapper', git: 'https://github.com/tristanhimmelman/ObjectMapper.git', - pod 'PromiseKit' - - pod 'RealmSwift' --pod 'Sentry' -+pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :commit => '__GITHUB_REVISION_PLACEHOLDER__' -+pod 'SentryPrivate', :git => 'https://github.com/getsentry/sentry-cocoa.git', :commit => '__GITHUB_REVISION_PLACEHOLDER__' - pod 'UIColor_Hex_Swift' - pod 'Version' - pod 'XCGLogger' -@@ -111,7 +112,7 @@ post_install do |installer| - target.build_configurations.each do |config| - config.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = '5.0' - config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' -- config.build_settings['SWIFT_INSTALL_OBJC_HEADER'] = 'NO' -+ config.build_settings['SWIFT_INSTALL_OBJC_HEADER'] = 'NO' unless target.name.include? 'Sentry' - end - - # Fix bundle targets' 'Signing Certificate' to 'Sign to Run Locally' -diff --git a/Sources/App/AppDelegate.swift b/Sources/App/AppDelegate.swift -index 8e0e35f4..3d34887d 100644 ---- a/Sources/App/AppDelegate.swift -+++ b/Sources/App/AppDelegate.swift -@@ -13,6 +13,7 @@ import SafariServices - import Shared - import UIKit - import XCGLogger -+import Sentry - - let keychain = Constants.Keychain - -@@ -125,6 +126,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate { - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? - ) -> Bool { -+ SentrySDK.start { options in -+ options.dsn = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" -+ options.environment = "integration-tests" -+ options.tracesSampleRate = 1.0 -+ options.enableFileIOTracing = true -+ options.profilesSampleRate = 1.0 -+ } -+ - if NSClassFromString("XCTest") != nil { - return true - } -diff --git a/Sources/Shared/Environment/CrashReporter.swift b/Sources/Shared/Environment/CrashReporter.swift -index b8eb37f0..046e7851 100644 ---- a/Sources/Shared/Environment/CrashReporter.swift -+++ b/Sources/Shared/Environment/CrashReporter.swift -@@ -20,34 +20,6 @@ public class CrashReporterImpl: CrashReporter { - Current.Log.add(destination: with(SentryLogDestination()) { - $0.outputLevel = .warning - }) -- -- SentrySDK.start { options in -- options.dsn = "https://762c198b86594fa2b6bedf87028db34d@o427061.ingest.sentry.io/5372775" -- options.debug = Current.appConfiguration == .Debug -- options.enableAutoSessionTracking = Current.settingsStore.privacy.analytics -- options.maxBreadcrumbs = 1000 -- -- var integrations = type(of: options).defaultIntegrations() -- -- let analyticsIntegrations = Set([ -- "SentryAutoBreadcrumbTrackingIntegration", -- "SentryAutoSessionTrackingIntegration", -- ]) -- -- let crashesIntegrations = Set([ -- "SentryCrashIntegration", -- ]) -- -- if !Current.settingsStore.privacy.crashes { -- integrations.removeAll(where: { crashesIntegrations.contains($0) }) -- } -- -- if !Current.settingsStore.privacy.analytics { -- integrations.removeAll(where: { analyticsIntegrations.contains($0) }) -- } -- -- options.integrations = integrations -- } - } - - public func setUserProperty(value: String?, name: String) { -diff --git a/Sources/Shared/Environment/SentryLogDestination.swift b/Sources/Shared/Environment/SentryLogDestination.swift -index fb0d965b..d7c9924a 100644 ---- a/Sources/Shared/Environment/SentryLogDestination.swift -+++ b/Sources/Shared/Environment/SentryLogDestination.swift -@@ -10,7 +10,7 @@ open class SentryLogDestination: BaseQueuedDestination { - - let breadcrumb = Breadcrumb(level: .init(xcgLogLevel: logDetails.level), category: "log") - breadcrumb.message = message -- SentrySDK.addBreadcrumb(crumb: breadcrumb) -+ SentrySDK.addBreadcrumb(breadcrumb) - } - } - diff --git a/scripts/add-sentry-to-vlc.patch b/scripts/add-sentry-to-vlc.patch deleted file mode 100644 index 8989f958364..00000000000 --- a/scripts/add-sentry-to-vlc.patch +++ /dev/null @@ -1,171 +0,0 @@ -diff --git a/Podfile b/Podfile -index b9205a9f..3156735b 100644 ---- a/Podfile -+++ b/Podfile -@@ -9,13 +9,15 @@ - pod 'CocoaHTTPServer', :git => 'https://github.com/fkuehne/CocoaHTTPServer.git' # has our fixes - pod 'xmlrpc', :git => 'https://github.com/fkuehne/xmlrpc.git', :commit => '3f8ce3a8' #fix case-sensitive FS - pod 'AFNetworking', '~>4.0' -+ pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa', :commit => '__GITHUB_REVISION_PLACEHOLDER__' -+ pod 'SentryPrivate', :git => 'https://github.com/getsentry/sentry-cocoa', :commit => '__GITHUB_REVISION_PLACEHOLDER__' - - # debug - pod 'SwiftLint', '~> 0.47.1', :configurations => ['Debug'] - end - - target 'VLC-iOS' do -- platform :ios, '9.0' -+ platform :ios, '11.0' - shared_pods - pod 'OBSlider', '1.1.0' - pod 'InAppSettingsKit', :git => 'https://github.com/Mikanbu/InAppSettingsKit.git', :commit => 'a429840' #tvOS fix -diff --git a/Sources/App/iOS/VLCAppDelegate.m b/Sources/App/iOS/VLCAppDelegate.m -index 2c1fc802..21495fd7 100644 ---- a/Sources/App/iOS/VLCAppDelegate.m -+++ b/Sources/App/iOS/VLCAppDelegate.m -@@ -19,6 +19,7 @@ - - #import "VLCAppDelegate.h" - #import "VLC-Swift.h" -+#import - - @interface VLCAppDelegate () - { -@@ -134,6 +135,16 @@ - - - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions - { -+ [SentrySDK startWithConfigureOptions:^(SentryOptions *options) { -+ options.dsn = @"https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557"; -+ options.environment = @"integration-tests"; -+ options.tracesSampleRate = @1.0; -+ options.enableFileIOTracing = YES; -+ options.attachScreenshot = YES; -+ options.attachViewHierarchy = YES; -+ options.enableUserInteractionTracing = YES; -+ }]; -+ - self.orientationLock = UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape; - - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; -diff --git a/VLC.xcodeproj/project.pbxproj b/VLC.xcodeproj/project.pbxproj -index 311b5c8b..b434a8b5 100644 ---- a/VLC.xcodeproj/project.pbxproj -+++ b/VLC.xcodeproj/project.pbxproj -@@ -492,7 +492,7 @@ - 4152F1611FEF19BD00F1908B /* KeychainCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainCoordinator.swift; sourceTree = ""; }; - 41533C91211338D500EC3ABA /* VLC-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "VLC-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; - 41533C9D2113392F00EC3ABA /* URLHandlerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLHandlerTests.swift; sourceTree = ""; }; -- 41533CA1211343D100EC3ABA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../../Testing/Unit/Info.plist; sourceTree = ""; }; -+ 41533CA1211343D100EC3ABA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../../Buildsystem/Testing/Unit/Info.plist; sourceTree = ""; }; - 416443852048419E00CAC646 /* DeviceMotion.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeviceMotion.swift; sourceTree = ""; }; - 416DACB620B6DB9A001BC75D /* PlayingExternallyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayingExternallyView.swift; sourceTree = ""; }; - 4170152B209A1D3600802E44 /* MediaViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaViewController.swift; sourceTree = ""; }; -@@ -3644,7 +3644,7 @@ - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; -- INFOPLIST_FILE = Testing/Screenshots/Info.plist; -+ INFOPLIST_FILE = Buildsystem/Testing/Screenshots/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; -@@ -3653,7 +3653,7 @@ - PRODUCT_MODULE_NAME = VLC_iOS_Screenshots; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; -- SWIFT_OBJC_BRIDGING_HEADER = "Testing/Screenshots/VLC-iOS-Screenshots-Bridging-Header.h"; -+ SWIFT_OBJC_BRIDGING_HEADER = "Buildsystem/Testing/Screenshots/VLC-iOS-Screenshots-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; -@@ -3682,7 +3682,7 @@ - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; -- INFOPLIST_FILE = Testing/Screenshots/Info.plist; -+ INFOPLIST_FILE = Buildsystem/Testing/Screenshots/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; -@@ -3690,7 +3690,7 @@ - PRODUCT_BUNDLE_IDENTIFIER = "com.example.VLC-iOSScreenShots"; - PRODUCT_MODULE_NAME = VLC_iOS_Screenshots; - PRODUCT_NAME = "$(TARGET_NAME)"; -- SWIFT_OBJC_BRIDGING_HEADER = "Testing/Screenshots/VLC-iOS-Screenshots-Bridging-Header.h"; -+ SWIFT_OBJC_BRIDGING_HEADER = "Buildsystem/Testing/Screenshots/VLC-iOS-Screenshots-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = "VLC-iOS"; -@@ -3718,7 +3718,7 @@ - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; -- INFOPLIST_FILE = Testing/Screenshots/Info.plist; -+ INFOPLIST_FILE = Buildsystem/Testing/Screenshots/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; -@@ -3726,7 +3726,7 @@ - PRODUCT_BUNDLE_IDENTIFIER = "com.example.VLC-iOSScreenShots"; - PRODUCT_MODULE_NAME = VLC_iOS_Screenshots; - PRODUCT_NAME = "$(TARGET_NAME)"; -- SWIFT_OBJC_BRIDGING_HEADER = "Testing/Screenshots/VLC-iOS-Screenshots-Bridging-Header.h"; -+ SWIFT_OBJC_BRIDGING_HEADER = "Buildsystem/Testing/Screenshots/VLC-iOS-Screenshots-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_TARGET_NAME = "VLC-iOS"; -@@ -3754,7 +3754,7 @@ - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; -- INFOPLIST_FILE = Testing/Unit/Info.plist; -+ INFOPLIST_FILE = Buildsystem/Testing/Unit/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.4; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = YES; -@@ -3793,7 +3793,7 @@ - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; -- INFOPLIST_FILE = Testing/Unit/Info.plist; -+ INFOPLIST_FILE = Buildsystem/Testing/Unit/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.4; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; -@@ -3831,7 +3831,7 @@ - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; -- INFOPLIST_FILE = Testing/Unit/Info.plist; -+ INFOPLIST_FILE = Buildsystem/Testing/Unit/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.4; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; -@@ -3881,7 +3881,7 @@ - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; -- INFOPLIST_FILE = Testing/UI/Info.plist; -+ INFOPLIST_FILE = Buildsystem/Testing/UI/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = YES; -@@ -3931,7 +3931,7 @@ - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; -- INFOPLIST_FILE = Testing/UI/Info.plist; -+ INFOPLIST_FILE = Buildsystem/Testing/UI/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; -@@ -3982,7 +3982,7 @@ - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; -- INFOPLIST_FILE = Testing/UI/Info.plist; -+ INFOPLIST_FILE = Buildsystem/Testing/UI/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; diff --git a/scripts/apply-patch.sh b/scripts/apply-patch.sh deleted file mode 100755 index a85cd8cd6f1..00000000000 --- a/scripts/apply-patch.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -set -euo pipefail - -# Downloads a patch file from sentry-cocoa and replaces the __GITHUB_REVISION_PLACEHOLDER__ in the patch file -# with the specified git commit hash. -# We use github.event.pull_request.head.sha instead of github.sha when available as -# the github.sha is the pre merge commit id for PRs. -# See https://github.community/t/github-sha-isnt-the-value-expected/17903/17906. - -PULL_REQUEST_SHA="${1}" -GITHUB_SHA="${2}" -PATCH_FILE="${3}" - -if [[ "$PULL_REQUEST_SHA" != "" ]]; then - SHA=$PULL_REQUEST_SHA -else - SHA=$GITHUB_SHA -fi - -curl "https://raw.githubusercontent.com/getsentry/sentry-cocoa/${SHA}/scripts/${PATCH_FILE}.patch" --output sentry.patch - -# Replace revision with SHA -REPLACE="s/__GITHUB_REVISION_PLACEHOLDER__/${SHA}/g" -sed -i '' $REPLACE sentry.patch - -git apply sentry.patch diff --git a/scripts/no-changes-in-high-risk-files.sh b/scripts/no-changes-in-high-risk-files.sh index 38718a2a98f..78be135528d 100755 --- a/scripts/no-changes-in-high-risk-files.sh +++ b/scripts/no-changes-in-high-risk-files.sh @@ -3,14 +3,23 @@ set -euo pipefail # To update the sha run the command in ACTUAL and copy the result in EXPECTED. -ACTUAL=$(shasum -a 256 ./Sources/Sentry/SentryNSURLSessionTaskSearch.m ./Sources/Sentry/SentryNetworkTracker.m) +ACTUAL=$(shasum -a 256 ./Sources/Sentry/SentryNSURLSessionTaskSearch.m ./Sources/Sentry/SentryNetworkTracker.m ./Sources/Sentry/SentryUIViewControllerSwizzling.m ./Sources/Sentry/SentryNSDataSwizzling.m ./Sources/Sentry/SentrySubClassFinder.m ./Sources/Sentry/SentryCoreDataSwizzling.m ./Sources/Sentry/SentrySwizzleWrapper.m ./Sources/Sentry/include/SentrySwizzle.h ./Sources/Sentry/SentrySwizzle.m) EXPECTED="819d5ca5e3db2ac23c859b14c149b7f0754d3ae88bea1dba92c18f49a81da0e1 ./Sources/Sentry/SentryNSURLSessionTaskSearch.m -58d5414b4f0a4c821b20fc1a16f88bda3116401e905b7bc1d18af828be75e431 ./Sources/Sentry/SentryNetworkTracker.m" +58d5414b4f0a4c821b20fc1a16f88bda3116401e905b7bc1d18af828be75e431 ./Sources/Sentry/SentryNetworkTracker.m +52cb473dcc8d13c0d4f6cd1429c3fc6e8588521660b714f4a2edb4eaf1401e9f ./Sources/Sentry/SentryUIViewControllerSwizzling.m +e95e62ec7363984f20c78643bb7d992a41a740f97e1befb71525ac34caf88b37 ./Sources/Sentry/SentryNSDataSwizzling.m +9ad05dd8dd29788cba994736fdcd3bbde59a94e32612640d11f4f9c38ad6610e ./Sources/Sentry/SentrySubClassFinder.m +13c3030d8c1fb145760d51837773c35127c777fce1d4dbb9009d53d0fcc5dce8 ./Sources/Sentry/SentryCoreDataSwizzling.m +e41c853a75dcc31a2783ec513acc8c7af8a67033ab8585c80b525f63dd26b506 ./Sources/Sentry/SentrySwizzleWrapper.m +b1c642450170358cab39b4cc6cd546f27c41b12eacb90c3ad93f87733d46e56c ./Sources/Sentry/include/SentrySwizzle.h +f97128c823f92d1c2ec37e5e3b2914f7488a94043af6a8344e348f1a14425f47 ./Sources/Sentry/SentrySwizzle.m" if [ "$ACTUAL" = "$EXPECTED" ]; then echo "No changes in high risk files." exit 0 else - echo "Changes in high risk files. If your changes are intended please update the sha in ./scripts/no-changes-in-high-risk-files.sh to $ACTUAL." + echo "Changes in high risk files. You might want to test your changes by using 'make test-alamofire' and 'make test-homekit' to ensure the changes are safe to run on third party projects." + echo "If your changes are intended and everything is running properly, please update the sha in ./scripts/no-changes-in-high-risk-files.sh to: " + echo "$ACTUAL" exit 1 fi diff --git a/scripts/test-alamofire.sh b/scripts/test-alamofire.sh new file mode 100755 index 00000000000..1fc22b9c3f4 --- /dev/null +++ b/scripts/test-alamofire.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# Ensure the swizzling of network classes doesn't break the normal functionality of web requests. +# We borrow the tests of Alamofire under the MIT license: https://github.com/Alamofire/Alamofire. +# The following steps checkout Alamofire and apply a github patch to the project. The patch adds +# Sentry to the tests with auto performance monitoring enabled. While the tests are running a +# transaction is bound to the scope, so the Sentry SDK adds spans to the transaction. This doesn't +# validate if the Sentry SDK adds proper spans. It only validates that the swizzling logic +# doesn't break web request + +echo "### Integration test - Alamofire ###" + +current_dir=$(pwd) +scripts_path=$(dirname $(readlink -f "$0")) + +trap 'cd "$current_dir"' ERR + +if [ -d "./integration-test" ] +then + echo "WARNING - './integration-test' directory already exists, deleting it." + rm -f -r "./integration-test" +fi + +mkdir "integration-test" + +cd "integration-test" + +git clone https://github.com/Alamofire/Alamofire +cd "Alamofire" +git config advice.detachedHead false +git checkout --progress --force f82c23a8a7ef8dc1a49a8bfc6a96883e79121864 +git log -1 --format='%H' + +cp "$scripts_path/add-local-sentry-to-alamofire.patch" "add-local-sentry-to-alamofire.patch" + +git apply "add-local-sentry-to-alamofire.patch" + +curl "https://github.com/Alamofire/Firewalk/releases/download/0.8.1/firewalk.zip" --output firewalk.zip -L +Unzip "firewalk.zip" +./firewalk & +firewalks_pid=$! + +trap 'kill $firewalks_pid' ERR + +set -o pipefail && env NSUnbufferedIO=YES \ + xcodebuild -project "Alamofire.xcodeproj" -scheme "Alamofire iOS" -destination "OS=16.4,name=iPhone 14 Pro" \ + -skip-testing:"Alamofire iOS Tests/AuthenticationInterceptorTestCase/testThatInterceptorThrowsMissingCredentialErrorWhenCredentialIsNilAndRequestShouldBeRetried" \ + -skip-testing:"Alamofire iOS Tests/AuthenticationInterceptorTestCase/testThatInterceptorRetriesRequestThatFailedWithOutdatedCredential" \ + test | xcpretty + +kill $firewalks_pid +cd "$current_dir" +rm -f -r "./integration-test" diff --git a/scripts/test-homekit.sh b/scripts/test-homekit.sh new file mode 100755 index 00000000000..1c5ff47471e --- /dev/null +++ b/scripts/test-homekit.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# We borrow the tests of Home Assistant under the Apache license: https://github.com/home-assistant/iOS. +#The following steps checkout Home Assistant and apply a github patch to the project. The patch adds +# Sentry to the app with auto performance monitoring enabled. We then run the UI tests to make sure +# adding our SDK doesn't cause any major issues. + +#Home assistant cocoapod requires 'cocoapods-acknowledgements' plugin to work +#If you dont have it use: gem install cocoapods-acknowledgements +echo "### Integration test - Home Assistant ###" + +current_dir=$(pwd) +scripts_path=$(dirname $(readlink -f "$0")) + +trap 'cd "$current_dir"' ERR + +if [ -d "./integration-test" ] +then + echo "WARNING - './integration-test' directory already exists, deleting it." + rm -f -r "./integration-test" +fi + +mkdir "integration-test" + +cd "integration-test" + +git clone https://github.com/home-assistant/iOS +cd "iOS" +git config advice.detachedHead false +git checkout --progress --force 6d6606aed63a778c5a2bd64f8981823433a7f2fa +git log -1 --format='%H' + +cp "$scripts_path/add-local-sentry-to-homekit.patch" "add-local-sentry-to-homekit.patch" + +git apply "add-local-sentry-to-homekit.patch" + +bundle config set --local path 'vendor/bundle' +bundle install --jobs 4 --retry 3 + +bundle exec pod install + +bundle exec fastlane test + +cd "$current_dir" +rm -f -r "./integration-test" +