forked from calabash/calabash-ios-example
-
Notifications
You must be signed in to change notification settings - Fork 3
/
sim-cucumber.sh
executable file
·76 lines (55 loc) · 1.6 KB
/
sim-cucumber.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
if [ "$USER" = "jenkins" ]; then
echo "INFO: hey, you are jenkins! loading ~/.bash_profile_ci"
source ~/.bash_profile_ci
hash -r
rbenv rehash
fi
CUCUMBER_ARGS=$*
if which rbenv > /dev/null; then
RBENV_EXEC="rbenv exec"
else
RBENV_EXEC=
fi
${RBENV_EXEC} bundle install
rm -rf ci-reports/calabash
mkdir -p ci-reports/calabash
touch ci-reports/calabash/empty.json
TARGET_NAME="LPSimpleExample-cal"
XC_PROJECT="LPSimpleExample.xcodeproj"
XC_SCHEME="${TARGET_NAME}"
CAL_BUILD_CONFIG=Debug
CAL_BUILD_DIR="${PWD}/build/jenkins"
rm -rf "${CAL_BUILD_DIR}"
mkdir -p "${CAL_BUILD_DIR}"
set +o errexit
xcrun xcodebuild \
-derivedDataPath "${CAL_BUILD_DIR}" \
-project "${XC_PROJECT}" \
-scheme "${TARGET_NAME}" \
-sdk iphonesimulator \
-configuration "${CAL_BUILD_CONFIG}" \
clean build | $RBENV_EXEC bundle exec xcpretty -c
RETVAL=${PIPESTATUS[0]}
set -o errexit
if [ $RETVAL != 0 ]; then
echo "FAIL: could not build"
exit $RETVAL
else
echo "INFO: successfully built"
fi
# remove any stale targets
$RBENV_EXEC bundle exec calabash-ios sim reset
# Disable exiting on error so script continues if tests fail
set +o errexit
APP_BUNDLE_PATH="${CAL_BUILD_DIR}/Build/Products/${CAL_BUILD_CONFIG}-iphonesimulator/${TARGET_NAME}.app"
cp -r "${APP_BUNDLE_PATH}" ./
export APP_BUNDLE_PATH="./${TARGET_NAME}.app"
RETVAL=0
rbenv exec bundle exec cucumber -p iphone_largest $CUCUMBER_ARGS
#rbenv exec bundle exec cucumber -p default $CUCUMBER_ARGS
set -o errexit
if [ $RETVAL != 0 ]; then
echo "FAIL: failed $RETVAL out of 9 simulators"
fi
exit $RETVAL