Skip to content

Commit

Permalink
Further evolution of travis build script (openhab#5789)
Browse files Browse the repository at this point in the history
Use the commit range given by travis to calculate the changed files (not only new files) and make sure we return the correct exit code

Signed-off-by: Martin van Wingerden <martin@martinvw.nl>
  • Loading branch information
martinvw authored and Pshatsillo committed Dec 8, 2019
1 parent 38ed4fb commit 5a527a3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,5 @@ travisBuddy:
insertMode: update
successBuildLog: true

before_install: true
before_script: true
install: true
script: ./buildci.sh
script: ./buildci.sh "$TRAVIS_COMMIT_RANGE"
20 changes: 15 additions & 5 deletions buildci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,34 @@ function mvnp() {
wait $pid
}

COMMITS=${1:-"master...HEAD"}

# Determine if this is a new addon -> Perform tests + integration tests and all SAT checks with increased warning level
CHANGED_DIR=`git diff --diff-filter=A --dirstat=files,0 master...HEAD bundles/ | sed 's/^[ 0-9.]\+% bundles\///g' | grep -o -P "^([^/]*)" | uniq`
CHANGED_DIR=`git diff --dirstat=files,0 $COMMITS bundles/ | sed 's/^[ 0-9.]\+% bundles\///g' | grep -o -P "^([^/]*)" | uniq`
CDIR=`pwd`

if [ ! -z "$CHANGED_DIR" ] && [ -e "bundles/$CHANGED_DIR" ]; then
echo "New addon pull request: Building $CHANGED_DIR"
echo "Single addon pull request: Building $CHANGED_DIR"
echo "MAVEN_OPTS='-Xms1g -Xmx2g -Dorg.slf4j.simpleLogger.log.org.openhab.tools.analysis.report.ReportUtility=DEBUG -Dorg.slf4j.simpleLogger.defaultLogLevel=WARN'" > ~/.mavenrc
cd "bundles/$CHANGED_DIR"
mvn clean install -B 2>&1 |
stdbuf -o0 grep -vE "Download(ed|ing) from [a-z.]+: https:" | # Filter out Download(s)
stdbuf -o0 grep -v "target/code-analysis" | # filter out some debug code from reporting utility
tee $CDIR/.build.log
if [ $? -ne 0 ]; then
exit 1
fi

if [ -e "../itests/$CHANGED_DIR" ]; then
echo "New addon pull request: Building itest $CHANGED_DIR"
cd "../itests/$CHANGED_DIR"
mvn clean install -B 2>&1 |
echo "Single addon pull request: Building itest $CHANGED_DIR"
cd "../itests/$CHANGED_DIR"
mvn clean install -B 2>&1 |
stdbuf -o0 grep -vE "Download(ed|ing) from [a-z.]+: https:" | # Filter out Download(s)
stdbuf -o0 grep -v "target/code-analysis" | # filter out some debug code from reporting utility
tee -a $CDIR/.build.log
if [ $? -ne 0 ]; then
exit 1
fi
fi
else
echo "Build all"
Expand All @@ -55,5 +64,6 @@ else
print_reactor_summary .build.log
else
tail -n 1000 .build.log
exit 1
fi
fi

0 comments on commit 5a527a3

Please sign in to comment.