From 027797280184e1a00030e718cb8e346bc18bed14 Mon Sep 17 00:00:00 2001 From: Enrico Vianello Date: Fri, 26 Jan 2018 09:45:14 +0100 Subject: [PATCH] Added travis-ci build script --- .travis.yml | 12 ++++++++++++ travis/build.sh | 30 ++++++++++++++++++++++++++++++ travis/install-deps.sh | 9 +++++++++ 3 files changed, 51 insertions(+) create mode 100644 .travis.yml create mode 100644 travis/build.sh create mode 100644 travis/install-deps.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..789409cb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,12 @@ +language: java +sudo: required +dist: trusty +jdk: +- openjdk8 +install: +- /bin/bash travis/install-deps.sh +script: +- /bin/bash travis/build.sh +cache: + directories: + - "$HOME/.m2/repository" \ No newline at end of file diff --git a/travis/build.sh b/travis/build.sh new file mode 100644 index 00000000..12a65eb5 --- /dev/null +++ b/travis/build.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -e + +export PING_SLEEP=30s +export BUILD_OUTPUT=travis/travis-build.out + +dump_output() { + echo Tailing the last 1000 lines of output: + tail -1000 $BUILD_OUTPUT +} + +error_handler() { + echo ERROR: An error was encountered with the build. + dump_output + exit 1 +} + +trap 'error_handler' ERR + +bash -c "while true; do echo \$(date) - building ...; sleep $PING_SLEEP; done" & +PING_LOOP_PID=$! + +mvn -B clean compile >> $BUILD_OUTPUT 2>&1 +echo "storm-backend-server build completed succesfully" + +mvn -B clean test >> $BUILD_OUTPUT 2>&1 +echo "storm-backend-server tests completed succesfully" + +tail -100 $BUILD_OUTPUT +kill ${PING_LOOP_PID} diff --git a/travis/install-deps.sh b/travis/install-deps.sh new file mode 100644 index 00000000..ba8bd1dc --- /dev/null +++ b/travis/install-deps.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -ex + +pwd + +sudo apt-get install -y wget +wget https://raw.githubusercontent.com/italiangrid/build-settings/master/maven/cnaf-mirror-settings.xml + +mv cnaf-mirror-settings.xml ~/.m2/settings.xml \ No newline at end of file