From 580212b3f377be44e99123a6d61bee07ee325c86 Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Wed, 18 Dec 2024 11:21:11 +0100 Subject: [PATCH] chore(ci): replace xcpretty with xcbeautify --- .github/workflows/build.yml | 8 ++++---- .github/workflows/codeql-analysis.yml | 11 +++++------ .github/workflows/test.yml | 4 ++-- Brewfile | 1 + Gemfile | 1 - Gemfile.lock | 1 - Makefile | 4 ++-- fastlane/Fastfile | 2 +- scripts/tests-with-thread-sanitizer.sh | 4 ++-- scripts/xcode-test.sh | 22 ++++++---------------- 10 files changed, 23 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f78794e7ba..e5fa28cb6a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -212,7 +212,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Build for Debug - run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME ci build "iPhone 14" DebugWithoutUIKit uikit-check-build + run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME build "iPhone 14" DebugWithoutUIKit uikit-check-build - name: Ensure UIKit is not linked run: ./scripts/check-uikit-linkage.sh DebugWithoutUIKit uikit-check-build unlinked SentryWithoutUIKit @@ -222,7 +222,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Build for Release - run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME ci build "iPhone 14" ReleaseWithoutUIKit uikit-check-build + run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME build "iPhone 14" ReleaseWithoutUIKit uikit-check-build - name: Ensure UIKit is not linked run: ./scripts/check-uikit-linkage.sh ReleaseWithoutUIKit uikit-check-build unlinked SentryWithoutUIKit @@ -232,7 +232,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Build for Debug - run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME ci build "iPhone 14" Debug uikit-check-build + run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME build "iPhone 14" Debug uikit-check-build - name: Ensure UIKit is linked run: ./scripts/check-uikit-linkage.sh Debug uikit-check-build linked Sentry @@ -242,6 +242,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: Build for Release - run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME ci build "iPhone 14" Release uikit-check-build + run: ./scripts/xcode-test.sh "iOS" "latest" $GITHUB_REF_NAME build "iPhone 14" Release uikit-check-build - name: Ensure UIKit is linked run: ./scripts/check-uikit-linkage.sh Release uikit-check-build linked Sentry diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7099eb68da7..23e85f5a9d4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,12 +34,11 @@ jobs: languages: ${{ matrix.language }} - run: >- - env NSUnbufferedIO=YES - xcodebuild - -workspace Sentry.xcworkspace - -scheme Sentry - -configuration Release - -destination platform="iOS Simulator,OS=latest,name=iPhone 14 Pro" | xcpretty && exit ${PIPESTATUS[0]} + env NSUnbufferedIO=YES && set -o pipefail && xcodebuild + -workspace Sentry.xcworkspace + -scheme Sentry + -configuration Release + -destination platform="iOS Simulator,OS=latest,name=iPhone 14 Pro" | xcbeautify - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf6d67bbc1e..c09c0fdd716 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -168,14 +168,14 @@ jobs: # We split building and running tests in two steps so we know how long running the tests takes. - name: Build tests id: build_tests - run: ./scripts/xcode-test.sh ${{matrix.platform}} ${{matrix.test-destination-os}} $GITHUB_REF_NAME ci build-for-testing "${{matrix.device}}" TestCI + run: ./scripts/xcode-test.sh ${{matrix.platform}} ${{matrix.test-destination-os}} $GITHUB_REF_NAME build-for-testing "${{matrix.device}}" TestCI - name: Run tests # We call a script with the platform so the destination # passed to xcodebuild doesn't end up in the job name, # because GitHub Actions don't provide an easy way of # manipulating string in expressions. - run: ./scripts/xcode-test.sh ${{matrix.platform}} ${{matrix.test-destination-os}} $GITHUB_REF_NAME ci test-without-building "${{matrix.device}}" TestCI + run: ./scripts/xcode-test.sh ${{matrix.platform}} ${{matrix.test-destination-os}} $GITHUB_REF_NAME test-without-building "${{matrix.device}}" TestCI - name: Slowest Tests if: ${{ always() }} diff --git a/Brewfile b/Brewfile index e2bb210021d..4af67e1d8a1 100644 --- a/Brewfile +++ b/Brewfile @@ -2,3 +2,4 @@ brew 'clang-format' brew 'swiftlint' brew 'pre-commit' brew 'python3' +brew 'xcbeautify' diff --git a/Gemfile b/Gemfile index 0767766c40a..af4cf76c253 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,6 @@ gem "bundler", ">= 2" gem "cocoapods", ">= 1.9.1" gem "fastlane" gem "rest-client" -gem "xcpretty" gem "slather" eval_gemfile("fastlane/Pluginfile") diff --git a/Gemfile.lock b/Gemfile.lock index 232ed5059de..27a26f2ee7c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -320,7 +320,6 @@ DEPENDENCIES fastlane-plugin-sentry rest-client slather - xcpretty BUNDLED WITH 2.4.20 diff --git a/Makefile b/Makefile index 00a231e3ca2..be5523dce44 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ GIT-REF := $(shell git rev-parse --abbrev-ref HEAD) test: @echo "--> Running all tests" - ./scripts/xcode-test.sh iOS latest $(GIT-REF) YES test Test + ./scripts/xcode-test.sh iOS latest $(GIT-REF) test Test ./scripts/xcode-slowest-tests.sh .PHONY: test @@ -61,7 +61,7 @@ test-ui-critical: 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"` ]] + set -o pipefail && 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" | xcbeautify && [[ -z `find analyzer -name "*.html"` ]] # Since Carthage 0.38.0 we need to create separate .framework.zip and .xcframework.zip archives. # After creating the zips we create a JSON to be able to test Carthage locally. diff --git a/fastlane/Fastfile b/fastlane/Fastfile index cd7a488e827..743b7a31ede 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -148,7 +148,7 @@ platform :ios do ) # don't use gym here because it always appends a "build" command which fails, since this is a test target not configured for running - sh "set -o pipefail && xcodebuild -workspace ../Sentry.xcworkspace -scheme iOS-Swift-UITests -derivedDataPath ../DerivedData -destination 'generic/platform=iOS' -configuration Test build-for-testing | xcpretty" + sh "set -o pipefail && xcodebuild -workspace ../Sentry.xcworkspace -scheme iOS-Swift-UITests -derivedDataPath ../DerivedData -destination 'generic/platform=iOS' -configuration Test build-for-testing | xcbeautify" delete_keychain(name: "fastlane_tmp_keychain") unless is_ci end diff --git a/scripts/tests-with-thread-sanitizer.sh b/scripts/tests-with-thread-sanitizer.sh index 47266b8b811..08eb1c24f13 100755 --- a/scripts/tests-with-thread-sanitizer.sh +++ b/scripts/tests-with-thread-sanitizer.sh @@ -5,10 +5,10 @@ set -euox pipefail # the logs only show failing tests, but don't highlight the threading issues. # Therefore we print a hint to find the threading issues. Profiler doesn't # run when it detects TSAN is present, so we skip those tests. -env NSUnbufferedIO=YES CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO xcodebuild -workspace Sentry.xcworkspace -scheme Sentry -configuration Test -enableThreadSanitizer YES \ +env NSUnbufferedIO=YES CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO && set -o pipefail && xcodebuild -workspace Sentry.xcworkspace -scheme Sentry -configuration Test -enableThreadSanitizer YES \ -destination "platform=iOS Simulator,OS=latest,name=iPhone 14" \ -skip-testing:"SentryProfilerTests" \ - test | tee thread-sanitizer.log | xcpretty -t + test | tee thread-sanitizer.log | xcbeautify testStatus=$? diff --git a/scripts/xcode-test.sh b/scripts/xcode-test.sh index 38a2f9f7c72..0597b701d96 100755 --- a/scripts/xcode-test.sh +++ b/scripts/xcode-test.sh @@ -11,11 +11,10 @@ set -euxo pipefail PLATFORM="${1}" OS=${2:-latest} REF_NAME="${3-HEAD}" -IS_LOCAL_BUILD="${4:-ci}" -COMMAND="${5:-test}" -DEVICE=${6:-iPhone 14} -CONFIGURATION_OVERRIDE="${7:-}" -DERIVED_DATA_PATH="${8:-}" +COMMAND="${4:-test}" +DEVICE=${5:-iPhone 14} +CONFIGURATION_OVERRIDE="${6:-}" +DERIVED_DATA_PATH="${7:-}" case $PLATFORM in @@ -55,15 +54,6 @@ else esac fi -case $IS_LOCAL_BUILD in -"ci") - RUBY_ENV_ARGS="" - ;; -*) - RUBY_ENV_ARGS="rbenv exec bundle exec" - ;; -esac - case $COMMAND in "build") RUN_BUILD=true @@ -108,14 +98,14 @@ if [ $RUN_BUILD_FOR_TESTING == true ]; then fi if [ $RUN_TEST_WITHOUT_BUILDING == true ]; then - env NSUnbufferedIO=YES xcodebuild \ + env NSUnbufferedIO=YES && set -o pipefail && xcodebuild \ -workspace Sentry.xcworkspace \ -scheme Sentry \ -configuration "$CONFIGURATION" \ -destination "$DESTINATION" \ test-without-building | tee raw-test-output.log | - $RUBY_ENV_ARGS xcpretty -t && + xcbeautify && slather coverage --configuration "$CONFIGURATION" && exit "${PIPESTATUS[0]}" fi