You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.7 KiB

  1. language: cpp
  2. sudo: false
  3. matrix:
  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: pip install sphinx sphinx_rtd_theme flake8 pep8-naming
  43. script:
  44. - make -C docs html SPHINX_OPTIONS=-W
  45. - tools/check-style.sh
  46. - flake8
  47. cache:
  48. directories:
  49. - $HOME/.cache/pip
  50. - $HOME/Library/Caches/pip
  51. before_install:
  52. - |
  53. # Configure build variables
  54. if [ "$TRAVIS_OS_NAME" = "linux" ]; then
  55. if [ -z "$GCC" ]; then export GCC=4.8; fi
  56. export CXX=g++-$GCC CC=gcc-$GCC;
  57. if [ "$GCC" = "6" ]; then export DOCKER=debian:testing CXX=g++ CC=gcc; fi
  58. elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
  59. export CXX=clang++ CC=clang;
  60. fi
  61. if [ -n "$CPP" ]; then export CPP=-std=c++$CPP; fi
  62. if [ "${PYTHON:0:1}" = "3" ]; then export PY=3; fi
  63. if [ -n "$DEBUG" ]; then export CMAKE_EXTRA_ARGS="-DCMAKE_BUILD_TYPE=Debug"; fi
  64. - |
  65. # Initialize enviornment
  66. if [ -n "$DOCKER" ]; then
  67. docker pull $DOCKER
  68. export containerid=$(docker run --detach --tty \
  69. --volume="$PWD":/pybind11 --workdir=/pybind11 \
  70. --env="CC=$CC" --env="CXX=$CXX" --env="DEBIAN_FRONTEND=$DEBIAN_FRONTEND" \
  71. --env=GCC_COLORS=\ \
  72. $DOCKER)
  73. docker exec --tty "$containerid" sh -c 'for s in 0 15; do sleep $s; apt-get update && apt-get -qy dist-upgrade && break; done'
  74. export SCRIPT_RUN_PREFIX="docker exec --tty $containerid"
  75. else
  76. if [ "$TRAVIS_OS_NAME" = "linux" ]; then
  77. pip install --user --upgrade pip virtualenv
  78. virtualenv -p python$PYTHON venv
  79. elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
  80. if [ "$PY" = "3" ]; then
  81. brew update; brew install python$PY;
  82. else
  83. curl -fsSL -O https://bootstrap.pypa.io/get-pip.py
  84. sudo -H python get-pip.py
  85. fi
  86. pip$PY install --user --upgrade pip virtualenv
  87. python$PY -m virtualenv venv
  88. fi
  89. source venv/bin/activate
  90. fi
  91. install:
  92. - |
  93. # Install dependencies
  94. if [ -n "$DOCKER" ]; then
  95. docker exec --tty "$containerid" sh -c "for s in 0 15; do sleep \$s; apt-get -qy --no-install-recommends install \
  96. python$PYTHON-dev python$PY-pytest python$PY-scipy \
  97. libeigen3-dev cmake make g++ && break; done"
  98. else
  99. pip install numpy scipy pytest
  100. wget -q -O eigen.tar.gz https://bitbucket.org/eigen/eigen/get/3.3.0.tar.gz
  101. tar xzf eigen.tar.gz
  102. export CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DCMAKE_INCLUDE_PATH=$PWD/eigen-eigen-26667be4f70b"
  103. fi
  104. script:
  105. - $SCRIPT_RUN_PREFIX cmake ${CMAKE_EXTRA_ARGS}
  106. -DPYBIND11_PYTHON_VERSION=$PYTHON
  107. -DPYBIND11_CPP_STANDARD=$CPP
  108. -DPYBIND11_WERROR=ON
  109. - $SCRIPT_RUN_PREFIX make pytest -j 2
  110. after_script:
  111. - if [ -n "$DOCKER" ]; then docker stop "$containerid"; docker rm "$containerid"; fi