Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions scripts/ci-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,47 @@ else
IS_GITHUB_ACTIONS=false
fi

# Get current timestamp in format HH:MM:SS
get_timestamp() {
date +"%T"
}

log_notice() {
if $IS_GITHUB_ACTIONS; then
echo "::notice::${1}"
echo "[$(get_timestamp)] ::notice::${1}"
else
echo "[notice] ${1}"
echo "[$(get_timestamp)] [notice] ${1}"
fi
}

log_warning() {
if $IS_GITHUB_ACTIONS; then
echo "::warning::${1}"
echo "[$(get_timestamp)] ::warning::${1}"
else
echo "[warning] ${1}"
echo "[$(get_timestamp)] [warning] ${1}"
fi
}

log_error() {
if $IS_GITHUB_ACTIONS; then
echo "::error::${1}"
echo "[$(get_timestamp)] ::error::${1}"
else
echo "[error] ${1}"
echo "[$(get_timestamp)] [error] ${1}"
fi
}

begin_group() {
local title="$1"
if $IS_GITHUB_ACTIONS; then
echo "::group::${title}"
echo "[$(get_timestamp)] ::group::${title}"
else
echo
echo "== ${title} =="
echo "[$(get_timestamp)]"
echo "[$(get_timestamp)] == ${title} =="
fi
}

end_group() {
if $IS_GITHUB_ACTIONS; then
echo "::endgroup::"
echo "[$(get_timestamp)] ::endgroup::"
fi
}
15 changes: 12 additions & 3 deletions scripts/sentry-xcodebuild.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/bash
set -euxo pipefail

# Disable SC1091 because it won't work with pre-commit
# shellcheck source=./scripts/ci-utils.sh disable=SC1091
source "$(cd "$(dirname "$0")" && pwd)/ci-utils.sh"

# This is a helper script for GitHub Actions Matrix.
# If we would specify the destinations in the GitHub Actions
# Matrix, the name of the job would include the destination, which would
Expand Down Expand Up @@ -140,9 +144,9 @@ case $COMMAND in
;;
esac



if [ $RUN_BUILD == true ]; then
log_notice "Running xcodebuild build"

set -o pipefail && NSUnbufferedIO=YES xcodebuild \
-workspace Sentry.xcworkspace \
-scheme "$TEST_SCHEME" \
Expand All @@ -161,6 +165,8 @@ fi

if [ $RUN_BUILD_FOR_TESTING == true ]; then
# When no test plan is provided, we skip the -testPlan argument so xcodebuild uses the default test plan
log_notice "Running xcodebuild build-for-testing"

set -o pipefail && NSUnbufferedIO=YES xcodebuild \
-workspace Sentry.xcworkspace \
-scheme "$TEST_SCHEME" \
Expand All @@ -174,7 +180,8 @@ fi

if [ $RUN_TEST_WITHOUT_BUILDING == true ]; then
# When no test plan is provided, we skip the -testPlan argument so xcodebuild uses the default test plan

log_notice "Running xcodebuild test-without-building"

set -o pipefail && NSUnbufferedIO=YES xcodebuild \
-workspace Sentry.xcworkspace \
-scheme "$TEST_SCHEME" \
Expand All @@ -186,3 +193,5 @@ if [ $RUN_TEST_WITHOUT_BUILDING == true ]; then
tee raw-test-output.log |
xcbeautify --report junit
fi

log_notice "Finished xcodebuild"
Loading