Wenzel Jakob | 3b806d4 | 2015-10-11 16:29:35 +0200 | [diff] [blame] | 1 | language: cpp |
| 2 | sudo: false |
Dean Moldovan | 3ac1275 | 2016-07-30 00:15:01 +0200 | [diff] [blame] | 3 | matrix: |
| 4 | include: |
| 5 | - os: linux |
Jason Rhinelander | 024ce44 | 2016-08-14 12:31:52 -0400 | [diff] [blame] | 6 | env: PYTHON=2.7 CPP=11 GCC=4.8 |
| 7 | addons: |
| 8 | apt: |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 9 | sources: [ubuntu-toolchain-r-test, kubuntu-backports] |
| 10 | packages: [g++-4.8, cmake] |
Dean Moldovan | 3ac1275 | 2016-07-30 00:15:01 +0200 | [diff] [blame] | 11 | - os: linux |
Jason Rhinelander | 024ce44 | 2016-08-14 12:31:52 -0400 | [diff] [blame] | 12 | env: PYTHON=3.5 CPP=11 GCC=4.8 |
| 13 | addons: |
| 14 | apt: |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 15 | sources: [ubuntu-toolchain-r-test, kubuntu-backports, deadsnakes] |
| 16 | packages: [g++-4.8, cmake, python3.5-dev] |
| 17 | - sudo: true |
| 18 | services: docker |
| 19 | env: PYTHON=2.7 CPP=14 GCC=6 |
| 20 | - sudo: true |
| 21 | services: docker |
Jason Rhinelander | 5b4968d | 2016-09-12 16:04:31 -0400 | [diff] [blame] | 22 | env: PYTHON=3.5 CPP=14 GCC=6 DEBUG=1 |
Jason Rhinelander | a3d41d1 | 2016-12-13 21:00:51 -0500 | [diff] [blame] | 23 | - sudo: true |
| 24 | services: docker |
| 25 | env: PYTHON=3.5 CPP=17 GCC=7 |
Dean Moldovan | 3ac1275 | 2016-07-30 00:15:01 +0200 | [diff] [blame] | 26 | - os: osx |
| 27 | osx_image: xcode7.3 |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 28 | env: PYTHON=2.7 CPP=14 CLANG |
Dean Moldovan | 3ac1275 | 2016-07-30 00:15:01 +0200 | [diff] [blame] | 29 | - os: osx |
| 30 | osx_image: xcode7.3 |
Yung-Yu Chen | 87f893b | 2016-12-26 18:24:30 +0800 | [diff] [blame] | 31 | env: PYTHON=3.6 CPP=14 CLANG |
Wenzel Jakob | 1d1f81b | 2016-12-16 15:00:46 +0100 | [diff] [blame] | 32 | # Test a PyPy 2.7 nightly build |
| 33 | - os: linux |
| 34 | env: PYPY=1 PYTHON=2.7 CPP=11 GCC=4.8 |
| 35 | addons: |
| 36 | apt: |
| 37 | sources: [ubuntu-toolchain-r-test, kubuntu-backports] |
| 38 | packages: [g++-4.8, cmake] |
Jason Rhinelander | 102c94f | 2017-01-31 11:10:31 -0500 | [diff] [blame] | 39 | - sudo: true |
| 40 | services: docker |
| 41 | env: ARCH=i386 PYTHON=3.5 CPP=14 GCC=6 |
Jason Rhinelander | 60d0e0d | 2017-02-24 17:07:53 -0500 | [diff] [blame] | 42 | # This next one does a make install *before* testing, then builds the tests against the installed version: |
| 43 | - sudo: true |
| 44 | services: docker |
| 45 | env: PYTHON=3.5 CPP=14 CLANG=3.9 INSTALL=1 |
| 46 | script: |
| 47 | - | |
| 48 | $SCRIPT_RUN_PREFIX sh -c "set -e |
| 49 | cmake ${CMAKE_EXTRA_ARGS} -DPYBIND11_INSTALL=1 -DPYBIND11_TEST=0 |
| 50 | make install |
| 51 | cp -a tests /pybind11-tests |
| 52 | mkdir /build-tests && cd /build-tests |
| 53 | cmake ../pybind11-tests ${CMAKE_EXTRA_ARGS} -DPYBIND11_WERROR=ON |
| 54 | make pytest -j 2" |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 55 | # A barebones build makes sure everything still works without optional deps (numpy/scipy/eigen) |
| 56 | # and also tests the automatic discovery functions in CMake (Python version, C++ standard). |
| 57 | - os: linux |
| 58 | env: BAREBONES |
| 59 | addons: |
| 60 | apt: |
| 61 | sources: [ubuntu-toolchain-r-test, kubuntu-backports] |
| 62 | packages: [g++-4.8, cmake] |
Jason Rhinelander | dd3d56a | 2016-08-26 17:11:40 -0400 | [diff] [blame] | 63 | install: pip install pytest |
Jason Rhinelander | 4b5058d | 2016-08-17 09:14:22 -0400 | [diff] [blame] | 64 | # Documentation build: |
| 65 | - os: linux |
| 66 | language: docs |
Dean Moldovan | bad1740 | 2016-11-20 21:21:54 +0100 | [diff] [blame] | 67 | env: DOCS STYLE LINT |
Wenzel Jakob | f8571ea | 2016-12-11 18:51:44 +0100 | [diff] [blame] | 68 | install: |
| 69 | - pip install --upgrade sphinx sphinx_rtd_theme flake8 pep8-naming |
Dean Moldovan | 57a9bbc | 2017-01-31 16:54:08 +0100 | [diff] [blame] | 70 | - | |
| 71 | curl -fsSL ftp://ftp.stack.nl/pub/users/dimitri/doxygen-1.8.12.linux.bin.tar.gz | tar xz |
| 72 | export PATH="$PWD/doxygen-1.8.12/bin:$PATH" |
| 73 | pip install https://github.com/michaeljones/breathe/archive/master.zip |
Jason Rhinelander | ac42789 | 2016-08-28 13:00:44 -0400 | [diff] [blame] | 74 | script: |
| 75 | - make -C docs html SPHINX_OPTIONS=-W |
| 76 | - tools/check-style.sh |
Dean Moldovan | bad1740 | 2016-11-20 21:21:54 +0100 | [diff] [blame] | 77 | - flake8 |
Jason Rhinelander | a3d41d1 | 2016-12-13 21:00:51 -0500 | [diff] [blame] | 78 | allow_failures: |
| 79 | - env: PYTHON=3.5 CPP=17 GCC=7 |
Wenzel Jakob | a40c27e | 2016-01-21 19:21:59 +0100 | [diff] [blame] | 80 | cache: |
| 81 | directories: |
| 82 | - $HOME/.cache/pip |
Dean Moldovan | 14bd10d | 2016-08-26 11:53:25 +0200 | [diff] [blame] | 83 | - $HOME/Library/Caches/pip |
Jason Rhinelander | 024ce44 | 2016-08-14 12:31:52 -0400 | [diff] [blame] | 84 | before_install: |
| 85 | - | |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 86 | # Configure build variables |
| 87 | if [ "$TRAVIS_OS_NAME" = "linux" ]; then |
Jason Rhinelander | 60d0e0d | 2017-02-24 17:07:53 -0500 | [diff] [blame] | 88 | if [ -n "$CLANG" ]; then |
| 89 | export CXX=clang++-$CLANG CC=clang-$CLANG COMPILER_PACKAGES="clang-$CLANG llvm-$CLANG-dev" |
| 90 | else |
| 91 | if [ -z "$GCC" ]; then export GCC=4.8 |
| 92 | else export COMPILER_PACKAGES=g++-$GCC |
| 93 | fi |
| 94 | export CXX=g++-$GCC CC=gcc-$GCC |
| 95 | fi |
| 96 | if [ "$GCC" = "6" ] || [ -n "$CLANG" ]; then export DOCKER=${ARCH:+$ARCH/}debian:testing |
Jason Rhinelander | a3d41d1 | 2016-12-13 21:00:51 -0500 | [diff] [blame] | 97 | elif [ "$GCC" = "7" ]; then export DOCKER=debian:experimental APT_GET_EXTRA="-t experimental" |
| 98 | fi |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 99 | elif [ "$TRAVIS_OS_NAME" = "osx" ]; then |
| 100 | export CXX=clang++ CC=clang; |
| 101 | fi |
| 102 | if [ -n "$CPP" ]; then export CPP=-std=c++$CPP; fi |
| 103 | if [ "${PYTHON:0:1}" = "3" ]; then export PY=3; fi |
Wenzel Jakob | 1d1f81b | 2016-12-16 15:00:46 +0100 | [diff] [blame] | 104 | if [ -n "$PYPY" ]; then |
| 105 | curl http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-latest-linux64.tar.bz2 | tar -xj |
| 106 | export PYPY_BINARY=$(echo `pwd`/pypy-c-jit*/bin/pypy) |
| 107 | export CMAKE_EXTRA_ARGS="-DPYTHON_EXECUTABLE:FILEPATH=$PYPY_BINARY" |
| 108 | fi |
Jason Rhinelander | 5b4968d | 2016-09-12 16:04:31 -0400 | [diff] [blame] | 109 | if [ -n "$DEBUG" ]; then export CMAKE_EXTRA_ARGS="-DCMAKE_BUILD_TYPE=Debug"; fi |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 110 | - | |
Wenzel Jakob | 1d1f81b | 2016-12-16 15:00:46 +0100 | [diff] [blame] | 111 | # Initialize environment |
| 112 | if [ -n "$PYPY" ]; then |
| 113 | $PYPY_BINARY -m ensurepip |
| 114 | $PYPY_BINARY -m pip install pytest |
| 115 | fi |
Jason Rhinelander | 024ce44 | 2016-08-14 12:31:52 -0400 | [diff] [blame] | 116 | if [ -n "$DOCKER" ]; then |
| 117 | docker pull $DOCKER |
Jason Rhinelander | ada763b | 2017-02-09 21:53:38 -0500 | [diff] [blame] | 118 | # Disable LTO with gcc until gcc 79296 is fixed: |
| 119 | export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPYBIND11_LTO_CXX_FLAGS=" |
Jason Rhinelander | 024ce44 | 2016-08-14 12:31:52 -0400 | [diff] [blame] | 120 | export containerid=$(docker run --detach --tty \ |
| 121 | --volume="$PWD":/pybind11 --workdir=/pybind11 \ |
Jason Rhinelander | ada763b | 2017-02-09 21:53:38 -0500 | [diff] [blame] | 122 | --env="CXXFLAGS=$CXXFLAGS" \ |
Jason Rhinelander | 024ce44 | 2016-08-14 12:31:52 -0400 | [diff] [blame] | 123 | --env="CC=$CC" --env="CXX=$CXX" --env="DEBIAN_FRONTEND=$DEBIAN_FRONTEND" \ |
| 124 | --env=GCC_COLORS=\ \ |
| 125 | $DOCKER) |
Jason Rhinelander | bf14cea | 2016-09-09 23:54:10 -0400 | [diff] [blame] | 126 | docker exec --tty "$containerid" sh -c 'for s in 0 15; do sleep $s; apt-get update && apt-get -qy dist-upgrade && break; done' |
Jason Rhinelander | 024ce44 | 2016-08-14 12:31:52 -0400 | [diff] [blame] | 127 | export SCRIPT_RUN_PREFIX="docker exec --tty $containerid" |
Jason Rhinelander | ada763b | 2017-02-09 21:53:38 -0500 | [diff] [blame] | 128 | # gcc-7 currently generates warnings; some are upstream bugs, so just turn off -Werror for now |
| 129 | if [ "$GCC" = "7" ]; then WERROR=off; fi |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 130 | else |
Jason Rhinelander | 024ce44 | 2016-08-14 12:31:52 -0400 | [diff] [blame] | 131 | if [ "$TRAVIS_OS_NAME" = "linux" ]; then |
Jason Rhinelander | 024ce44 | 2016-08-14 12:31:52 -0400 | [diff] [blame] | 132 | pip install --user --upgrade pip virtualenv |
| 133 | virtualenv -p python$PYTHON venv |
| 134 | elif [ "$TRAVIS_OS_NAME" = "osx" ]; then |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 135 | if [ "$PY" = "3" ]; then |
| 136 | brew update; brew install python$PY; |
Jason Rhinelander | 024ce44 | 2016-08-14 12:31:52 -0400 | [diff] [blame] | 137 | else |
| 138 | curl -fsSL -O https://bootstrap.pypa.io/get-pip.py |
| 139 | sudo -H python get-pip.py |
| 140 | fi |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 141 | pip$PY install --user --upgrade pip virtualenv |
| 142 | python$PY -m virtualenv venv |
Dean Moldovan | 880a7e4 | 2016-08-02 00:42:07 +0200 | [diff] [blame] | 143 | fi |
Jason Rhinelander | 024ce44 | 2016-08-14 12:31:52 -0400 | [diff] [blame] | 144 | source venv/bin/activate |
Jason Rhinelander | 4b5058d | 2016-08-17 09:14:22 -0400 | [diff] [blame] | 145 | fi |
Jason Rhinelander | 0b952cd | 2016-08-17 14:19:08 -0400 | [diff] [blame] | 146 | install: |
Jason Rhinelander | 4b5058d | 2016-08-17 09:14:22 -0400 | [diff] [blame] | 147 | - | |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 148 | # Install dependencies |
| 149 | if [ -n "$DOCKER" ]; then |
Jason Rhinelander | a3d41d1 | 2016-12-13 21:00:51 -0500 | [diff] [blame] | 150 | docker exec --tty "$containerid" sh -c "for s in 0 15; do sleep \$s; \ |
| 151 | apt-get -qy --no-install-recommends $APT_GET_EXTRA install \ |
| 152 | python$PY-dev python$PY-pytest python$PY-scipy \ |
Jason Rhinelander | 60d0e0d | 2017-02-24 17:07:53 -0500 | [diff] [blame] | 153 | libeigen3-dev cmake make ${COMPILER_PACKAGES} && break; done" |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 154 | else |
Jason Rhinelander | dd3d56a | 2016-08-26 17:11:40 -0400 | [diff] [blame] | 155 | pip install numpy scipy pytest |
Jason Rhinelander | 024ce44 | 2016-08-14 12:31:52 -0400 | [diff] [blame] | 156 | |
Jason Rhinelander | 219b10a | 2016-11-11 02:15:38 -0500 | [diff] [blame] | 157 | wget -q -O eigen.tar.gz https://bitbucket.org/eigen/eigen/get/3.3.0.tar.gz |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 158 | tar xzf eigen.tar.gz |
Jason Rhinelander | 219b10a | 2016-11-11 02:15:38 -0500 | [diff] [blame] | 159 | export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DCMAKE_INCLUDE_PATH=$PWD/eigen-eigen-26667be4f70b" |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 160 | fi |
Dean Moldovan | 3ac1275 | 2016-07-30 00:15:01 +0200 | [diff] [blame] | 161 | script: |
Dean Moldovan | 00a3009 | 2016-08-15 13:41:44 +0200 | [diff] [blame] | 162 | - $SCRIPT_RUN_PREFIX cmake ${CMAKE_EXTRA_ARGS} |
| 163 | -DPYBIND11_PYTHON_VERSION=$PYTHON |
Dean Moldovan | b62a896 | 2016-08-25 22:35:15 +0200 | [diff] [blame] | 164 | -DPYBIND11_CPP_STANDARD=$CPP |
Jason Rhinelander | ada763b | 2017-02-09 21:53:38 -0500 | [diff] [blame] | 165 | -DPYBIND11_WERROR=${WERROR:-ON} |
Dean Moldovan | a0c1ccf | 2016-08-12 13:50:00 +0200 | [diff] [blame] | 166 | - $SCRIPT_RUN_PREFIX make pytest -j 2 |
Dean Moldovan | b0f3885 | 2016-12-14 01:43:39 +0100 | [diff] [blame] | 167 | - $SCRIPT_RUN_PREFIX make test_cmake_build |
| 168 | after_failure: cat tests/test_cmake_build/*.log |
Jason Rhinelander | 024ce44 | 2016-08-14 12:31:52 -0400 | [diff] [blame] | 169 | after_script: |
| 170 | - if [ -n "$DOCKER" ]; then docker stop "$containerid"; docker rm "$containerid"; fi |