drcariel closed pull request #84: make travis more efficient URL: https://github.com/apache/incubator-openwhisk-package-pushnotifications/pull/84
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..e3b3c74 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,9 @@ +{ + "curly" : true, + "eqeqeq" : true, + "forin" : false, + "esversion" : 6, + "loopfunc" : true, + "module" : true, + "node" : true +} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index f80e115..74762ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,10 +18,11 @@ notifications: install: true before_install: + - ./tools/travis/setup.sh - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then openssl aes-256-cbc -K $encrypted_ff5bbb6225c5_key -iv $encrypted_ff5bbb6225c5_iv -in tests/credentials.json.enc -out tests/credentials.json -d; fi' - - git clone https://github.com/openwhisk/openwhisk.git + - git clone --depth 1 https://github.com/apache/incubator-openwhisk.git openwhisk - cd openwhisk - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then bash ./tools/travis/setup.sh; fi' - + script: - - ../tools/travis/build.sh + - ./tools/travis/build.sh diff --git a/packages/actions/sendMessage.js b/packages/actions/sendMessage.js index c3c39ab..1894db3 100644 --- a/packages/actions/sendMessage.js +++ b/packages/actions/sendMessage.js @@ -448,11 +448,19 @@ function main(params) { } function isEmpty(obj) { - if (obj === null) return true; - if (obj.length > 0) return false; - if (obj.length === 0) return true; + if (obj === null) { + return true; + } + if (obj.length > 0) { + return false; + } + if (obj.length === 0) { + return true; + } for (var key in obj) { - if (hasOwnProperty.call(obj, key)) return false; + if (hasOwnProperty.call(obj, key)) { + return false; + } } return true; diff --git a/packages/feeds/webhook.js b/packages/feeds/webhook.js index cddd427..b6f547c 100644 --- a/packages/feeds/webhook.js +++ b/packages/feeds/webhook.js @@ -39,6 +39,8 @@ function main(params) { // The URL to create the webhook on push service var registrationEndpoint = 'https://mobile.ng.bluemix.net/imfpush/v1/apps/' + appId + '/webhooks'; var lifecycleEvent = (params.lifecycleEvent || 'CREATE').trim().toUpperCase(); + var options; + var promise; if (lifecycleEvent === 'CREATE' || lifecycleEvent === 'UPDATE') { var events = params.events; @@ -47,7 +49,7 @@ function main(params) { url: whiskCallbackUrl, eventTypes: events }; - var options = { + options = { method: 'POST', url: registrationEndpoint, body: JSON.stringify(body), @@ -56,7 +58,7 @@ function main(params) { 'Content-Type': 'application/json' } }; - var promise = new Promise(function(resolve, reject) { + promise = new Promise(function(resolve, reject) { request(options, function (error, response, body) { if (error) { reject(error); @@ -67,14 +69,14 @@ function main(params) { return promise; } else if (lifecycleEvent === 'DELETE') { - var options = { + options = { method: 'DELETE', url: registrationEndpoint, headers: { 'appSecret': appSecret } }; - var promise = new Promise(function(resolve, reject) { + promise = new Promise(function(resolve, reject) { request(options, function (error, response, body) { if (error) { reject(error); diff --git a/tools/travis/build.sh b/tools/travis/build.sh index b541e99..0653e6c 100755 --- a/tools/travis/build.sh +++ b/tools/travis/build.sh @@ -1,17 +1,22 @@ #!/bin/bash +set -e + # Build script for Travis-CI. SCRIPTDIR=$(cd $(dirname "$0") && pwd) ROOTDIR="$SCRIPTDIR/../.." -WHISKDIR="$ROOTDIR/openwhisk" - -cd $WHISKDIR +WHISKDIR="$ROOTDIR/../openwhisk" +UTILDIR="$ROOTDIR/../incubator-openwhisk-utilities" -tools/build/scanCode.py $ROOTDIR +# run scancode +cd $UTILDIR +scancode/scanCode.py $ROOTDIR -# No point to continue with PRs, since encryption is on -if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit 0; fi +# run jshint +cd $ROOTDIR/packages +jshint . +# Install OpenWhisk cd $WHISKDIR/ansible ANSIBLE_CMD="ansible-playbook -i environments/local" @@ -23,7 +28,7 @@ $ANSIBLE_CMD initdb.yml cd $WHISKDIR -./gradlew distDocker +TERM=dumb ./gradlew distDocker cd $WHISKDIR/ansible @@ -32,7 +37,7 @@ $ANSIBLE_CMD openwhisk.yml cd $WHISKDIR -VCAP_SERVICES_FILE="$(readlink -f $WHISKDIR/../tests/credentials.json)" +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" @@ -51,5 +56,4 @@ source $ROOTDIR/packages/installCatalog.sh $AUTH_KEY $EDGE_HOST $WSK_CLI # Test cd $ROOTDIR -./gradlew :tests:test - +TERM=dumb ./gradlew :tests:test diff --git a/tools/travis/setup.sh b/tools/travis/setup.sh new file mode 100755 index 0000000..ea365a5 --- /dev/null +++ b/tools/travis/setup.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +SCRIPTDIR=$(cd $(dirname "$0") && pwd) +HOMEDIR="$SCRIPTDIR/../../../" + +# jshint support +sudo apt-get -y install nodejs npm +sudo npm install -g jshint + +# clone utilties repo. in order to run scanCode.py +cd $HOMEDIR +git clone https://github.com/apache/incubator-openwhisk-utilities.git ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services