From 0af4349bf007e685fb12564e9471cc572d6a9ec6 Mon Sep 17 00:00:00 2001 From: Victor Costan Date: Mon, 29 Apr 2019 15:10:15 -0700 Subject: [PATCH] Update Travis CI configuration. The Travis configuration: 1) Installs recent versions of clang and GCC. 2) Sets up the environment so that CMake picks up the installed compilers. Previously, the pre-installed clang compiler was used instead. 3) Requests a modern macOS image that has all the headers needed by GCC. The CL also removes now-unnecessary old workarounds from the Travis configuration. PiperOrigin-RevId: 245832795 --- .travis.yml | 67 +++++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1f67471..132d009 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,46 +2,39 @@ # http://about.travis-ci.org/docs/user/build-configuration/ # This file can be validated on: http://lint.travis-ci.org/ -dist: xenial language: cpp +dist: xenial +osx_image: xcode10.2 compiler: - - gcc - - clang +- gcc +- clang os: - - linux - - osx +- linux +- osx env: - - BUILD_TYPE=Debug CPU_LEVEL=AVX - - BUILD_TYPE=Debug CPU_LEVEL=AVX2 - - BUILD_TYPE=RelWithDebInfo CPU_LEVEL=AVX - - BUILD_TYPE=RelWithDebInfo CPU_LEVEL=AVX2 +- BUILD_TYPE=Debug CPU_LEVEL=AVX +- BUILD_TYPE=Debug CPU_LEVEL=AVX2 +- BUILD_TYPE=RelWithDebInfo CPU_LEVEL=AVX +- BUILD_TYPE=RelWithDebInfo CPU_LEVEL=AVX2 matrix: exclude: - # GCC fails on recent Travis OSX images. - # https://github.com/travis-ci/travis-ci/issues/9640 - - compiler: gcc - os: osx - # Travis OSX servers seem to run on pre-Haswell CPUs. Attempting to use AVX2 - # results in crashes. - - env: BUILD_TYPE=Debug CPU_LEVEL=AVX2 - os: osx - - env: BUILD_TYPE=RelWithDebInfo CPU_LEVEL=AVX2 - os: osx + # Travis OSX servers seem to run on pre-Haswell CPUs. Attempting to use AVX2 + # results in crashes. + - env: BUILD_TYPE=Debug CPU_LEVEL=AVX2 + os: osx + - env: BUILD_TYPE=RelWithDebInfo CPU_LEVEL=AVX2 + os: osx addons: apt: - # List of whitelisted in travis packages for ubuntu-trusty can be found here: - # https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-trusty - # List of whitelisted in travis apt-sources: - # https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json sources: - - llvm-toolchain-xenial-7 + - llvm-toolchain-xenial-8 - ubuntu-toolchain-r-test packages: - - clang-7 + - clang-8 - cmake - gcc-8 - g++-8 @@ -50,18 +43,26 @@ addons: packages: - cmake - gcc@8 + - llvm@8 - ninja - -before_install: -# The Travis VM image for Mac already has a link at /usr/local/include/c++, -# causing Homebrew's gcc installation to error out. This was reported to -# Homebrew maintainers at https://github.com/Homebrew/brew/issues/1742 and -# removing the link emerged as a workaround. -- if [ "$TRAVIS_OS_NAME" == "osx" ]; then rm -f /usr/local/include/c++ ; fi + update: true install: -# /usr/bin/gcc is stuck to old versions on both Linux and OSX. +# The following Homebrew packages aren't linked by default, and need to be +# prepended to the path explicitly. +- if [ "$TRAVIS_OS_NAME" == "osx" ]; then + export PATH="$(brew --prefix llvm)/bin:$PATH"; + fi +# /usr/bin/gcc points to an older compiler on both Linux and macOS. - if [ "$CXX" = "g++" ]; then export CXX="g++-8" CC="gcc-8"; fi +# /usr/bin/clang points to an older compiler on both Linux and macOS. +# +# Homebrew's llvm package doesn't ship a versioned clang++ binary, so the values +# below don't work on macOS. Fortunately, the path change above makes the +# default values (clang and clang++) resolve to the correct compiler on macOS. +- if [ "$TRAVIS_OS_NAME" == "linux" ]; then + if [ "$CXX" = "clang++" ]; then export CXX="clang++-8" CC="clang-8"; fi; + fi - echo ${CC} - echo ${CXX} - ${CXX} --version