From f528d23aff18375411213fd22b3b840a390d22dc Mon Sep 17 00:00:00 2001 From: Maurizio Vitale Date: Mon, 19 Nov 2018 17:23:23 +0000 Subject: [PATCH] Exit1 in case the build fails (#3988) --- .travis.yml | 2 +- scripts/smart-build.sh | 39 ++++++++++++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4a7c14e56..e62e820622 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,7 +48,7 @@ jobs: - npm install - ./scripts/lint.sh || exit 1 - npm run spellcheck || exit 1 - - rm -rf tmp && (./scripts/smart-build.sh || exit 1;); + - rm -rf tmp && (./scripts/smart-build.sh -b $TRAVIS_BRANCH || exit 1;); - npm run build:dist || exit 1 - stage: Unit test name: core diff --git a/scripts/smart-build.sh b/scripts/smart-build.sh index a5910027b3..6d75563b60 100755 --- a/scripts/smart-build.sh +++ b/scripts/smart-build.sh @@ -1,13 +1,38 @@ #!/usr/bin/env bash -affected="$(./scripts/affected-libs.sh -b "$TRAVIS_BRANCH")" +eval BRANCH_NAME="" + +show_help() { + echo "Usage: smart-build.sh" + echo "" + echo "-b branch name" +} + +branch_name(){ + BRANCH_NAME=$1 +} + +while [[ $1 == -* ]]; do + case "$1" in + -b) branch_name $2; shift 2;; + -*) echo "invalid option: $1" 1>&2; show_help; exit 0;; + esac +done + +if [[ "$BRANCH_NAME" == "" ]] +then + echo "The branch name is mandatory" + exit 0 +fi + +affected="$(./scripts/affected-libs.sh -b "$BRANCH_NAME")" libs=(`echo $affected | sed 's/^$/\n/g'`) #core for i in "${libs[@]}" do if [ "$i" == "core$" ] ; then - ./scripts/build-core.sh + ./scripts/build-core.sh || exit 1; fi done @@ -15,7 +40,7 @@ done for i in "${libs[@]}" do if [ "$i" == "content-services$" ] ; then - ./scripts/build-content-services.sh + ./scripts/build-content-services.sh || exit 1; fi done @@ -23,7 +48,7 @@ done for i in "${libs[@]}" do if [ "$i" == "process-services$" ] ; then - ./scripts/build-process-services.sh + ./scripts/build-process-services.sh || exit 1; fi done @@ -31,7 +56,7 @@ done for i in "${libs[@]}" do if [ "$i" == "process-services-cloud$" ] ; then - ./scripts/build-process-services-cloud.sh + ./scripts/build-process-services-cloud.sh || exit 1; fi done @@ -39,7 +64,7 @@ done for i in "${libs[@]}" do if [ "$i" == "insights$" ] ; then - ./scripts/build-insights.sh + ./scripts/build-insights.sh || exit 1; fi done @@ -47,6 +72,6 @@ done for i in "${libs[@]}" do if [ "$i" == "extensions$" ] ; then - ./scripts/build-extensions.sh + ./scripts/build-extensions.sh || exit 1; fi done