|
4 | 4 |
|
5 | 5 | source script/.env
|
6 | 6 |
|
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 | +} |
9 | 11 |
|
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" ] |
26 | 16 | 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" |
28 | 20 | 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 | +} |
30 | 40 |
|
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 |
35 | 45 |
|
36 | 46 | if [ -f "$PROJECT_NAME.podspec" ]
|
37 | 47 | then
|
|
0 commit comments