mirror of https://github.com/Qiskit/qiskit.git
179 lines
5.3 KiB
YAML
179 lines
5.3 KiB
YAML
# This code is part of Qiskit.
|
|
#
|
|
# (C) Copyright IBM 2017.
|
|
#
|
|
# This code is licensed under the Apache License, Version 2.0. You may
|
|
# obtain a copy of this license in the LICENSE.txt file in the root directory
|
|
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
|
|
#
|
|
# Any modifications or derivative works of this code must retain this
|
|
# copyright notice, and modified files need to carry a notice indicating
|
|
# that they have been altered from the originals.
|
|
|
|
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_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 -c constraints.txt
|
|
- pip install -e .
|
|
- pip install "qiskit-ibmq-provider" -c constraints.txt
|
|
script:
|
|
# Compile the executables and run the tests.
|
|
- python setup.py build_ext --inplace
|
|
- make test_ci
|
|
after_failure:
|
|
- python tools/report_ci_failure.py
|
|
|
|
stage_linux: &stage_linux
|
|
<<: *stage_generic
|
|
os: linux
|
|
dist: trusty
|
|
language: python
|
|
python: 3.5
|
|
|
|
stage_osx: &stage_osx
|
|
<<: *stage_generic
|
|
os: osx
|
|
osx_image: xcode9.2
|
|
language: generic
|
|
cache:
|
|
pip: true
|
|
directories:
|
|
- ~/python-interpreters/
|
|
before_install:
|
|
# Travis does not provide support for Python 3 under osx - it needs to be
|
|
# installed manually.
|
|
|
|
|
if [ ${TRAVIS_OS_NAME} = "osx" ]; then
|
|
if [[ ! -d ~/python-interpreters/$PYTHON_VERSION ]]; then
|
|
git clone git://github.com/pyenv/pyenv.git
|
|
cd pyenv/plugins/python-build
|
|
./install.sh
|
|
cd ../../..
|
|
python-build $PYTHON_VERSION ~/python-interpreters/$PYTHON_VERSION
|
|
fi
|
|
virtualenv --python ~/python-interpreters/$PYTHON_VERSION/bin/python venv
|
|
source venv/bin/activate
|
|
fi
|
|
|
|
|
|
###############################################################################
|
|
# Stage-related definitions
|
|
###############################################################################
|
|
|
|
# Define the order of the stages.
|
|
stages:
|
|
- lint and pure python test
|
|
- test
|
|
|
|
# Define the job matrix explicitly, as matrix expansion causes issues when
|
|
# using it with stages and some variables/sections cannot be overridden.
|
|
jobs:
|
|
include:
|
|
# Wheel builds
|
|
- sudo: required
|
|
services:
|
|
- docker
|
|
env:
|
|
- CIBW_BEFORE_BUILD="pip install -U Cython"
|
|
- CIBW_SKIP="cp27-* cp34-*"
|
|
- TWINE_REPOSITORY_URL=https://test.pypi.org/legacy/
|
|
- TWINE_USERNAME=qiskit
|
|
- CIBW_TEST_COMMAND="python3 {project}/examples/python/stochastic_swap.py"
|
|
if: tag IS present
|
|
script:
|
|
- sudo pip install cibuildwheel==0.10.1
|
|
- cibuildwheel --output-dir wheelhouse
|
|
- twine upload wheelhouse/*
|
|
- os: osx
|
|
language: generic
|
|
if: tag IS present
|
|
env:
|
|
- CIBW_BEFORE_BUILD="pip install -U Cython"
|
|
- CIBW_SKIP="cp27-* cp34-*"
|
|
- TWINE_REPOSITORY_URL=https://test.pypi.org/legacy/
|
|
- TWINE_USERNAME=qiskit
|
|
- CIBW_TEST_COMMAND="python3 {project}/examples/python/stochastic_swap.py"
|
|
script:
|
|
- sudo pip2 install cibuildwheel==0.10.1
|
|
- cibuildwheel --output-dir wheelhouse
|
|
- twine upload wheelhouse/*
|
|
|
|
# "lint and and pure python test" stage
|
|
###########################################################################
|
|
# Linter and style check (GNU/Linux, Python 3.5)
|
|
- stage: lint and pure python test
|
|
name: Python Style and Linter
|
|
<<: *stage_linux
|
|
script: make style && make lint
|
|
|
|
# Run the tests against without compilation (GNU/Linux, Python 3.5)
|
|
- stage: lint and pure python test
|
|
name: Python 3.5 Tests Linux
|
|
<<: *stage_linux
|
|
|
|
# "test" stage
|
|
###########################################################################
|
|
|
|
# GNU/Linux, Python 3.6
|
|
- stage: test
|
|
name: Python 3.6 Tests Linux
|
|
<<: *stage_linux
|
|
python: 3.6
|
|
|
|
# GNU/Linux, Python 3.7
|
|
- stage: test
|
|
name: Python 3.7 Tests Linux
|
|
<<: *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.5.6 (via pyenv)
|
|
- stage: test
|
|
<<: *stage_osx
|
|
name: Python 3.5 Tests OSX
|
|
env:
|
|
- MPLBACKEND=ps
|
|
- PYTHON_VERSION=3.5.6
|
|
|
|
# OSX, Python 3.6.5 (via pyenv)
|
|
- stage: test
|
|
name: Python 3.6 Tests OSX
|
|
<<: *stage_osx
|
|
env:
|
|
- MPLBACKEND=ps
|
|
- PYTHON_VERSION=3.6.5
|
|
|
|
# OSX, Python 3.7.2 (via pyenv)
|
|
- stage: test
|
|
name: Python 3.7 Tests OSX
|
|
<<: *stage_osx
|
|
env:
|
|
- MPLBACKEND=ps
|
|
- PYTHON_VERSION=3.7.2
|