-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcheckBuild.command
executable file
·36 lines (27 loc) · 999 Bytes
/
checkBuild.command
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
set -e
base_dir=$(dirname "$0")
cd "$base_dir"
echo ""
echo ""
echo -e "\nBuilding Swift Package..."
swift build
echo -e "Performing tests..."
simulator_id="$(xcrun simctl list devices available iPhone | grep " SE " | tail -1 | sed -e "s/.*(\([0-9A-Z-]*\)).*/\1/")"
if [ -n "${simulator_id}" ]; then
echo "Using iPhone SE simulator with ID: '${simulator_id}'"
else
simulator_id="$(xcrun simctl list devices available iPhone | grep "^ " | tail -1 | sed -e "s/.*(\([0-9A-Z-]*\)).*/\1/")"
if [ -n "${simulator_id}" ]; then
echo "Using iPhone simulator with ID: '${simulator_id}'"
else
echo >&2 "error: Please install iPhone simulator."
echo " "
exit 1
fi
fi
set -o pipefail && xcodebuild -workspace "Example/ObjectMapperAdditions.xcworkspace" -sdk iphonesimulator -scheme "ObjectMapperAdditions-Example" -destination "platform=iOS Simulator,id=${simulator_id}" test | xcpretty
echo ""
echo "SUCCESS!"
echo ""
echo ""