diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..cf3e50ddee79e35e35443781e94047a3632a8600 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,77 @@ +# Travis configuration file using the build matrix feature +# Read more under http://docs.travis-ci.com/user/build-configuration/ +# THIS SCRIPT IS SUPPOSED TO BE AN EXAMPLE. MODIFY IT ACCORDING TO YOUR NEEDS! + +dist: bionic +sudo: false +language: python +virtualenv: + system_site_packages: false +addons: + apt: + update: true +matrix: + fast_finish: true + allow_failures: + - os: osx + - os: windows + include: + - python: 3.5 + env: DISTRIB="ubuntu" + before_install: + - sudo apt-get install -y ninja-build build-essential nvidia-cuda-toolkit + - python: 3.6 + before_install: + - sudo apt-get install -y ninja-build build-essential nvidia-cuda-toolkit + - python: 3.7 + before_install: + - sudo apt-get install -y ninja-build build-essential nvidia-cuda-toolkit + - python: 3.8 + before_install: + - sudo apt-get install -y ninja-build build-essential nvidia-cuda-toolkit + - name: "Conda" + env: DISTRIB="conda" PYTHON_VERSION="3.6" COVERAGE="false" LINT="false" + before_install: + - sudo apt-get install -y ninja-build build-essential nvidia-cuda-toolkit + - name: "Lint and documentation test" + env: DISTRIB="ubuntu" TOX_PYTHON_VERSION="py36" COVERAGE="false" LINT="true" + - name: "Python 3.7.2 on macOS" + os: osx + osx_image: xcode11 # Python 3.7.2 running on macOS 10.14.3 + language: shell # 'language: python' is an error on Travis CI macOS + before_install: + - brew update && brew upgrade python + - brew install ninja + - alias python=python3 + - alias pip="python3 -m pip" + - shopt -s expand_aliases + before_cache: + - brew cleanup + - name: "Python 3.7.3 on Windows" + os: windows # Windows 10.0.17134 N/A Build 17134 + language: shell # 'language: python' is an error on Travis CI Windows + before_install: + - choco install python + - python -m pip install --upgrade pip + env: PATH=/c/Python37:/c/Python37/Scripts:$PATH +install: + - source tests/travis_install.sh + - pip3 install -e . + - pip3 install torch || echo "failed to install machine learning stuff" +before_script: + - git config --global user.email "stephan.seitz@fau.de" + - git config --global user.name "Stephan Seitz" +script: + - export NO_GPU_EXECUTION=1 + #- if [[ "$LINT" == "true" ]]; then flake8 src;python setup.py doctest; exit 0; fi + +after_success: + - if [[ "$COVERAGE" == "true" ]]; then coveralls || echo "failed"; codecov; fi +after_script: + - travis-cleanup +cache: + pip: true + directories: + - $HOME/miniconda + - /c/Python37 + - $HOME/Library/Caches/Homebrew diff --git a/tests/install_travis.sh b/tests/install_travis.sh new file mode 100755 index 0000000000000000000000000000000000000000..0765fc1eb3aa14308ee2af808810aa63aef33c6d --- /dev/null +++ b/tests/install_travis.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# This script is meant to be called by the "install" step defined in +# .travis.yml. See http://docs.travis-ci.com/ for more details. +# The behavior of the script is controlled by environment variabled defined +# in the .travis.yml in the top level folder of the project. +# +# This script is inspired by Scikit-Learn (http://scikit-learn.org/) +# +# THIS SCRIPT IS SUPPOSED TO BE AN EXAMPLE. MODIFY IT ACCORDING TO YOUR NEEDS! + +set -e + +if [[ "$DISTRIB" == "conda" ]]; then + # Deactivate the travis-provided virtual environment and setup a + # conda-based environment instead + deactivate + + if [[ -f "$HOME/miniconda/bin/conda" ]]; then + echo "Skip install conda [cached]" + else + # By default, travis caching mechanism creates an empty dir in the + # beginning of the build, but conda installer aborts if it finds an + # existing folder, so let's just remove it: + rm -rf "$HOME/miniconda" + + # Use the miniconda installer for faster download / install of conda + # itself + wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \ + -O miniconda.sh + chmod +x miniconda.sh && ./miniconda.sh -b -p $HOME/miniconda + fi + export PATH=$HOME/miniconda/bin:$PATH + # Make sure to use the most updated version + conda update --yes conda + + # Configure the conda environment and put it in the path using the + # provided versions + # (prefer local venv, since the miniconda folder is cached) + conda create -p ./.venv --yes python=${PYTHON_VERSION} pip virtualenv + source activate ./.venv + alias pip3='python -m pip' + shopt -s expand_aliases +fi + +# for all +pip3 install -U pip wheel setuptools +pip3 install -U cppimport pybind11 +pip3 install tox +pip3 install codecov +pip3 install sphinx + +pip install flake8 + +if [[ "$COVERAGE" == "true" ]]; then + pip3 install -U pytest-cov pytest-virtualenv coverage coveralls flake8 +fi + + +travis-cleanup() { + printf "Cleaning up environments ... " # printf avoids new lines + if [[ "$DISTRIB" == "conda" ]]; then + # Force the env to be recreated next time, for build consistency + source deactivate + conda remove -p ./.venv --all --yes + rm -rf ./.venv + fi + echo "DONE" +} +