Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
signalapp
GitHub Repository: signalapp/Signal-iOS
Path: blob/main/Scripts/build-and-test.sh
1 views
1
#!/usr/bin/env zsh
2
3
LOG_DIR="$HOME/Library/Logs/Signal-CI"
4
rm -rf "$LOG_DIR"
5
mkdir -p "$LOG_DIR"
6
7
SCHEMA_DIR="$HOME/Library/Signal-iOS-Schema"
8
rm -rf "$SCHEMA_DIR"
9
mkdir -p "$SCHEMA_DIR"
10
11
echo
12
echo "Available iOS Simulator runtimes:"
13
xcrun simctl list runtimes
14
15
echo
16
echo "Available iOS Simulators:"
17
xcrun simctl list devices
18
19
LATEST_IOS_RUNTIME=$(
20
xcrun simctl list runtimes -j \
21
| jq -r '.runtimes | map(select(.name | startswith("iOS"))) | sort_by(.version) | last | .identifier'
22
)
23
echo
24
echo "Using latest iOS runtime: $LATEST_IOS_RUNTIME"
25
26
LATEST_IOS_SIM_ID=$(
27
xcrun simctl list devices -j \
28
| jq -r --arg runtime "$LATEST_IOS_RUNTIME" '.devices[$runtime] | first | .udid'
29
)
30
echo
31
echo "Using simulator: $LATEST_IOS_SIM_ID"
32
33
echo
34
set -o pipefail \
35
&& NSUnbufferedIO=YES TEST_RUNNER_SCHEMA_DUMP_PATH="$SCHEMA_DIR/schema.json" xcodebuild \
36
-workspace Signal.xcworkspace \
37
-scheme Signal \
38
-destination "platform=iOS Simulator,id=$LATEST_IOS_SIM_ID" \
39
-disableAutomaticPackageResolution \
40
-test-timeouts-enabled YES \
41
-maximum-test-execution-time-allowance 300 \
42
-default-test-execution-time-allowance 60 \
43
-resultBundlePath "$LOG_DIR/TestResult.xcresult" \
44
build test \
45
2>&1 \
46
| tee "$LOG_DIR/Signal-CI.log" \
47
| xcbeautify \
48
--renderer github-actions \
49
--disable-logging \
50
| while IFS= read -r line; do
51
printf '[%s] %s\n' "$(date +%H:%M:%S)" "$line"
52
done
53
54
XCODEBUILD_RESULT_CODE=$?
55
56
xcrun \
57
xcresulttool \
58
get \
59
test-results \
60
summary \
61
--path "$LOG_DIR/TestResult.xcresult" \
62
> "$LOG_DIR/TestResultSummary.json"
63
64
Scripts/parse-xcresult.py "$LOG_DIR/TestResultSummary.json"
65
66
exit $XCODEBUILD_RESULT_CODE
67
68