Skip to content

Commit 3298bad

Browse files
authored
Merge pull request #294 from dohmatob/fix-ci
OK, build matrix is green. Merging :)
2 parents aa7766b + dd366cb commit 3298bad

File tree

2 files changed

+106
-25
lines changed

2 files changed

+106
-25
lines changed

.travis.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,38 @@
11
sudo: required
2+
# dist: xenial
3+
24

35
language: python
46

5-
env:
6-
matrix:
7-
- DISTRIB="neurodebian" COVERAGE="true"
8-
- DISTRIB="conda" PYTHON_VERSION="3.5" NUMPY_VERSION="*" SCIPY_VERSION="*"
9-
SCIKIT_LEARN_VERSION="*" PANDAS_VERSION="*" MATPLOTLIB_VERSION="*"
10-
NETWORKX_VERSION="*"
7+
matrix:
8+
# Do not wait for the allowed_failures entry to finish before
9+
# setting the status
10+
fast_finish: true
11+
allow_failures:
12+
# allow_failures seems to be keyed on the python version
13+
- python: 2.7
14+
include:
15+
# Oldest supported versions (with neurodebian)
16+
- env: DISTRIB="conda" PYTHON_VERSION="2.7"
17+
NUMPY_VERSION="1.8.2" SCIPY_VERSION="0.14"
18+
SCIKIT_LEARN_VERSION="0.15.1" MATPLOTLIB_VERSION="1.3.1"
19+
PANDAS_VERSION="0.13.0" NIBABEL_VERSION="2.0.2" COVERAGE="true"
20+
NIPYPE_VERSION="0.13.0"
21+
NILEARN_VERSION="0.4.0"
22+
NETWORKX_VERSION="*"
23+
CONFIGOBJ_VERSION="*"
24+
# Most recent versions
25+
- env: DISTRIB="conda" PYTHON_VERSION="3.5"
26+
NUMPY_VERSION="*" SCIPY_VERSION="*" PANDAS_VERSION="*"
27+
SCIKIT_LEARN_VERSION="*" MATPLOTLIB_VERSION="*" COVERAGE="true"
28+
NIPYPE_VERSION="0.13.0"
29+
NILEARN_VERSION="0.4.0"
30+
NETWORKX_VERSION="*"
31+
CONFIGOBJ_VERSION="*"
32+
# FLAKE8 linting on diff wrt common ancestor with upstream/master
33+
# Note: the python value is only there to trigger allow_failures
34+
- python: 2.7
35+
env: DISTRIB="conda" PYTHON_VERSION="2.7" FLAKE8_VERSION="*" SKIP_TESTS="true"
1136

1237
virtualenv:
1338
system_site_packages: true

continuous_integration/install.sh

Lines changed: 75 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,41 @@
1+
#!/bin/bash
2+
# This script is meant to be called by the "install" step defined in
3+
# .travis.yml. See http://docs.travis-ci.com/ for more details.
4+
# The behavior of the script is controlled by environment variabled defined
5+
# in the .travis.yml in the top level folder of the project.
6+
#
7+
# This script is adapted from a similar script from the scikit-learn repository.
8+
#
9+
# License: 3-clause BSD
10+
111
set -e
212

3-
NIPYPE_VERSION=0.13.0
13+
# Fix the compilers to workaround avoid having the Python 3.4 build
14+
# lookup for g++44 unexpectedly.
15+
export CC=gcc
16+
export CXX=g++
17+
18+
create_new_venv() {
19+
# At the time of writing numpy 1.9.1 is included in the travis
20+
# virtualenv but we want to be in control of the numpy version
21+
# we are using for example through apt-get install
22+
deactivate
23+
virtualenv --system-site-packages testvenv
24+
source testvenv/bin/activate
25+
pip install nose
26+
}
427

