| #!/bin/bash |
| set -e |
| |
| # Build script for Travis-CI. |
| |
| SCRIPTDIR=$(cd $(dirname "$0") && pwd) |
| ROOTDIR="$SCRIPTDIR/../.." |
| WHISKDIR="$ROOTDIR/../openwhisk" |
| UTILDIR="$ROOTDIR/../incubator-openwhisk-utilities" |
| |
| # run scancode |
| cd $UTILDIR |
| scancode/scanCode.py $ROOTDIR |
| |
| # run jshint |
| cd $ROOTDIR/packages |
| jshint . |
| |
| # Install OpenWhisk |
| cd $WHISKDIR/ansible |
| |
| ANSIBLE_CMD="ansible-playbook -i environments/local" |
| |
| $ANSIBLE_CMD setup.yml |
| $ANSIBLE_CMD prereq.yml |
| $ANSIBLE_CMD couchdb.yml |
| $ANSIBLE_CMD initdb.yml |
| |
| cd $WHISKDIR |
| |
| TERM=dumb ./gradlew \ |
| :common:scala:install \ |
| :core:controller:install \ |
| :core:invoker:install \ |
| :tests:install \ |
| distDocker |
| |
| cd $WHISKDIR/ansible |
| |
| $ANSIBLE_CMD wipe.yml |
| $ANSIBLE_CMD openwhisk.yml |
| |
| # Set Environment |
| export OPENWHISK_HOME=$WHISKDIR |
| export INSTALL_WEB_ONLY="True" |
| |
| cd $WHISKDIR |
| |
| VCAP_SERVICES_FILE="$(readlink -f $ROOTDIR/tests/credentials.json)" |
| |
| #update whisk.properties to add tests/credentials.json file to vcap.services.file, which is needed in tests |
| WHISKPROPS_FILE="$WHISKDIR/whisk.properties" |
| sed -i 's:^[ \t]*vcap.services.file[ \t]*=\([ \t]*.*\)$:vcap.services.file='$VCAP_SERVICES_FILE':' $WHISKPROPS_FILE |
| cat whisk.properties |
| |
| WSK_CLI=$WHISKDIR/bin/wsk |
| AUTH_KEY=$(cat $WHISKDIR/ansible/files/auth.whisk.system) |
| EDGE_HOST=$(grep '^edge.host=' $WHISKPROPS_FILE | cut -d'=' -f2) |
| |
| # Install Package |
| |
| cd $ROOTDIR/packages |
| ./installCatalog.sh $AUTH_KEY $EDGE_HOST $WSK_CLI |
| |
| # Test |
| cd $ROOTDIR |
| if [ $INSTALL_WEB_ONLY = True ] |
| then |
| TERM=dumb ./gradlew :tests:test --tests "packages.DeployWebTests" |
| else |
| TERM=dumb ./gradlew :tests:test |
| fi |