Home | History | Annotate | Download | only in Microsoft-GSL
      1 # Based on https://github.com/ldionne/hana/blob/master/.travis.yml
      2 
      3 language: cpp
      4 sudo: false
      5 
      6 cache:
      7   directories:
      8     - ${TRAVIS_BUILD_DIR}/deps/cmake
      9     - ${TRAVIS_BUILD_DIR}/deps/llvm-3.5.2/install
     10     - ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.2/install
     11     - ${TRAVIS_BUILD_DIR}/deps/llvm-3.7.1/install
     12     - ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.1/install
     13     - ${TRAVIS_BUILD_DIR}/deps/llvm-3.9.1/install
     14 
     15 matrix:
     16   include:
     17     - env: BUILD_TYPE=Debug
     18       os: osx
     19       osx_image: xcode8
     20       compiler: clang
     21     - env: BUILD_TYPE=Release
     22       os: osx
     23       osx_image: xcode8
     24       compiler: clang
     25     - env: CLANG_VERSION=3.6 BUILD_TYPE=Debug
     26       os: linux
     27       addons: &clang36
     28         apt:
     29           packages:
     30             - clang-3.6
     31             - g++-5
     32           sources: &sources
     33             - ubuntu-toolchain-r-test
     34             - llvm-toolchain-precise-3.6
     35     - env: CLANG_VERSION=3.6 BUILD_TYPE=Release
     36       os: linux
     37       addons: *clang36
     38     - env: CLANG_VERSION=3.7 BUILD_TYPE=Debug
     39       os: linux
     40       addons: &clang37
     41         apt:
     42           packages:
     43             - clang-3.7
     44             - g++-5
     45           sources: &sources
     46             - ubuntu-toolchain-r-test
     47             - llvm-toolchain-precise-3.7
     48     - env: CLANG_VERSION=3.7 BUILD_TYPE=Release
     49       os: linux
     50       addons: *clang37
     51     - env: CLANG_VERSION=3.8 BUILD_TYPE=Debug
     52       os: linux
     53       addons: &clang38
     54         apt:
     55           packages:
     56             - clang-3.8
     57             - g++-5
     58           sources: &sources
     59             - ubuntu-toolchain-r-test
     60             - llvm-toolchain-precise-3.8
     61     - env: CLANG_VERSION=3.8 BUILD_TYPE=Release
     62       os: linux
     63       addons: *clang38
     64     - env: CLANG_VERSION=3.9 BUILD_TYPE=Debug
     65       os: linux
     66       addons: &clang39
     67         apt:
     68           packages:
     69             - clang-3.9
     70             - g++-5
     71           sources: &sources
     72             - ubuntu-toolchain-r-test
     73             - llvm-toolchain-precise-3.9
     74     - env: CLANG_VERSION=3.9 BUILD_TYPE=Release
     75       os: linux
     76       addons: *clang39
     77     - env: GCC_VERSION=5 BUILD_TYPE=Debug
     78       os: linux
     79       addons: &gcc5
     80         apt:
     81           packages: g++-5
     82           sources: *sources
     83     - env: GCC_VERSION=5 BUILD_TYPE=Release
     84       os: linux
     85       addons: *gcc5
     86     - env: GCC_VERSION=6 BUILD_TYPE=Debug
     87       os: linux
     88       addons: &gcc6
     89         apt:
     90           packages: g++-6
     91           sources: *sources
     92     - env: GCC_VERSION=6 BUILD_TYPE=Release
     93       os: linux
     94       addons: *gcc6
     95 
     96 install:
     97   - if [[ -n "$CLANG_VERSION" ]]; then export CXX=clang++-$CLANG_VERSION CC=clang-$CLANG_VERSION; fi
     98   - if [[ -n "$GCC_VERSION" ]]; then export CXX=g++-$GCC_VERSION CC=gcc-$GCC_VERSION; fi
     99   - JOBS=2
    100   - DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
    101   - mkdir -p "${DEPS_DIR}" && cd "${DEPS_DIR}"
    102 
    103   ############################################################################
    104   # Install a recent CMake (unless already installed on OS X)
    105   ############################################################################
    106   - |
    107     if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
    108       if [[ -z "$(ls -A ${DEPS_DIR}/cmake/bin)" ]]; then
    109         CMAKE_URL="https://cmake.org/files/v3.7/cmake-3.7.2-Linux-x86_64.tar.gz"
    110         mkdir -p cmake && travis_retry wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tar --strip-components=1 -xz -C cmake
    111       fi
    112       export PATH="${DEPS_DIR}/cmake/bin:${PATH}"
    113     else
    114       if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi
    115     fi
    116 
    117   ############################################################################
    118   # [linux]: Install the right version of libc++
    119   ############################################################################
    120   - |
    121     if [[ -n "$CLANG_VERSION" && "${TRAVIS_OS_NAME}" == "linux" && "${STDLIB}" != "libstdc++" ]]; then
    122       if [[ "$CLANG_VERSION" == "3.5" ]]; then LLVM_VERSION="3.5.2"; fi
    123       if [[ "$CLANG_VERSION" == "3.6" ]]; then LLVM_VERSION="3.6.2"; fi
    124       if [[ "$CLANG_VERSION" == "3.7" ]]; then LLVM_VERSION="3.7.1"; fi
    125       if [[ "$CLANG_VERSION" == "3.8" ]]; then LLVM_VERSION="3.8.1"; fi
    126       if [[ "$CLANG_VERSION" == "3.9" ]]; then LLVM_VERSION="3.9.1"; fi
    127       LLVM_ROOT="${DEPS_DIR}/llvm-${LLVM_VERSION}"
    128       LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
    129       LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
    130       LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
    131       if [[ -z "$(ls -A ${LLVM_ROOT}/install/include)" ]]; then
    132         mkdir -p "${LLVM_ROOT}" "${LLVM_ROOT}/build" "${LLVM_ROOT}/projects/libcxx" "${LLVM_ROOT}/projects/libcxxabi"
    133         travis_retry wget --quiet -O - "${LLVM_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}"
    134         travis_retry wget --quiet -O - "${LIBCXX_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}/projects/libcxx"
    135         travis_retry wget --quiet -O - "${LIBCXXABI_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}/projects/libcxxabi"
    136         (cd "${LLVM_ROOT}/build" && cmake .. -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_C_COMPILER="$CC" -DCMAKE_INSTALL_PREFIX="${LLVM_ROOT}/install" -DCMAKE_BUILD_TYPE=$BUILD_TYPE)
    137         (cd "${LLVM_ROOT}/build/projects/libcxx" && make install -j$JOBS)
    138         (cd "${LLVM_ROOT}/build/projects/libcxxabi" && make install -j$JOBS)
    139       fi
    140       export CXXFLAGS="-I ${LLVM_ROOT}/install/include/c++/v1"
    141       export LDFLAGS="-L ${LLVM_ROOT}/install/lib -lc++ -lc++abi"
    142       export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_ROOT}/install/lib"
    143     fi
    144 
    145 before_script:
    146   - cd "${TRAVIS_BUILD_DIR}"
    147   - cmake . -Bbuild -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_C_COMPILER="$CC" -DCMAKE_BUILD_TYPE=$BUILD_TYPE
    148   - cmake --build build -- -j$JOBS
    149 
    150 script:
    151   - cd build
    152   - ctest --output-on-failure -j$JOBS
    153 
    154 notifications:
    155   email: false
    156