Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
22 changes: 15 additions & 7 deletions scripts/ci-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

# Utility functions for CI logging and grouping.
# This file is intended to be sourced from other scripts.
#
# GitHub Actions workflow commands (::notice::, ::warning::, ::error::, ::group::, ::endgroup::)
# follow the specification at: https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands

# Detect if we are running on GitHub Actions
if [ "${GITHUB_ACTIONS:-}" = "true" ]; then
Expand All @@ -10,27 +13,32 @@ 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 "::notice::[$(get_timestamp)] ${1}"
else
echo "[notice] ${1}"
echo "[notice] [$(get_timestamp)] ${1}"
fi
}

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

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

Expand All @@ -39,7 +47,7 @@ begin_group() {
if $IS_GITHUB_ACTIONS; then
echo "::group::${title}"
else
echo
echo
echo "== ${title} =="
fi
}
Expand Down
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