Move Travis CI build steps to separate script that can build/run tests with C++11 enabled (when compiled with clang)

This commit is contained in:
Tristan Penman 2016-01-27 10:12:05 -08:00
parent 1a3a703298
commit b7bf364b98
2 changed files with 41 additions and 8 deletions

View File

@ -12,12 +12,5 @@ before_install:
install:
- sudo apt-get install -y --force-yes libboost1.55-dev libboost-regex1.55-dev
before_script:
- mkdir -p build
script:
- pushd build
- cmake ..
- make
- ./test_suite
- popd
- ./travis.sh

40
travis.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
set -e # (errexit) Exit if any subcommand or pipeline returns a non-zero status
set -u # (nounset) Exit on any attempt to use an uninitialised variable
: ${CXX:=}
: ${TRAVIS:=false}
echo -n "Checking that we're running on Travis CI..."
if [[ $TRAVIS == 'true' ]]; then
echo " OK"
else
echo " Nope."
echo "This script is only intended for use on Travis CI."
echo "Set the TRAVIS environment variable to 'true' to override."
exit 1
fi
mkdir -p build
pushd build
echo "Attempting to build and run test suite with C++11 support disabled..."
cmake -DVALIJSON_CXX11_ADAPTERS=disabled ..
make
./test_suite
echo "Checking if current compiler is GCC..."
if [[ $CXX == 'g++' ]]; then
echo "Not building test suite with C++11 support due to ancient version of GCC on Travis CI"
else
echo "Attempting to build and run test suite with C++11 support enabled..."
make clean
cmake -DVALIJSON_CXX11_ADAPTERS=enabled ..
make
./test_suite
fi
make clean
popd