Skip to content

Commit 6f8c5c5

Browse files
authored
CI with conda to work around qutip install issue (#48)
1 parent 21c1563 commit 6f8c5c5

File tree

1 file changed

+40
-12
lines changed

1 file changed

+40
-12
lines changed

.travis.yml

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,51 @@ python:
99
- 3.7
1010
- 3.8
1111
env:
12-
- INSTALL_EXTRAS=[plotting,bloch_sphere_visualization,fancy_progressbar,doc,tests]
13-
- INSTALL_EXTRAS=[plotting,fancy_progressbar,tests]
14-
- INSTALL_EXTRAS=[tests]
15-
16-
#these directories are persistent
17-
cache: pip
18-
19-
#manually install these dependencies so that qutip can be installed via pip
12+
global:
13+
- INSTALL_DEPS="numpy scipy opt_einsum sparse tqdm"
14+
- INSTALL_TEST_DEPS="pytest>=4.6 pytest-cov codecov"
15+
- plotting="matplotlib"
16+
- fancy_progressbar="jupyter requests"
17+
- bloch_sphere_visualization="matplotlib qutip"
18+
jobs:
19+
- INSTALL_EXTRAS=[plotting,bloch_sphere_visualization,fancy_progressbar]
20+
- INSTALL_EXTRAS=[plotting,fancy_progressbar]
21+
- INSTALL_EXTRAS=[none]
22+
2023
before_install:
21-
- pip install --upgrade pip
22-
- pip install numpy scipy cython
24+
# Resolve INSTALL_EXTRAS into required packages for use with conda. HACKY
25+
- TMP=${INSTALL_EXTRAS//,/ $}
26+
- TMP=${TMP/[/$}
27+
- INSTALL_EXTRAS_PACKAGES=$(eval echo ${TMP%]})
28+
29+
# Useful info for debugging
30+
- echo $TRAVIS_PYTHON_VERSION
31+
- echo $INSTALL_DEPS
32+
- echo $INSTALL_TEST_DEPS
33+
- echo $INSTALL_EXTRAS
34+
- echo $INSTALL_EXTRAS_PACKAGES
35+
36+
# https://github.com/conda/conda/blob/master/docs/source/user-guide/tasks/use-conda-with-travis-ci.rst
37+
# We do this conditionally because it saves us some downloading if the
38+
# version is the same.
39+
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
40+
- bash miniconda.sh -b -u -p $HOME/miniconda
41+
- export PATH="$HOME/miniconda/bin:$PATH"
42+
- hash -r
43+
- conda config --set always_yes yes --set changeps1 no
44+
- conda config --append channels conda-forge
45+
- conda update -q conda
46+
# Useful for debugging any issues with conda
47+
- conda info -a
2348

49+
- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION $INSTALL_DEPS $INSTALL_TEST_DEPS $INSTALL_EXTRAS_PACKAGES
50+
- source activate test-environment
51+
2452
install:
25-
- pip install .$INSTALL_EXTRAS
53+
- pip install .
2654

2755
script:
28-
- pytest tests
56+
- pytest
2957

3058
after_success:
3159
- codecov

0 commit comments

Comments
 (0)