Skip to content

Commit f978d02

Browse files
committed
Bash lipstick.
1 parent b3195ef commit f978d02

File tree

3 files changed

+93
-45
lines changed

3 files changed

+93
-45
lines changed

scripts/automation-tests.sh

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
11
#!/bin/bash
2-
3-
42
set -e
3+
54
NUM_OF_TESTS=14
65
CURRENT_DIR="$( dirname "${BASH_SOURCE[0]}" )"
76
BUILD_DIRECTORY=build
87
APP=RxExample
98
CONFIGURATIONS="Debug Release-Tests Release"
10-
#SIMULATORS="RxSwiftTest-iPhone4s-iOS_8.4 RxSwiftTest-iPhone5-iOS_8.4 RxSwiftTest-iPhone5s-iOS_8.4 RxSwiftTest-iPhone6-iOS_8.4 RxSwiftTest-iPhone6Plus-iOS_8.4 RxSwiftTest-iPhone4s-iOS_8.1 RxSwiftTest-iPhone5-iOS_8.1 RxSwiftTest-iPhone5s-iOS_8.1 RxSwiftTest-iPhone6-iOS_8.1 RxSwiftTest-iPhone6Plus-iOS_8.1"
11-
12-
#IOS7_SIMULATORS="RxSwiftTest-iPhone4s-iOS_7.1 RxSwiftTest-iPhone5-iOS_7.1 RxSwiftTest-iPhone5s-iOS_7.1"
13-
IOS7_SIMULATORS=""
14-
IOS8_SIMULATORS="RxSwiftTest-iPhone4s-iOS_8.4 RxSwiftTest-iPhone5-iOS_8.4 RxSwiftTest-iPhone5s-iOS_8.4 RxSwiftTest-iPhone6-iOS_8.4 RxSwiftTest-iPhone6Plus-iOS_8.4"
15-
16-
#open $TMPDIR
179

1810
. scripts/common.sh
1911

@@ -23,9 +15,9 @@ ROOT=`pwd`
2315
BUILD_DIRECTORY="${ROOT}/build"
2416

