qiskit/.travis.yml

202 lines
6.6 KiB
YAML

# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
notifications:
email: false
cache: pip
sudo: false
###############################################################################
# Anchored and aliased definitions.
###############################################################################
# These are used for avoiding repeating code, and due to problems with
# overriding some keys (in particular, "os" and "language: ptyhon") when using
# the standard travis matrix with stages.
#
# This allows re-using different "sets" of configurations in the stages
# matrix, mimicking a hierarchy:
# * stage_generic
# * stage_linux
# * stage_linux_no_compile
# * stage_osx
stage_generic: &stage_generic
install:
# Install step for jobs that require compilation and qa.
- pip install -U -r requirements.txt
- pip install -U -r requirements-dev.txt
# Create the basic cmake structure, setting out/ as the default dir.
- mkdir out && cd out && cmake $CMAKE_FLAGS ..
script:
# Compile the executables and run the tests.
- make && ARGS="-V" make test
stage_linux: &stage_linux
<<: *stage_generic
os: linux
dist: trusty
language: python
python: 3.5
env: CMAKE_FLAGS="-D CMAKE_CXX_COMPILER=g++-5 -D ENABLE_TARGETS_QA=False -D WHEEL_TAG=-pmanylinux1_x86_64 -D STATIC_LINKING=True"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- liblapack-dev
- libblas-dev
- g++-5
stage_osx: &stage_osx
<<: *stage_generic
os: osx
osx_image: xcode9.2
language: generic
env: CMAKE_FLAGS="-D CMAKE_CXX_COMPILER=g++-6 -D ENABLE_TARGETS_QA=False -D STATIC_LINKING=True"
before_install:
# Travis does not provide support for Python 3 under osx - it needs to be
# installed manually.
|
if [ ${TRAVIS_OS_NAME} = "osx" ]; then
brew install gcc@6
brew link --overwrite gcc@6
brew upgrade pyenv
pyenv install 3.6.5
virtualenv --python ~/.pyenv/versions/3.6.5/bin/python venv
source venv/bin/activate
fi
stage_osx_python3_7: &stage_osx_python3_7
<<: *stage_osx
before_install:
# Last line drops cmake from the list of requirements since it is not
# installable in Python 3.7 but it is not strictly necessary for building.
|
if [ ${TRAVIS_OS_NAME} = "osx" ]; then
brew install gcc@6
brew link --overwrite gcc@6
brew upgrade pyenv
brew install freetype
brew install pkg-config
pyenv install 3.7.0
virtualenv --python ~/.pyenv/versions/3.7.0/bin/python venv
source venv/bin/activate
fi
stage_linux_no_compile: &stage_linux_no_compile
<<: *stage_linux
addons: false
env: CMAKE_FLAGS="-D ENABLE_TARGETS_NON_PYTHON=False"
# Other aliases: for convenience, keeping the "jobs" matrix defined later on
# less verbose.
deploy_ghpages: &deploy_ghpages
provider: script
skip_cleanup: true
script: tools/ghpages_documentation_deploy.sh
on:
branch: stable
deploy_pypi: &deploy_pypi
provider: pypi
skip_cleanup: true
user: "diegoplan9"
password:
secure: "QIhEDs+gec0XvmJnzO2USLOz6I0eGKKcjqFtFYDdw1tbFby8OpnVviT7mJLrBx5qTWeR2RfiiEkm9v+HmevZQEdhOZg2A9w98bHLdWh2sYfjSJgvorNUjXgxba+mvsov9nixTf/k2RK8K7IvY1nbAuAwmS3uSXUBNvbyj0MhwUactPCcjwX9QCjCGrhVeZ1IlwoHPhOG7+zBPJ99ws6g0UBwhszotKN+3yTSgNU/PhW7jG3bjpKOso/CKg7Nv+UIdO8IljbcoJpLNZC/SC9XyHEjd8i4MKNi+tDFdguHk5b54Qobx2x0UaisrIrrNVfGZQliel5DU3eYs2kUPjVetmByO7sK8mXXj5HvIFv9t+XDkQVb1Y9D5CcU+DiKQGl0chWP+ZJu5uzxGClzm8MPO2ChGSKoFbYx95QFSiLc3gKjd6Z6lM4e3HYjMQ4ANt7Hjrez9mHbmbZnElKsg2vJS3gttglxEq5rlZg3Xm/6rRQfcbn93JHG29vLKAe+FjHCs9aG1l+MHn9eRgLbEz2JvMowHU7Tua0YM54J59ERZu1008FCvA2UR6k3sF+htnRiXDmbj/777cGcqv8ckm+OXKSB1ujGRbekkHgR9pf7HNUXPsZ3bwuHyio3mPikFQqU6m3Lm1esTQWrA5QoFuImyXQxDcSFeEx3/bFPkJfMOSw="
server: "https://test.pypi.org/legacy/"
distributions: "sdist bdist_wheel"
on:
branch: stable
condition: '$TRAVIS_COMMIT_MESSAGE == "pip release: "*'
###############################################################################
# Stage-related definitions
###############################################################################
# Define the order of the stages.
stages:
- lint and pure python test
- test
- deploy doc and pypi
# Define the job matrix explicitly, as matrix expansion causes issues when
# using it with stages and some variables/sections cannot be overridden.
jobs:
include:
# "lint and and pure python test" stage
###########################################################################
# Linter and style check (GNU/Linux, Python 3.5)
- stage: lint and pure python test
<<: *stage_linux_no_compile
script: make style VERBOSE="" && make lint VERBOSE=""
# Run the tests against without compilation (GNU/Linux, Python 3.5)
- stage: lint and pure python test
<<: *stage_linux_no_compile
# "test" stage
###########################################################################
# GNU/Linux, Python 3.5
- stage: test
<<: *stage_linux
# GNU/Linux, Python 3.6
- stage: test
<<: *stage_linux
python: 3.6
# GNU/Linux, Python 3.7
- stage: test
<<: *stage_linux
# Compiling Python 3.7 requires an Ubuntu Xenial distribution
# and sudo set to true
# Fix when this is solved:
# https://github.com/travis-ci/travis-ci/issues/9815
dist: xenial
python: 3.7
sudo: true
# OSX, Python 3.6.5 (via pyenv)
- stage: test
<<: *stage_osx
# OSX, Python 3.7 (via pyenv)
- stage: test
<<: *stage_osx_python3_7
# "deploy" stage.
###########################################################################
# github pages documentation update (GNU/Linux, Python 3.5)
- stage: deploy doc and pypi
<<: *stage_linux_no_compile
if: branch = stable and repo = Qiskit/qiskit-terra and type = push
script: cd ..
deploy:
<<: *deploy_ghpages
# GNU/Linux, Python 3.5
- stage: deploy doc and pypi
<<: *stage_linux
if: branch = stable and repo = Qiskit/qiskit-terra and type = push
install: mkdir out && cd out && cmake $CMAKE_FLAGS ..
script: cd ..
deploy:
<<: *deploy_pypi
# OSX, Python 3.latest (brew does not support versions)
- stage: deploy doc and pypi
<<: *stage_osx
if: branch = stable and repo = Qiskit/qiskit-terra and type = push
install: mkdir out && cd out && cmake $CMAKE_FLAGS ..
script: cd ..
deploy:
<<: *deploy_pypi
distributions: "bdist_wheel"