Skip to content

Commit

Permalink
chore(ci): replace xcpretty with xcbeautify
Browse files Browse the repository at this point in the history
  • Loading branch information
philprime committed Dec 18, 2024
1 parent c4ef3ee commit 580212b
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 35 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
11 changes: 5 additions & 6 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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() }}
Expand Down
1 change: 1 addition & 0 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ brew 'clang-format'
brew 'swiftlint'
brew 'pre-commit'
brew 'python3'
brew 'xcbeautify'
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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")
1 change: 0 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ DEPENDENCIES
fastlane-plugin-sentry
rest-client
slather
xcpretty

BUNDLED WITH
2.4.20
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions scripts/tests-with-thread-sanitizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?

Expand Down
22 changes: 6 additions & 16 deletions scripts/xcode-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 580212b

Please sign in to comment.