.travis.yml revision 11986:c12e4625ab56
1language: cpp
2sudo: false
3matrix:
4  include:
5  - os: linux
6    env: PYTHON=2.7 CPP=11 GCC=4.8
7    addons:
8      apt:
9        sources: [ubuntu-toolchain-r-test, kubuntu-backports]
10        packages: [g++-4.8, cmake]
11  - os: linux
12    env: PYTHON=3.5 CPP=11 GCC=4.8
13    addons:
14      apt:
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
22    env: PYTHON=3.5 CPP=14 GCC=6 DEBUG=1
23  - os: osx
24    osx_image: xcode7.3
25    env: PYTHON=2.7 CPP=14 CLANG
26  - os: osx
27    osx_image: xcode7.3
28    env: PYTHON=3.5 CPP=14 CLANG
29  # A barebones build makes sure everything still works without optional deps (numpy/scipy/eigen)
30  # and also tests the automatic discovery functions in CMake (Python version, C++ standard).
31  - os: linux
32    env: BAREBONES
33    addons:
34      apt:
35        sources: [ubuntu-toolchain-r-test, kubuntu-backports]
36        packages: [g++-4.8, cmake]
37    install: pip install pytest
38  # Documentation build:
39  - os: linux
40    language: docs
41    env: DOCS STYLE LINT
42    install:
43    - pip install --upgrade sphinx sphinx_rtd_theme flake8 pep8-naming
44    - pip install docutils==0.12
45    script:
46    - make -C docs html SPHINX_OPTIONS=-W
47    - tools/check-style.sh
48    - flake8
49cache:
50  directories:
51  - $HOME/.cache/pip
52  - $HOME/Library/Caches/pip
53before_install:
54- |
55  # Configure build variables
56  if [ "$TRAVIS_OS_NAME" = "linux" ]; then
57    if [ -z "$GCC" ]; then export GCC=4.8; fi
58    export CXX=g++-$GCC CC=gcc-$GCC;
59    if [ "$GCC" = "6" ]; then export DOCKER=debian:testing CXX=g++ CC=gcc; fi
60  elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
61    export CXX=clang++ CC=clang;
62  fi
63  if [ -n "$CPP" ]; then export CPP=-std=c++$CPP; fi
64  if [ "${PYTHON:0:1}" = "3" ]; then export PY=3; fi
65  if [ -n "$DEBUG" ]; then export CMAKE_EXTRA_ARGS="-DCMAKE_BUILD_TYPE=Debug"; fi
66- |
67  # Initialize enviornment
68  if [ -n "$DOCKER" ]; then
69    docker pull $DOCKER
70    export containerid=$(docker run --detach --tty \
71      --volume="$PWD":/pybind11 --workdir=/pybind11 \
72      --env="CC=$CC" --env="CXX=$CXX" --env="DEBIAN_FRONTEND=$DEBIAN_FRONTEND" \
73      --env=GCC_COLORS=\  \
74      $DOCKER)
75    docker exec --tty "$containerid" sh -c 'for s in 0 15; do sleep $s; apt-get update && apt-get -qy dist-upgrade && break; done'
76    export SCRIPT_RUN_PREFIX="docker exec --tty $containerid"
77  else
78    if [ "$TRAVIS_OS_NAME" = "linux" ]; then
79      pip install --user --upgrade pip virtualenv
80      virtualenv -p python$PYTHON venv
81    elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
82      if [ "$PY" = "3" ]; then
83        brew update; brew install python$PY;
84      else
85        curl -fsSL -O https://bootstrap.pypa.io/get-pip.py
86        sudo -H python get-pip.py
87      fi
88      pip$PY install --user --upgrade pip virtualenv
89      python$PY -m virtualenv venv
90    fi
91    source venv/bin/activate
92  fi
93install:
94- |
95  # Install dependencies
96  if [ -n "$DOCKER" ]; then
97    docker exec --tty "$containerid" sh -c "for s in 0 15; do sleep \$s; apt-get -qy --no-install-recommends install \
98      python$PYTHON-dev python$PY-pytest python$PY-scipy \
99      libeigen3-dev cmake make g++ && break; done"
100  else
101    pip install numpy scipy pytest
102
103    wget -q -O eigen.tar.gz https://bitbucket.org/eigen/eigen/get/3.3.0.tar.gz
104    tar xzf eigen.tar.gz
105    export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DCMAKE_INCLUDE_PATH=$PWD/eigen-eigen-26667be4f70b"
106  fi
107script:
108- $SCRIPT_RUN_PREFIX cmake ${CMAKE_EXTRA_ARGS}
109    -DPYBIND11_PYTHON_VERSION=$PYTHON
110    -DPYBIND11_CPP_STANDARD=$CPP
111    -DPYBIND11_WERROR=ON
112- $SCRIPT_RUN_PREFIX make pytest -j 2
113- $SCRIPT_RUN_PREFIX make test_install
114after_script:
115- if [ -n "$DOCKER" ]; then docker stop "$containerid"; docker rm "$containerid"; fi
116