forked from nmccartney/ngx-sails-socketio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
64 lines (48 loc) · 1.54 KB
/
build.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
#!/bin/bash
# Script that runs simple tests or full integration tests based on $TEST_SUITE
# The script should immediately exit if any command in the script fails.
set -e
set -o pipefail
# Clean previous builds
rm -rf tmp
buildLibProject(){
LIB_FOLDER="tmp/my-ngx-library-$1"
YO_RC="integrations/.yo-rc.$1.json"
echo -e "\n"
echo -e "#########################################\n"
echo -e " Integration Test for $1 \n"
echo -e "#########################################\n"
echo "#1 - Creating lib folder at '$LIB_FOLDER'"
mkdir -p $LIB_FOLDER
echo "#2 - Copying .yo-rc.json to lib folder"
cp $YO_RC "$LIB_FOLDER/.yo-rc.json"
echo "#3 - Moving to lib folder"
cd $LIB_FOLDER
echo "#4 - Running generator for '$1'"
yo ngx-library
echo "#5 - Building library for '$1'"
gulp build
echo "#6 - Moving back to root folder"
cd ../..
}
runUnitTests(){
echo -e "\n"
echo -e "#########################################\n"
echo -e " Unit Tests \n"
echo -e "#########################################\n"
# Simply run unit tests
gulp coveralls
}
runIntegrationTests(){
# Building and testing library project
buildLibProject $1
}
case $TEST_SUITE in
"units") runUnitTests ;;
"integrations:ng2") runIntegrationTests "ng2" ;;
"integrations:ng4") runIntegrationTests "ng4" ;;
"integrations:ng5") runIntegrationTests "ng5" ;;
*) echo "Unknown value for 'TEST_SUITE': '$TEST_SUITE'. Aborting"
exit 1 ;;
esac
exit 0