From 2c8c47db450cbffa1122a2b9796b7a35588d02b7 Mon Sep 17 00:00:00 2001 From: lloyd Date: Mon, 11 May 2015 11:40:36 +0000 Subject: Add coveralls.io support based on GH #91 by cordney Move the more complex CI logic to scripts instead of yaml --- .travis.yml | 34 ++++++++++++++++++---------------- src/scripts/ci/after_success.sh | 13 +++++++++++++ src/scripts/ci/build.sh | 17 +++++++++++++++++ src/scripts/ci/setup.sh | 19 +++++++++++++++++++ 4 files changed, 67 insertions(+), 16 deletions(-) create mode 100755 src/scripts/ci/after_success.sh create mode 100755 src/scripts/ci/build.sh create mode 100755 src/scripts/ci/setup.sh diff --git a/.travis.yml b/.travis.yml index edfcc9a74..f8e0e06df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,33 +1,35 @@ language: cpp +os: + - linux + compiler: - clang - gcc +env: + - BUILD_MODE="shared" + - BUILD_MODE="static" + - BUILD_MODE="coverage" + +matrix: + exclude: + - compiler: clang + env: BUILD_MODE="coverage" + before_install: - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - sudo apt-get update -qq install: - - sudo apt-get install -y g++-4.8 - - sudo apt-get install -y libssl-dev - - sudo apt-get install -y libz-dev - - sudo apt-get install -y libsqlite3-dev - - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90 - - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 90 + - sudo ./src/scripts/ci/setup.sh script: - - $CXX --version - - python configure.py $BUILD_MODE --cc=$CC --cc-bin=$CXX --with-openssl --with-sqlite --with-zlib - - "make" - - "LD_LIBRARY_PATH=. ./botan-test" + - ./src/scripts/ci/build.sh + +after_success: + - ./src/scripts/ci/after_success.sh notifications: email: lloyd@randombit.net -os: - - linux - -env: - - BUILD_MODE="" - - BUILD_MODE="--via-amalgamation --disable-shared" diff --git a/src/scripts/ci/after_success.sh b/src/scripts/ci/after_success.sh new file mode 100755 index 000000000..2aaabe294 --- /dev/null +++ b/src/scripts/ci/after_success.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +BUILD_MODE=$1 + +set -ev + +if [ "$BUILD_MODE" = "coverage"] +then + lcov --directory . --capture --output-file coverage.info + lcov --remove coverage.info 'tests/*' '/usr/*' --output-file coverage.info + lcov --list coverage.info + coveralls-lcov -t $COVERALLS_REPO_TOKEN coverage.info +fi diff --git a/src/scripts/ci/build.sh b/src/scripts/ci/build.sh new file mode 100755 index 000000000..c0c46a862 --- /dev/null +++ b/src/scripts/ci/build.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -ev + +if [ "$BUILD_MODE" = "static" ]; then + CFG_FLAGS="--disabled-shared --via-amalgamation" +elif [ "$BUILD_MODE" = "shared" ]; then + CFG_FLAGS="--build-mode=shared" +elif [ "$BUILD_MODE" = "coverage" ]; then + # lcov gets confused by symlinks + CFG_FLAGS="--build-mode=coverage --link-method=copy" +fi + +$CXX --version +python configure.py $CFG_FLAGS --cc=$CC --cc-bin=$CXX --with-openssl --with-sqlite --with-zlib +make +LD_LIBRARY_PATH=. ./botan-test diff --git a/src/scripts/ci/setup.sh b/src/scripts/ci/setup.sh new file mode 100755 index 000000000..d4fd2f400 --- /dev/null +++ b/src/scripts/ci/setup.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -ev + +apt-get install -y g++-4.8 +apt-get install -y libssl-dev +apt-get install -y libz-dev +apt-get install -y libsqlite3-dev +update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90 +update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 90 +update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.8 90 + +if [ "$BUILD_MODE" = "coverage" ] +then + wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz + tar -xvf lcov_1.11.orig.tar.gz + make -C lcov-1.11/ install + gem install coveralls-lcov +fi -- cgit v1.2.3