forked from Qiskit/qiskit-ibmq-provider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
244 lines (220 loc) · 6.32 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# 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 cython
- pip install -U -c constraints.txt -r requirements.txt
- pip install -U -c constraints.txt -r requirements-dev.txt
- pip install -c constraints.txt -e .
script:
# Run the tests.
- make test
stage_linux: &stage_linux
<<: *stage_generic
os: linux
language: python
python: 3.5
stage_osx: &stage_osx
<<: *stage_generic
os: osx
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 ~/.pyenv ]]; then
git clone git://github.com/pyenv/pyenv.git ~/.pyenv
fi
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
pyenv install -s $PYTHON_VERSION
pyenv local $PYTHON_VERSION
pip install --upgrade pip
pip install wheel setuptools
fi
stage_win: &stage_win
<<: *stage_generic
os: windows
language: shell
before_install:
# Travis does not provide support for Python 3 under windows - it needs to be
# installed manually.
|
export PATH="/c/Python${PYTHON_VERSION}:/c/Python${PYTHON_VERSION}/Scripts:${PATH}"
case $PYTHON_VERSION in
35)
choco install python --version 3.5.4
;;
36)
choco install python --version 3.6.5
;;
37)
choco install python --version 3.7.2
;;
*)
choco install python --version 3.8.1
;;
esac
python -m pip install --upgrade pip
script: python -m unittest -v
###############################################################################
# Stage-related definitions
###############################################################################
# Define the order of the stages.
stages:
- lint and pure python test
- test
- conditional tests
# 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
if: type != cron
python: 3.7
script: make style && make lint
# Type checking using mypy
- stage: lint and pure python test
name: mypy type checking
<<: *stage_linux
if: type != cron
script: make mypy
# Run the tests against without compilation (GNU/Linux, Python 3.5)
- stage: lint and pure python test
<<: *stage_linux
if: type != cron
# "test" stage
###########################################################################
# GNU/Linux, Python 3.6
- stage: test
<<: *stage_linux
if: type != cron
python: 3.6
# GNU/Linux, Python 3.7
- stage: test
<<: *stage_linux
if: type != cron
python: 3.7
# GNU/Linux, Python 3.8
- stage: test
<<: *stage_linux
if: type != cron
dist: xenial
python: 3.8
# OSX, Python 3.5.6 (via pyenv)
- stage: test
<<: *stage_osx
if: type != cron
env:
- MPLBACKEND=ps
- PYTHON_VERSION=3.5.6
# OSX, Python 3.6.5 (via pyenv)
- stage: test
<<: *stage_osx
if: type != cron
env:
- MPLBACKEND=ps
- PYTHON_VERSION=3.6.5
# OSX, Python 3.7.2 (via pyenv)
- stage: test
<<: *stage_osx
if: type != cron
env:
- MPLBACKEND=ps
- PYTHON_VERSION=3.7.2
# OSX, Python 3.8.0 (via pyenv)
- stage: test
<<: *stage_osx
if: type != cron
env:
- MPLBACKEND=ps
- PYTHON_VERSION=3.8.0
# Windows, Python 3.8
- stage: test
<<: *stage_win
if: type != cron
env:
- PYTHON_VERSION=38
# "conditional tests" stage
###########################################################################
# slow tests using Linux, Python 3.6
- stage: conditional tests
if: type = cron
<<: *stage_linux
python: 3.6
name: slow test
env:
- QISKIT_TESTS=run_slow
script:
- make test
# test with terra master, using GNU/Linux, Python 3.8
- if: type = cron
<<: *stage_linux
python: 3.8
name: with terra master
before_script: pip install -U git+https://github.com/Qiskit/qiskit-terra.git
env:
- QISKIT_TESTS=run_slow
script:
- make test
# additional Windows tests
# Windows, Python 3.7
- if: type = cron
<<: *stage_win
env:
- PYTHON_VERSION=37
# Windows, Python 3.6
- if: type = cron
<<: *stage_win
env:
- PYTHON_VERSION=36
# Windows, Python 3.5
- if: type = cron
<<: *stage_win
env:
- PYTHON_VERSION=35
- if: tag IS present
language: python
python: "3.6"
env:
- TWINE_USERNAME=qiskit
install: pip install -U twine
script:
- python3 setup.py sdist bdist_wheel
- twine upload dist/qiskit*