Skip to content

Commit

Permalink
chore(CI): Added test build
Browse files Browse the repository at this point in the history
  • Loading branch information
burntblark authored Dec 21, 2017
1 parent 99638e9 commit 5863fb7
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions integrations/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

0 comments on commit 5863fb7

Please sign in to comment.