Clean up and update CI build scripts (#563)

* travis.yml clean up

- Remove trailling spaces
- Move notification setting from the bottom to the top
- Set Linux as default OS
- Simplify cache directory
- Add banners around different configurations

* Update CMake installation routine

- Make it depend on variable (easier to update)
- Simplify code a bit

* Re-organize build matrix and LLVM install

- make logic depend on a single COMPILER variable
- Update LLVM installation process

* Update compilers to latest stable version
This commit is contained in:
Tiago 2017-10-25 11:36:31 -07:00 committed by Neil MacIntosh
parent 211e195d8f
commit bec7fa72c1

View File

@ -2,154 +2,238 @@
language: cpp language: cpp
sudo: false sudo: false
notifications:
email: false
# Use Linux unless specified otherwise
os: linux
dist: trusty
cache: cache:
directories: directories:
- ${TRAVIS_BUILD_DIR}/deps/cmake - ${TRAVIS_BUILD_DIR}/deps
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.5.2/install
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.2/install
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.7.1/install
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.1/install
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.9.1/install
matrix: matrix:
include: include:
- env: BUILD_TYPE=Debug
##########################################################################
# Clang on OSX
# Travis seems to take longer to start OSX instances,
# so leave this first for the overall build to be faster
##########################################################################
# XCode 8.3
- env: COMPILER=clang++ BUILD_TYPE=Debug
os: osx os: osx
osx_image: xcode8 osx_image: xcode8.3
compiler: clang compiler: clang
- env: BUILD_TYPE=Release
- env: COMPILER=clang++ BUILD_TYPE=Release
os: osx os: osx
osx_image: xcode8 osx_image: xcode8.3
compiler: clang compiler: clang
- env: CLANG_VERSION=3.6 BUILD_TYPE=Debug
os: linux # XCode 9.1
- env: COMPILER=clang++ BUILD_TYPE=Debug
os: osx
osx_image: xcode9.1
compiler: clang
- env: COMPILER=clang++ BUILD_TYPE=Release
os: osx
osx_image: xcode9.1
compiler: clang
##########################################################################
# Clang on Linux
##########################################################################
# Clang 3.6
- env: COMPILER=clang++-3.6 BUILD_TYPE=Debug
addons: &clang36 addons: &clang36
apt: apt:
packages: packages:
- clang-3.6 - clang-3.6
- g++-5 - g++-5
sources: &sources sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6 - llvm-toolchain-precise-3.6
- env: CLANG_VERSION=3.6 BUILD_TYPE=Release
os: linux - env: COMPILER=clang++-3.6 BUILD_TYPE=Release
addons: *clang36 addons: *clang36
- env: CLANG_VERSION=3.7 BUILD_TYPE=Debug
os: linux # Clang 3.7
- env: COMPILER=clang++-3.7 BUILD_TYPE=Debug
addons: &clang37 addons: &clang37
apt: apt:
packages: packages:
- clang-3.7 - clang-3.7
- g++-5 - g++-5
sources: &sources sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7 - llvm-toolchain-precise-3.7
- env: CLANG_VERSION=3.7 BUILD_TYPE=Release
os: linux - env: COMPILER=clang++-3.7 BUILD_TYPE=Release
addons: *clang37 addons: *clang37
- env: CLANG_VERSION=3.8 BUILD_TYPE=Debug
os: linux # Clang 3.8
- env: COMPILER=clang++-3.8 BUILD_TYPE=Debug
addons: &clang38 addons: &clang38
apt: apt:
packages: packages:
- clang-3.8 - clang-3.8
- g++-5 - g++-5
sources: &sources sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8 - llvm-toolchain-precise-3.8
- env: CLANG_VERSION=3.8 BUILD_TYPE=Release
os: linux - env: COMPILER=clang++-3.8 BUILD_TYPE=Release
addons: *clang38 addons: *clang38
- env: CLANG_VERSION=3.9 BUILD_TYPE=Debug
os: linux # Clang 3.9
- env: COMPILER=clang++-3.9 BUILD_TYPE=Debug
addons: &clang39 addons: &clang39
apt: apt:
packages: packages:
- clang-3.9 - clang-3.9
- g++-5 - g++-5
sources: &sources sources:
- ubuntu-toolchain-r-test - ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9 - llvm-toolchain-precise-3.9
- env: CLANG_VERSION=3.9 BUILD_TYPE=Release
os: linux - env: COMPILER=clang++-3.9 BUILD_TYPE=Release
addons: *clang39 addons: *clang39
- env: GCC_VERSION=5 BUILD_TYPE=Debug
os: linux # Clang 4.0
- env: COMPILER=clang++-4.0 BUILD_TYPE=Debug
addons: &clang40
apt:
packages:
- clang-4.0
- g++-5
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- env: COMPILER=clang++-4.0 BUILD_TYPE=Release
addons: *clang40
# Clang 5.0
- env: COMPILER=clang++-5.0 BUILD_TYPE=Debug
addons: &clang40
apt:
packages:
- clang-5.0
- g++-5
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0
- sourceline: 'deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-4.0 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- env: COMPILER=clang++-5.0 BUILD_TYPE=Release
addons: *clang40
##########################################################################
# GCC on Linux
##########################################################################
# GCC 5
- env: COMPILER=g++-5 BUILD_TYPE=Debug
addons: &gcc5 addons: &gcc5
apt: apt:
packages: g++-5 packages: g++-5
sources: *sources sources:
- env: GCC_VERSION=5 BUILD_TYPE=Release - ubuntu-toolchain-r-test
os: linux
- env: COMPILER=g++-5 BUILD_TYPE=Release
addons: *gcc5 addons: *gcc5
- env: GCC_VERSION=6 BUILD_TYPE=Debug
os: linux # GCC 6
- env: COMPILER=g++-6 BUILD_TYPE=Debug
addons: &gcc6 addons: &gcc6
apt: apt:
packages: g++-6 packages: g++-6
sources: *sources sources:
- env: GCC_VERSION=6 BUILD_TYPE=Release - ubuntu-toolchain-r-test
os: linux
- env: COMPILER=g++-6 BUILD_TYPE=Release
addons: *gcc6 addons: *gcc6
# Currently fails due to #525
## GCC 7
#- env: COMPILER=g++-7 BUILD_TYPE=Debug
# addons: &gcc7
# apt:
# packages: g++-7
# sources:
# - ubuntu-toolchain-r-test
#- env: COMPILER=g++-7 BUILD_TYPE=Release
# addons: *gcc7
install: install:
- if [[ -n "$CLANG_VERSION" ]]; then export CXX=clang++-$CLANG_VERSION CC=clang-$CLANG_VERSION; fi # Set the ${CXX} variable properly
- if [[ -n "$GCC_VERSION" ]]; then export CXX=g++-$GCC_VERSION CC=gcc-$GCC_VERSION; fi - export CXX=${COMPILER}
- JOBS=2 - ${CXX} --version
# Dependencies required by the CI are installed in ${TRAVIS_BUILD_DIR}/deps/
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p "${DEPS_DIR}" && cd "${DEPS_DIR}" - mkdir -p "${DEPS_DIR}"
- cd "${DEPS_DIR}"
# Travis machines have 2 cores
- JOBS=2
############################################################################ ############################################################################
# Install a recent CMake (unless already installed on OS X) # Install a recent CMake (unless already installed on OS X)
############################################################################ ############################################################################
- CMAKE_VERSION=3.7.2
- | - |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
if [[ -z "$(ls -A ${DEPS_DIR}/cmake/bin)" ]]; then CMAKE_URL="https://cmake.org/files/v${CMAKE_VERSION%.[0-9]}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"
CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz" mkdir cmake && travis_retry wget --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
mkdir -p cmake && travis_retry wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tar --strip-components=1 -xz -C cmake export PATH=${DEPS_DIR}/cmake/bin:${PATH}
fi
export PATH="${DEPS_DIR}/cmake/bin:${PATH}"
else else
if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi brew install cmake || brew upgrade cmake
fi fi
- cmake --version
############################################################################ ############################################################################
# [linux]: Install the right version of libc++ # [linux]: Install the right version of libc++
############################################################################ ############################################################################
- | - |
if [[ -n "$CLANG_VERSION" && "${TRAVIS_OS_NAME}" == "linux" && "${STDLIB}" != "libstdc++" ]]; then LLVM_INSTALL=${DEPS_DIR}/llvm/install
if [[ "$CLANG_VERSION" == "3.5" ]]; then LLVM_VERSION="3.5.2"; fi # if in linux and compiler clang and llvm not installed
if [[ "$CLANG_VERSION" == "3.6" ]]; then LLVM_VERSION="3.6.2"; fi if [[ "${TRAVIS_OS_NAME}" == "linux" && "${CXX%%+*}" == "clang" && -n "$(ls -A ${LLVM_INSTALL})" ]]; then
if [[ "$CLANG_VERSION" == "3.7" ]]; then LLVM_VERSION="3.7.1"; fi if [[ "${CXX}" == "clang++-3.6" ]]; then LLVM_VERSION="3.6.2";
if [[ "$CLANG_VERSION" == "3.8" ]]; then LLVM_VERSION="3.8.1"; fi elif [[ "${CXX}" == "clang++-3.7" ]]; then LLVM_VERSION="3.7.1";
if [[ "$CLANG_VERSION" == "3.9" ]]; then LLVM_VERSION="3.9.1"; fi elif [[ "${CXX}" == "clang++-3.8" ]]; then LLVM_VERSION="3.8.1";
LLVM_ROOT="${DEPS_DIR}/llvm-${LLVM_VERSION}" elif [[ "${CXX}" == "clang++-3.9" ]]; then LLVM_VERSION="3.9.1";
fi
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz" LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz" LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz" LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
if [[ -z "$(ls -A ${LLVM_ROOT}/install/include)" ]]; then mkdir -p llvm llvm/build llvm/projects/libcxx llvm/projects/libcxxabi
mkdir -p "${LLVM_ROOT}" "${LLVM_ROOT}/build" "${LLVM_ROOT}/projects/libcxx" "${LLVM_ROOT}/projects/libcxxabi" travis_retry wget -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C llvm
travis_retry wget --quiet -O - "${LLVM_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}" travis_retry wget -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxx
travis_retry wget --quiet -O - "${LIBCXX_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}/projects/libcxx" travis_retry wget -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C llvm/projects/libcxxabi
travis_retry wget --quiet -O - "${LIBCXXABI_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}/projects/libcxxabi" (cd llvm/build && cmake .. -DCMAKE_INSTALL_PREFIX=${LLVM_INSTALL})
(cd "${LLVM_ROOT}/build" && cmake .. -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_C_COMPILER="$CC" -DCMAKE_INSTALL_PREFIX="${LLVM_ROOT}/install" -DCMAKE_BUILD_TYPE=$BUILD_TYPE) (cd llvm/build/projects/libcxx && make install -j2)
(cd "${LLVM_ROOT}/build/projects/libcxx" && make install -j$JOBS) (cd llvm/build/projects/libcxxabi && make install -j2)
(cd "${LLVM_ROOT}/build/projects/libcxxabi" && make install -j$JOBS) export CXXFLAGS="-isystem ${LLVM_INSTALL}/include/c++/v1"
fi export LDFLAGS="-L ${LLVM_INSTALL}/lib -l c++ -l c++abi"
export CXXFLAGS="-I ${LLVM_ROOT}/install/include/c++/v1" export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_INSTALL}/lib"
export LDFLAGS="-L ${LLVM_ROOT}/install/lib -lc++ -lc++abi"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_ROOT}/install/lib"
fi fi
before_script: before_script:
# have CMake to generate build files
- cd "${TRAVIS_BUILD_DIR}" - cd "${TRAVIS_BUILD_DIR}"
- cmake . -Bbuild -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_C_COMPILER="$CC" -DCMAKE_BUILD_TYPE=$BUILD_TYPE - mkdir build && cd build
- cmake --build build -- -j$JOBS - cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE
script: script:
- cd build # build and run tests
- ctest --output-on-failure -j$JOBS - cmake --build . -- -j${JOBS}
- ctest --output-on-failure -j${JOBS}
notifications:
email: false