2517
function runAutomation() {
26-
SIMULATOR=$1
18+
SCHEME=$1
2719
CONFIGURATION=$2
28-
SCHEME=$3
20+
SIMULATOR=$3
2921

3022
APP="${SCHEME}"
3123

@@ -36,8 +28,7 @@ function runAutomation() {
3628
printf "${GREEN}Building example for automation ${BOLDCYAN}${SIMULATOR} - ${CONFIGURATION}${RESET}"
3729
echo
3830

39-
OS=`echo $SIMULATOR| cut -d'_' -f 2`
40-
xcodebuild -workspace Rx.xcworkspace -scheme ${SCHEME} -derivedDataPath ${BUILD_DIRECTORY} -configuration ${CONFIGURATION} -destination platform='iOS Simulator',OS="${OS}",name="${SIMULATOR}" build | xcpretty -c
31+
rx $SCHEME $CONFIGURATION $SIMULATOR build
4132

4233
echo
4334
printf "${GREEN}Quitting iOS Simulator ...${RESET}"
@@ -83,19 +74,19 @@ function runAutomation() {
8374
}
8475

8576
# ios 7
86-
for simulator in ${IOS7_SIMULATORS}
87-
do
88-
for configuration in ${CONFIGURATIONS}
89-
do
90-
runAutomation ${simulator} ${configuration} "RxExample-iOS-no-module"
91-
done
92-
done
77+
#for simulator in ${IOS7_SIMULATORS}
78+
#do
79+
# for configuration in ${CONFIGURATIONS}
80+
# do
81+
# runAutomation "RxExample-iOS" ${configuration} ${simulator}
82+
# done
83+
#done
9384

9485
# ios 8
9586
for simulator in ${IOS8_SIMULATORS}
9687
do
9788
for configuration in ${CONFIGURATIONS}
9889
do
99-
runAutomation ${simulator} ${configuration} "RxExample-iOS"
90+
runAutomation "RxExample-iOS" ${configuration} ${simulator}
10091
done
10192
done

scripts/common.sh

100644100755
Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
set -e
3+
#set -o xtrace
34

45
RESET="\033[0m"
56
BLACK="\033[30m"
@@ -21,38 +22,61 @@ BOLDWHITE="\033[1m\033[37m"
2122

2223
# make sure all tests are passing
2324

24-
BUILD_DIRECTORY=build
25+
DEFAULT_IOS7_SIMULATOR=RxSwiftTest-iPhone4s-iOS_7.1
26+
DEFAULT_IOS8_SIMULATOR=RxSwiftTest-iPhone6-iOS_8.4
2527

26-
function runTests() {
27-
echo
28-
printf "${GREEN}Running tests for ${BOLDCYAN}$1 - $2${RESET}\n"
29-
echo
28+
IOS7_SIMULATORS="RxSwiftTest-iPhone4s-iOS_7.1 RxSwiftTest-iPhone5-iOS_7.1 RxSwiftTest-iPhone5s-iOS_7.1"
29+
IOS8_SIMULATORS="RxSwiftTest-iPhone4s-iOS_8.4 RxSwiftTest-iPhone5-iOS_8.4 RxSwiftTest-iPhone5s-iOS_8.4 RxSwiftTest-iPhone6-iOS_8.4 RxSwiftTest-iPhone6Plus-iOS_8.4"
30+
31+
BUILD_DIRECTORY=build
3032

31-
xcodebuild -workspace Rx.xcworkspace -scheme "$1" -configuration "$2" -derivedDataPath ${BUILD_DIRECTORY} test | xcpretty -c
33+
function ios7simulator() {
34+
A=($IOS7_SIMULATORS)
35+
echo ${A[$1]}
36+
}
3237

33-
#if [[ $scheme == *"iOS"* ]]
34-
#then
35-
# SDK="-sdk iphonesimulator"
36-
#fi
37-
#xctool -workspace Rx.xcworkspace -scheme "$1" -configuration "$2" ${SDK} -derivedDataPath ${BUILD_DIRECTORY} test
38+
function ios8simulator() {
39+
A=($IOS8_SIMULATORS)
40+
echo ${A[$1]}
3841
}
3942

40-
function buildExample() {
43+
function rx() {
44+
SCHEME=$1
45+
CONFIGURATION=$2
46+
SIMULATOR=$3
47+
ACTION=$4
48+
4149
echo
42-
printf "${GREEN}Building example for ${BOLDCYAN}$1 - $2${RESET}\n"
50+
printf "${GREEN}${ACTION} ${BOLDCYAN}$1 - $2 ($SIMULATOR)${RESET}\n"
4351
echo
4452

45-
xcodebuild -workspace Rx.xcworkspace -scheme "$1" -configuration "$2" build | xcpretty -c
53+
DESTINATION=""
54+
if [ "$SIMULATOR" != "" ]; then
55+
OS=`echo $SIMULATOR| cut -d'_' -f 2`
56+
DESTINATION='platform=iOS Simulator,OS='$OS',name='$SIMULATOR''
57+
else
58+
DESTINATION='platform=OS X,arch=x86_64'
59+
fi
60+
61+
STATUS=""
62+
xcodebuild -workspace Rx.xcworkspace \
63+
-scheme $SCHEME \
64+
-configuration $CONFIGURATION \
65+
-derivedDataPath "${BUILD_DIRECTORY}" \
66+
-destination "$DESTINATION" \
67+
$ACTION | xcpretty -c; STATUS=${PIPESTATUS[0]}
68+
69+
if [ $STATUS -ne 0 ]; then
70+
echo $STATUS
71+
exit $STATUS
72+
fi
4673
}
4774

4875
# simulators
4976

5077
# xcrun simctl list devicetypes
5178
# xcrun simctl list runtimes
5279

53-
#IOS7_SIMULATORS="RxSwiftTest-iPhone4s-iOS_7.1 RxSwiftTest-iPhone5-iOS_7.1 RxSwiftTest-iPhone5s-iOS_7.1"
54-
#IOS8_SIMULATORS="RxSwiftTest-iPhone4s-iOS_8.4 RxSwiftTest-iPhone5-iOS_8.4 RxSwiftTest-iPhone5s-iOS_8.4 RxSwiftTest-iPhone6-iOS_8.4 RxSwiftTest-iPhone6Plus-iOS_8.4"
55-
5680
function createDevices() {
5781
xcrun simctl create RxSwiftTest-iPhone4s-iOS_7.1 'iPhone 4s' 'com.apple.CoreSimulator.SimRuntime.iOS-7-1'
5882
xcrun simctl create RxSwiftTest-iPhone5-iOS_7.1 'iPhone 5' 'com.apple.CoreSimulator.SimRuntime.iOS-7-1'

scripts/pre-release-tests.sh

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,59 @@ IS_LOCAL=0
44
if [ "$#" -eq 1 ]; then
55
echo "Local test"
66
IS_LOCAL=1
7+
else
8+
# ios 7 sim
9+
if [ `xcrun simctl list | grep "${DEFAULT_IOS7_SIMULATOR}" | wc -l` == 0 ]; then
10+
xcrun simctl create $DEFAULT_IOS7_SIMULATOR 'iPhone 4s' 'com.apple.CoreSimulator.SimRuntime.iOS-7-1'
11+
else
12+
echo "${DEFAULT_IOS7_SIMULATOR} exists"
13+
fi
14+
15+
#ios 8 sim
16+
if [ `xcrun simctl list | grep "${DEFAULT_IOS8_SIMULATOR}" | wc -l` == 0 ]; then
17+
xcrun simctl create $DEFAULT_IOS8_SIMULATOR 'iPhone 6' 'com.apple.CoreSimulator.SimRuntime.iOS-8-4'
18+
else
19+
echo "${DEFAULT_IOS8_SIMULATOR} exists"
20+
fi
721
fi
822

9-
#runTests "RxTests-iOS" "Release-Tests"
23+
#make sure all iOS tests pass
24+
for configuration in "Debug" "Release-Tests" "Release"
25+
do
26+
rx "RxTests-iOS" ${configuration} $DEFAULT_IOS8_SIMULATOR test
27+
done
28+
29+
#make sure all OSX tests pass
30+
for configuration in "Debug" "Release-Tests" "Release"
31+
do
32+
rx "RxTests-OSX" ${configuration} "" test
33+
done
1034

11-
#make sure all unit tests pass
12-
for scheme in "RxTests-iOS" "RxTests-OSX"
35+
# make sure no module can be built
36+
for scheme in "RxExample-iOS-no-module"
1337
do
1438
for configuration in "Debug" "Release-Tests" "Release"
1539
do
16-
runTests ${scheme} ${configuration}
40+
rx ${scheme} ${configuration} $DEFAULT_IOS7_SIMULATOR build
41+
rx ${scheme} ${configuration} $DEFAULT_IOS8_SIMULATOR build
1742
done
1843
done
1944

45+
# make sure with modules can be built
46+
for scheme in "RxExample-iOS"
47+
do
48+
for configuration in "Debug" "Release-Tests" "Release"
49+
do
50+
rx ${scheme} ${configuration} $DEFAULT_IOS8_SIMULATOR build
51+
done
52+
done
2053

21-
# make sure it all build
22-
for scheme in "RxExample-iOS" "RxExample-iOS-no-module" "RxExample-OSX"
54+
# make sure osx builds
55+
for scheme in "RxExample-OSX"
2356
do
2457
for configuration in "Debug" "Release-Tests" "Release"
2558
do
26-
buildExample ${scheme} ${configuration}
59+
rx ${scheme} ${configuration} "" build
2760
done
2861
done
2962

0 commit comments

Comments
 (0)