diff --git a/.travis.yml b/.travis.yml index b407cec83..2f0784f7d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,10 @@ language: cpp +# http://docs.travis-ci.com/user/multi-os/ +os: + - linux + - osx + compiler: - gcc - clang @@ -15,27 +20,17 @@ cache: - mapnik-packaging before_install: -- sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test -- sudo apt-get update -qq -- sudo apt-get -y install gcc-4.8 g++-4.8 -- sudo apt-get -y install pkg-config nodejs cmake automake libtool xutils-dev -- sudo apt-get -y install libxi-dev libglu1-mesa-dev x11proto-randr-dev x11proto-xext-dev libxrandr-dev x11proto-xf86vidmode-dev libxxf86vm-dev libxcursor-dev +- source ./scripts/setup_travis.sh install: - make setup -- rm -rf mapnik-packaging/out/packages before_script: -- if [[ ${CXX} == "g++" ]]; then export CXX="g++-4.8" ; fi -- if [[ ${BUILDTYPE} == "Debug" ]] && [[ ${CXX} == "g++" ]]; then export CXXFLAGS="-fsanitize=address";export CFLAGS="${CXXFLAGS}";export LDFLAGS="-fsanitize=address" ; fi -- if [[ ${BUILDTYPE} == "Debug" ]] && [[ ${CXX} == "clang++" ]]; then export CXXFLAGS="-fsanitize=thread -fPIC";export CFLAGS="${CXXFLAGS}";export LDFLAGS="-fsanitize=thread -pie" ; fi -- if [[ ${CXX} == "clang++" ]]; then export LDFLAGS="${LDFLAGS}"; export CXXFLAGS="-Wno-unknown-warning-option -Wno-unused-local-typedefs -Wno-unknown-pragmas ${CXXFLAGS}"; fi +- rm -rf mapnik-packaging/out/packages script: - make linux BUILDTYPE=${BUILDTYPE} - make run-tests BUILDTYPE=${BUILDTYPE} -# TODO - port to linux -#- make run-headless-test BUILDTYPE=${BUILDTYPE} notifications: hipchat: diff --git a/scripts/setup_travis.sh b/scripts/setup_travis.sh new file mode 100755 index 000000000..7fcaf66e2 --- /dev/null +++ b/scripts/setup_travis.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +# enable testing locally (not on travis) +if [[ "${TRAVIS_OS_NAME:-false}" == false ]]; then + if [[ $(uname -s) == "Darwin" ]]; then + TRAVIS_OS_NAME="osx" + elif [[ $(uname -s) == "Darwin" ]]; then + TRAVIS_OS_NAME="linux" + fi +fi + +if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then + + if [[ `lsb_release -r` =~ "12.04" ]]; then + sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test + fi + sudo apt-get update -y + sudo apt-get -y install gcc-4.8 g++-4.8 + sudo apt-get -y install pkg-config nodejs cmake automake libtool xutils-dev git + sudo apt-get -y install libxi-dev libglu1-mesa-dev x11proto-randr-dev x11proto-xext-dev libxrandr-dev x11proto-xf86vidmode-dev libxxf86vm-dev libxcursor-dev + + # use g++ that supports c++11 + if [[ ${CXX} == "g++" ]]; then + export CXX="g++-4.8" ; + fi + + # Tf building in debug then turn on sanitizers. + # They should both work with latest g++/clang++ + # but it's not worth a standalone matrix so here + # we just test address->gcc and thread->clang for + # some limited coverage + if [[ ${BUILDTYPE} == "Debug" ]]; then + if [[ ${CXX} == "g++" ]]; then + export CXXFLAGS="-fsanitize=address ${CXXFLAGS}" + export CFLAGS="-fsanitize=address ${CFLAGS}" + export LDFLAGS="-fsanitize=address ${LDFLAGS}" + elif [[ ${CXX} == "clang++" ]]; then + export CXXFLAGS="-fsanitize=thread -fPIC ${CXXFLAGS}" + export CFLAGS="-fsanitize=thread ${CFLAGS}" + export LDFLAGS="-fsanitize=thread -pie ${LDFLAGS}" + fi + fi +elif [[ ${TRAVIS_OS_NAME} == "osx" ]]; then + brew install autoconf automake libtool makedepend cmake pkg-config node git +fi + +# turn off a few warnings +export CXXFLAGS="-Wno-unknown-warning-option -Wno-unused-local-typedefs -Wno-unknown-pragmas ${CXXFLAGS}";