528
print_conda_requirements() {
629
# Echo a conda requirement string for example
7-
# "pip python=2.7.3 scikit-learn=*". It has a hardcoded
30+
# "pip nose python='2.7.3 scikit-learn=*". It has a hardcoded
831
# list of possible packages to install and looks at _VERSION
932
# environment variables to know whether to install a given package and
1033
# if yes which version to install. For example:
1134
# - for numpy, NUMPY_VERSION is used
1235
# - for scikit-learn, SCIKIT_LEARN_VERSION is used
1336
TO_INSTALL_ALWAYS="pip nose"
1437
REQUIREMENTS="$TO_INSTALL_ALWAYS"
15-
TO_INSTALL_MAYBE="python numpy scipy scikit-learn pandas matplotlib networkx flake8"
38+
TO_INSTALL_MAYBE="python numpy scipy matplotlib scikit-learn pandas flake8 networkx configobj"
1639
for PACKAGE in $TO_INSTALL_MAYBE; do
1740
# Capitalize package name and add _VERSION
1841
PACKAGE_VERSION_VARNAME="${PACKAGE^^}_VERSION"
@@ -29,43 +52,76 @@ print_conda_requirements() {
2952
}
3053

3154
create_new_conda_env() {
32-
# Deactivate the travis-provided virtual environment and setup a
33-
# conda-based environment instead
34-
deactivate
55+
# Skip Travis related code on circle ci.
56+
if [ -z $CIRCLECI ]; then
57+
# Deactivate the travis-provided virtual environment and setup a
58+
# conda-based environment instead
59+
deactivate
60+
fi
3561

3662
# Use the miniconda installer for faster download / install of conda
3763
# itself
3864
wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh \
39-
-O miniconda.sh
40-
chmod +x miniconda.sh && ./miniconda.sh -b
41-
export PATH=/home/travis/miniconda2/bin:$PATH
42-
conda update --yes conda
65+
-O ~/miniconda.sh
66+
chmod +x ~/miniconda.sh && ~/miniconda.sh -b
67+
export PATH=$HOME/miniconda2/bin:$PATH
68+
echo $PATH
69+
conda update --quiet --yes conda
4370

4471
# Configure the conda environment and put it in the path using the
4572
# provided versions
4673
REQUIREMENTS=$(print_conda_requirements)
4774
echo "conda requirements string: $REQUIREMENTS"
48-
conda create -n testenv --yes $REQUIREMENTS
75+
conda create -n testenv --quiet --yes $REQUIREMENTS
4976
source activate testenv
77+
78+
if [[ "$INSTALL_MKL" == "true" ]]; then
79+
# Make sure that MKL is used
80+
conda install --quiet --yes mkl
81+
elif [[ -z $CIRCLECI ]]; then
82+
# Travis doesn't use MKL but circle ci does for speeding up examples
83+
# generation in the html documentation.
84+
# Make sure that MKL is not used
85+
conda remove --yes --features mkl || echo "MKL not installed"
86+
fi
5087
}
5188

5289
if [[ "$DISTRIB" == "neurodebian" ]]; then
90+
create_new_venv
91+
pip install nose-timer
5392
bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh)
54-
sudo apt-get install -qq python-scipy python-nose python-nibabel python-sklearn python-pandas python-networkx python-nipype
55-
sudo apt-get install -qq python-pip
56-
pip install "nilearn>=0.1.3"
93+
sudo apt-get install -qq python-scipy python-nose python-nibabel python-sklearn
94+
5795
elif [[ "$DISTRIB" == "conda" ]]; then
5896
create_new_conda_env
97+
pip install nose-timer
98+
# Note: nibabel is in setup.py install_requires so nibabel will
99+
# always be installed eventually. Defining NIBABEL_VERSION is only
100+
# useful if you happen to want a specific nibabel version rather
101+
# than the latest available one.
102+
if [ -n "$NIBABEL_VERSION" ]; then
103+
pip install nibabel=="$NIBABEL_VERSION"
104+
fi
105+
if [ -n "$NIPYPE_VERSION" ]; then
106+
pip install nipype=="$NIPYPE_VERSION"
107+
fi
108+
if [ -n "$NILEARN_VERSION" ]; then
109+
pip install nilearn=="$NILEARN_VERSION"
110+
fi
59111

60-
# dependencies that are only available through pip
61-
pip install nilearn>=0.1.3 nipype==${NIPYPE_VERSION} configobj
62112
else
63-
echo "Unknown distrib: $DISTRIB"
113+
echo "Unrecognized distribution ($DISTRIB); cannot setup CI environment."
64114
exit 1
65115
fi
66116

67-
python setup.py install
117+
pip install psutil memory_profiler
68118

69119
if [[ "$COVERAGE" == "true" ]]; then
70-
pip install coverage coveralls
120+
pip install codecov
121+
fi
122+
123+
# numpy not installed when skipping the tests so we do not want to run
124+
# setup.py install
125+
if [[ "$SKIP_TESTS" != "true" ]]; then
126+
python setup.py install
71127
fi

0 commit comments

Comments
 (0)