Exit1 in case the build fails (#3988)

This commit is contained in:
Maurizio Vitale
2018-11-19 17:23:23 +00:00
committed by Eugenio Romano
parent 2a816d3b47
commit f528d23aff
2 changed files with 33 additions and 8 deletions

View File

@@ -48,7 +48,7 @@ jobs:
- npm install - npm install
- ./scripts/lint.sh || exit 1 - ./scripts/lint.sh || exit 1
- npm run spellcheck || 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 - npm run build:dist || exit 1
- stage: Unit test - stage: Unit test
name: core name: core

View File

@@ -1,13 +1,38 @@
#!/usr/bin/env bash #!/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'`) libs=(`echo $affected | sed 's/^$/\n/g'`)
#core #core
for i in "${libs[@]}" for i in "${libs[@]}"
do do
if [ "$i" == "core$" ] ; then if [ "$i" == "core$" ] ; then
./scripts/build-core.sh ./scripts/build-core.sh || exit 1;
fi fi
done done
@@ -15,7 +40,7 @@ done
for i in "${libs[@]}" for i in "${libs[@]}"
do do
if [ "$i" == "content-services$" ] ; then if [ "$i" == "content-services$" ] ; then
./scripts/build-content-services.sh ./scripts/build-content-services.sh || exit 1;
fi fi
done done
@@ -23,7 +48,7 @@ done
for i in "${libs[@]}" for i in "${libs[@]}"
do do
if [ "$i" == "process-services$" ] ; then if [ "$i" == "process-services$" ] ; then
./scripts/build-process-services.sh ./scripts/build-process-services.sh || exit 1;
fi fi
done done
@@ -31,7 +56,7 @@ done
for i in "${libs[@]}" for i in "${libs[@]}"
do do
if [ "$i" == "process-services-cloud$" ] ; then if [ "$i" == "process-services-cloud$" ] ; then
./scripts/build-process-services-cloud.sh ./scripts/build-process-services-cloud.sh || exit 1;
fi fi
done done
@@ -39,7 +64,7 @@ done
for i in "${libs[@]}" for i in "${libs[@]}"
do do
if [ "$i" == "insights$" ] ; then if [ "$i" == "insights$" ] ; then
./scripts/build-insights.sh ./scripts/build-insights.sh || exit 1;
fi fi
done done
@@ -47,6 +72,6 @@ done
for i in "${libs[@]}" for i in "${libs[@]}"
do do
if [ "$i" == "extensions$" ] ; then if [ "$i" == "extensions$" ] ; then
./scripts/build-extensions.sh ./scripts/build-extensions.sh || exit 1;
fi fi
done done