Skip to content

Commit 67e75fc

Browse files
author
Guido Marucci Blas
committed
Updates build scripts.
1 parent 561171b commit 67e75fc

File tree

2 files changed

+59
-29
lines changed

2 files changed

+59
-29
lines changed

script/build

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22

33
set -e
44

5-
if [ ! -f $XCODE_WORKSPACE ] && [ -f Cartfile ] && type carthage > /dev/null
6-
then
5+
build_using_carthage ()
6+
{
77
carthage_cmd="carthage build --no-skip-current --platform ios"
88
if [ "$USE_SSH" == "true" ]
99
then
1010
carthage_cmd="$carthage_cmd --use-ssh"
1111
fi
1212
eval $carthage_cmd
13-
else
14-
source script/.env
13+
}
1514

16-
build_command="set -o pipefail && xcodebuild -scheme $XCODE_SCHEME"
15+
build_using_xcodebuild ()
16+
{
17+
build_command="set -o pipefail && xcodebuild -scheme $1"
1718
if [ -z "$XCODE_WORKSPACE" ]
1819
then
1920
build_command="$build_command -project $XCODE_PROJECT"
@@ -27,6 +28,25 @@ else
2728
build_command="$build_command | xcpretty -c"
2829
fi
2930

31+
echo ""
32+
echo " → Building scheme '$1'"
33+
echo ""
3034
eval $build_command
35+
}
36+
37+
schemes ()
38+
{
39+
xcodebuild -list | awk '{if(found) print} /Schemes/{found=1}' | awk '{$1=$1};1'
40+
}
41+
42+
if [ ! -f $XCODE_WORKSPACE ] && [ -f Cartfile ] && type carthage > /dev/null
43+
then
44+
build_using_carthage
45+
else
46+
source script/.env
3147

48+
for scheme in $(schemes)
49+
do
50+
build_using_xcodebuild $scheme
51+
done
3252
fi

script/test

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,44 @@ set -e
44

55
source script/.env
66

7-
# TODO iterate over the list of test targets and test them
8-
# xcodebuild -list | egrep ".*Tests$"
7+
schemes ()
8+
{
9+
xcodebuild -list | awk '{if(found) print} /Schemes/{found=1}' | awk '{$1=$1};1'
10+
}
911

10-
test_command="set -o pipefail && xcodebuild -scheme $XCODE_SCHEME"
11-
if [ -z "$XCODE_WORKSPACE" ]
12-
then
13-
test_command="$test_command -project $XCODE_PROJECT"
14-
else
15-
test_command="$test_command -workspace $XCODE_WORKSPACE"
16-
fi
17-
test_command="$test_command -sdk iphonesimulator test -configuration Debug"
18-
if [ ! -z "$CIRCLE_ARTIFACTS" ]
19-
then
20-
test_command="$test_command | tee $CIRCLE_ARTIFACTS/xcode_raw.log"
21-
fi
22-
if type bundle > /dev/null && bundle show xcpretty > /dev/null
23-
then
24-
test_command="$test_command | xcpretty -c"
25-
if [ ! -z "$CIRCLE_TEST_REPORTS" ]
12+
run_tests ()
13+
{
14+
test_command="set -o pipefail && xcodebuild -scheme $1"
15+
if [ -z "$XCODE_WORKSPACE" ]
2616
then
27-
test_command="$test_command --report junit --output $CIRCLE_TEST_REPORTS/xcode/results.xml"
17+
test_command="$test_command -project $XCODE_PROJECT"
18+
else
19+
test_command="$test_command -workspace $XCODE_WORKSPACE"
2820
fi
29-
fi
21+
test_command="$test_command -sdk iphonesimulator test -configuration Debug"
22+
if [ ! -z "$CIRCLE_ARTIFACTS" ]
23+
then
24+
test_command="$test_command | tee $CIRCLE_ARTIFACTS/xcode_raw.log"
25+
fi
26+
if type bundle > /dev/null && bundle show xcpretty > /dev/null
27+
then
28+
test_command="$test_command | bundle exec xcpretty -c"
29+
if [ ! -z "$CIRCLE_TEST_REPORTS" ]
30+
then
31+
test_command="$test_command --report junit --output $CIRCLE_TEST_REPORTS/xcode/results.xml"
32+
fi
33+
fi
34+
35+
echo ""
36+
echo " → Running tests for scheme '$1'"
37+
echo ""
38+
eval $test_command
39+
}
3040

31-
echo ""
32-
echo " → Running tests"
33-
echo ""
34-
eval $test_command
41+
for scheme in $(schemes)
42+
do
43+
run_tests $scheme
44+
done
3545

3646
if [ -f "$PROJECT_NAME.podspec" ]
3747
then

0 commit comments

Comments
 (0)