Skip to content

Commit ab59a4b

Browse files
committed
refactor build.sh
1 parent 53e9690 commit ab59a4b

File tree

1 file changed

+46
-35
lines changed

1 file changed

+46
-35
lines changed

scripts/travis/build.sh

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,49 @@ set -e
55
export BROWSER_STACK_ACCESS_KEY=`echo $BROWSER_STACK_ACCESS_KEY | rev`
66
export SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`
77

8-
if [ "$JOB" == "ci-checks" ]; then
9-
grunt ci-checks
10-
elif [ "$JOB" == "unit" ]; then
11-
if [ "$BROWSER_PROVIDER" == "browserstack" ]; then
12-
BROWSERS="BS_Chrome,BS_Safari,BS_Firefox,BS_IE_9,BS_IE_10,BS_IE_11,BS_EDGE,BS_iOS_8,BS_iOS_9"
13-
else
14-
BROWSERS="SL_Chrome,SL_Firefox,SL_Safari_8,SL_Safari_9,SL_IE_9,SL_IE_10,SL_IE_11,SL_EDGE,SL_iOS"
15-
fi
16-
17-
# grunt test:promises-aplus
18-
# grunt test:unit --browsers="$BROWSERS" --reporters=dots
19-
# grunt tests:docs --browsers="$BROWSERS" --reporters=dots
20-
elif [ "$JOB" == "docs-e2e" ]; then
21-
grunt test:travis-protractor --specs="docs/app/e2e/**/*.scenario.js"
22-
elif [ "$JOB" == "e2e" ]; then
23-
if [[ $TEST_TARGET == jquery* ]]; then
24-
export USE_JQUERY=1
25-
fi
26-
27-
export TARGET_SPECS="build/docs/ptore2e/**/default_test.js"
28-
if [[ "$TEST_TARGET" == jquery* ]]; then
29-
TARGET_SPECS="build/docs/ptore2e/**/jquery_test.js"
30-
fi
31-
32-
export TARGET_SPECS="test/e2e/tests/**/*.js,$TARGET_SPECS"
33-
grunt test:travis-protractor --specs="$TARGET_SPECS"
34-
elif [ "$JOB" == "deploy" ]; then
35-
# the DISTTAG is read by the deploy config
36-
export DISTTAG=$( cat package.json | jq '.distTag' | tr -d \"[:space:] )
37-
38-
grunt package
39-
grunt compress:firebaseCodeDeploy
40-
else
41-
echo "Unknown job type. Please set JOB=ci-checks, JOB=unit, JOB=deploy or JOB=e2e-*."
42-
fi
8+
case "$JOB" in
9+
"ci-checks")
10+
grunt ci-checks
11+
;;
12+
"unit")
13+
if [ "$BROWSER_PROVIDER" == "browserstack" ]; then
14+
BROWSERS="BS_Chrome,BS_Safari,BS_Firefox,BS_IE_9,BS_IE_10,BS_IE_11,BS_EDGE,BS_iOS_8,BS_iOS_9"
15+
else
16+
BROWSERS="SL_Chrome,SL_Firefox,SL_Safari_8,SL_Safari_9,SL_IE_9,SL_IE_10,SL_IE_11,SL_EDGE,SL_iOS"
17+
fi
18+
19+
grunt test:promises-aplus
20+
grunt test:unit --browsers="$BROWSERS" --reporters=dots
21+
grunt tests:docs --browsers="$BROWSERS" --reporters=dots
22+
;;
23+
"docs-e2e")
24+
grunt test:travis-protractor --specs="docs/app/e2e/**/*.scenario.js"
25+
;;
26+
"e2e")
27+
if [[ $TEST_TARGET == jquery* ]]; then
28+
export USE_JQUERY=1
29+
fi
30+
31+
export TARGET_SPECS="build/docs/ptore2e/**/default_test.js"
32+
33+
if [[ "$TEST_TARGET" == jquery* ]]; then
34+
TARGET_SPECS="build/docs/ptore2e/**/jquery_test.js"
35+
fi
36+
37+
export TARGET_SPECS="test/e2e/tests/**/*.js,$TARGET_SPECS"
38+
grunt test:travis-protractor --specs="$TARGET_SPECS"
39+
;;
40+
"deploy")
41+
# the DISTTAG is read by the deploy config
42+
export DISTTAG=$( cmd < package.json | jq '.distTag' | tr -d \"[:space:] )
43+
44+
echo 'DISTTAG?'
45+
echo $DISTTAG
46+
47+
grunt package
48+
grunt compress:firebaseCodeDeploy
49+
;;
50+
*)
51+
echo "Unknown job type. Please set JOB=ci-checks, JOB=unit, JOB=deploy or JOB=e2e-*."
52+
;;
53+
esac

0 commit comments

Comments
 (0)