From 0061f03cefa5b61bd7b7846754adf452dce0b84e Mon Sep 17 00:00:00 2001 From: sublimator Date: Fri, 22 Apr 2016 11:09:36 -0400 Subject: [PATCH] Add Travis support --- .travis.yml | 69 +++++++++++++++++++++++++++++++++ Jamroot | 2 +- scripts/build-and-test.sh | 11 ++++++ scripts/install-boost.sh | 24 ++++++++++++ scripts/install-dependencies.sh | 34 ++++++++++++++++ 5 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 .travis.yml create mode 100755 scripts/build-and-test.sh create mode 100755 scripts/install-boost.sh create mode 100755 scripts/install-dependencies.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..4ffc027c5a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,69 @@ +sudo: false +language: cpp + +env: + global: + # Maintenance note: to move to a new version + # of boost, update both BOOST_ROOT and BOOST_URL. + # Note that for simplicity, BOOST_ROOT's final + # namepart must match the folder name internal + # to boost's .tar.gz. + - BOOST_ROOT=$HOME/boost_1_60_0 + - BOOST_URL='http://downloads.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.gz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fboost%2Ffiles%2Fboost%2F1.60.0%2Fboost_1_60_0.tar.gz&ts=1460417589&use_mirror=netix' +packages: &gcc5_pkgs + - gcc-5 + - g++-5 + - python-software-properties + - protobuf-compiler + - libstdc++6 + - binutils-gold + # Provides a backtrace if the unittests crash + - gdb + +packages: &clang36_pkgs + - clang-3.6 + - g++-5 + - python-software-properties + - libssl-dev + - libstdc++6 + - binutils-gold + # Provides a backtrace if the unittests crash + - gdb + +matrix: + include: + - compiler: gcc + env: GCC_VER=5 VARIANT=debug + addons: &ao_gcc5 + apt: + sources: ['ubuntu-toolchain-r-test'] + packages: *gcc5_pkgs + + - compiler: gcc + env: GCC_VER=5 VARIANT=release + addons: *ao_gcc5 + + - compiler: clang + env: GCC_VER=5 VARIANT=debug CLANG_VER=3.6 + addons: &ao_clang36 + apt: + sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6'] + packages: *clang36_pkgs + + - compiler: clang + env: GCC_VER=5 VARIANT=release CLANG_VER=3.6 + addons: *ao_clang36 + +cache: + directories: + - $BOOST_ROOT + +before_install: + - scripts/install-dependencies.sh + +script: + - scripts/build-and-test.sh + +notifications: + email: + false diff --git a/Jamroot b/Jamroot index 5a032af582..c7b17d37cf 100644 --- a/Jamroot +++ b/Jamroot @@ -58,7 +58,7 @@ project beast BOOST_ALL_NO_LIB=1 multi static - static + shared gcc:-std=c++14 clang:-std=c++14 LINUX:_XOPEN_SOURCE=600 diff --git a/scripts/build-and-test.sh b/scripts/build-and-test.sh new file mode 100755 index 0000000000..00eb6a89e2 --- /dev/null +++ b/scripts/build-and-test.sh @@ -0,0 +1,11 @@ +#!/bin/bash -u +# We use set -e and bash with -u to bail on first non zero exit code of any +# processes launched or upon any unbound variable +set -e +__dirname=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +echo "using toolset: $CC" +echo "using variant: $VARIANT" + +$BOOST_ROOT/bjam toolset=$CC variant=$VARIANT +`find . -name "core_tests"` +`find . -name "http_tests"` diff --git a/scripts/install-boost.sh b/scripts/install-boost.sh new file mode 100755 index 0000000000..aa18b37db9 --- /dev/null +++ b/scripts/install-boost.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# Assumptions: +# 1) BOOST_ROOT and BOOST_URL are already defined, +# and contain valid values. +# 2) The last namepart of BOOST_ROOT matches the +# folder name internal to boost's .tar.gz +# When testing you can force a boost build by clearing travis caches: +# https://travis-ci.org/ripple/rippled/caches +set -e +if [ ! -d "$BOOST_ROOT/lib" ] +then + wget $BOOST_URL -O /tmp/boost.tar.gz + cd `dirname $BOOST_ROOT` + rm -fr ${BOOST_ROOT} + tar xzf /tmp/boost.tar.gz + params="define=_GLIBCXX_USE_CXX11_ABI=0 --with-program_options --with-system" + cd $BOOST_ROOT && \ + ./bootstrap.sh --prefix=$BOOST_ROOT && \ + ./b2 -d1 $params && \ + ./b2 -d0 $params install +else + echo "Using cached boost at $BOOST_ROOT" +fi + diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh new file mode 100755 index 0000000000..14cf6bbfa4 --- /dev/null +++ b/scripts/install-dependencies.sh @@ -0,0 +1,34 @@ +#!/bin/bash -u +# Exit if anything fails. +set -e +# Override gcc version to $GCC_VER. +# Put an appropriate symlink at the front of the path. +mkdir -v $HOME/bin +for g in gcc g++ gcov gcc-ar gcc-nm gcc-ranlib +do + test -x $( type -p ${g}-$GCC_VER ) + ln -sv $(type -p ${g}-$GCC_VER) $HOME/bin/${g} +done +for c in clang clang++ +do + test -x $( type -p ${c}-$CLANG_VER ) + ln -sv $(type -p ${c}-$CLANG_VER) $HOME/bin/${c} +done +export PATH=$PWD/bin:$PATH + +# What versions are we ACTUALLY running? +if [ -x $HOME/bin/g++ ]; then + $HOME/bin/g++ -v +fi +if [ -x $HOME/bin/clang ]; then + $HOME/bin/clang -v +fi +# Avoid `spurious errors` caused by ~/.npm permission issues +# Does it already exist? Who owns? What permissions? +ls -lah ~/.npm || mkdir ~/.npm +# Make sure we own it +chown -Rc $USER ~/.npm +# We use this so we can filter the subtrees from our coverage report +#pip install --user https://github.com/vinniefalco/codecov-python/zipball/source-match + +bash scripts/install-boost.sh