mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-16 11:21:25 +08:00
Merge pull request #1293 from blink1073/streamline-travis
Streamline Travis-CI build
This commit is contained in:
+3
-23
@@ -23,38 +23,18 @@ python:
|
||||
- 3.4
|
||||
|
||||
before_install:
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
- export PYTHONWARNINGS="all"
|
||||
- export WHEELHOUSE="--no-index --find-links=http://travis-wheels.scikit-image.org/"
|
||||
- export TEST_ARGS="--exe --ignore-files=^_test -v --with-doctest --ignore-files=^setup.py$"
|
||||
- export PIP_DEFAULT_TIMEOUT=60
|
||||
- sudo apt-get update
|
||||
- source tools/travis_before_install.sh
|
||||
|
||||
- travis_retry tools/travis_setup.sh
|
||||
|
||||
- source ~/venv/bin/activate
|
||||
- which python
|
||||
- python --version
|
||||
- which python; python --version
|
||||
- python check_bento_build.py
|
||||
|
||||
- tools/header.py "Dependency versions"
|
||||
- tools/build_versions.py
|
||||
|
||||
|
||||
install:
|
||||
- python setup.py build_ext --inplace
|
||||
- python setup.py install
|
||||
|
||||
script:
|
||||
- tools/header.py "Run all tests with minimum dependencies"
|
||||
- nosetests $TEST_ARGS skimage
|
||||
|
||||
- tools/header.py "Pep8 and Flake tests"
|
||||
- flake8 --exit-zero --exclude=test_*,six.py skimage doc/examples viewer_examples
|
||||
|
||||
- travis_retry tools/travis_install_optional.sh
|
||||
- tools/travis_test.sh
|
||||
script: tools/travis_script.sh
|
||||
|
||||
after_success:
|
||||
- coveralls
|
||||
|
||||
@@ -9,6 +9,7 @@ print('*' * screen_width)
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
header = ' '.join(sys.argv[1:])
|
||||
header = header.replace('.', ' ')
|
||||
print('*', header.center(screen_width - 4), '*')
|
||||
print('*' * screen_width)
|
||||
|
||||
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
export WHEELHOUSE="--no-index --find-links=http://travis-wheels.scikit-image.org/"
|
||||
export COVERALLS_REPO_TOKEN=7LdFN9232ZbSY3oaXHbQIzLazrSf6w2pQ
|
||||
|
||||
|
||||
retry () {
|
||||
# https://gist.github.com/fungusakafungus/1026804
|
||||
local retry_max=3
|
||||
local count=$retry_max
|
||||
while [ $count -gt 0 ]; do
|
||||
"$@" && break
|
||||
count=$(($count - 1))
|
||||
sleep 1
|
||||
done
|
||||
|
||||
[ $count -eq 0 ] && {
|
||||
echo "Retry failed [$retry_max]: $@" >&2
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
# on Python 2.7, use the system versions of numpy, scipy, and matplotlib
|
||||
# and the minimum version of cython and networkx
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
virtualenv --system-site-packages ~/venv
|
||||
sudo apt-get install python-scipy python-matplotlib
|
||||
sed -i 's/cython>=/cython==/g' requirements.txt
|
||||
sed -i 's/networkx>=/networkx==/g' requirements.txt
|
||||
else
|
||||
virtualenv -p python --system-site-packages ~/venv
|
||||
fi
|
||||
|
||||
source ~/venv/bin/activate
|
||||
retry pip install wheel flake8 coveralls nose
|
||||
|
||||
# install system tk for matplotlib
|
||||
sudo apt-get install python-tk
|
||||
|
||||
|
||||
# on Python 3.2, use matplotlib 1.3.1
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 3.2 ]]; then
|
||||
sed -i 's/matplotlib>=*.*.*/matplotlib==1.3.1/g' requirements.txt
|
||||
fi
|
||||
|
||||
retry pip install $WHEELHOUSE -r requirements.txt
|
||||
|
||||
# clean up disk space
|
||||
sudo apt-get clean
|
||||
sudo rm -rf /tmp/*
|
||||
|
||||
|
||||
section () {
|
||||
echo -en "travis_fold:start:$1\r"
|
||||
tools/header.py $1
|
||||
}
|
||||
|
||||
section_end () {
|
||||
echo -en "travis_fold:end:$1\r"
|
||||
}
|
||||
|
||||
export -f section
|
||||
export -f section_end
|
||||
export -f retry
|
||||
|
||||
set +ex
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
tools/header.py "Install optional dependencies"
|
||||
|
||||
# Install Qt and then update the Matplotlib settings
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
sudo apt-get install -q python-qt4
|
||||
|
||||
# http://stackoverflow.com/a/9716100
|
||||
LIBS=( PyQt4 sip.so )
|
||||
|
||||
VAR=( $(which -a python$TRAVIS_PYTHON_VERSION) )
|
||||
|
||||
GET_PYTHON_LIB_CMD="from distutils.sysconfig import get_python_lib; print (get_python_lib())"
|
||||
LIB_VIRTUALENV_PATH=$(python -c "$GET_PYTHON_LIB_CMD")
|
||||
LIB_SYSTEM_PATH=$(${VAR[-1]} -c "$GET_PYTHON_LIB_CMD")
|
||||
|
||||
for LIB in ${LIBS[@]}
|
||||
do
|
||||
sudo ln -sf $LIB_SYSTEM_PATH/$LIB $LIB_VIRTUALENV_PATH/$LIB
|
||||
done
|
||||
|
||||
else
|
||||
sudo apt-get install -q libqt4-dev
|
||||
pip install -q PySide $WHEELHOUSE
|
||||
python ~/venv/bin/pyside_postinstall.py -install
|
||||
fi
|
||||
|
||||
# imread does NOT support py3.2
|
||||
if [[ $TRAVIS_PYTHON_VERSION != 3.2 ]]; then
|
||||
sudo apt-get install -q libtiff4-dev libwebp-dev libpng12-dev xcftools
|
||||
pip install -q imread
|
||||
fi
|
||||
|
||||
# Install SimpleITK from wheelhouse if available (not 3.2 or 3.4)
|
||||
if [[ $TRAVIS_PYTHON_VERSION =~ 3\.[24] ]]; then
|
||||
echo "SimpleITK unavailable on $TRAVIS_PYTHON_VERSION"
|
||||
else
|
||||
pip install -q SimpleITK $WHEELHOUSE
|
||||
fi
|
||||
|
||||
sudo apt-get install -q libfreeimage3
|
||||
pip install -q astropy $WHEELHOUSE
|
||||
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.* ]]; then
|
||||
pip install -q pyamg
|
||||
fi
|
||||
|
||||
pip install -q tifffile
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
- Use http://yaml-online-parser.appspot.com/ to make sure it is valid yaml.
|
||||
- Use http://yaml-online-parser.appspot.com/ to make sure
|
||||
the yaml file is valid.
|
||||
http://lint.travis-ci.org/ is recommended elsewhere but does not give helpful
|
||||
error reports.
|
||||
- Make sure all of your "-" lines start on the same column
|
||||
@@ -13,9 +14,11 @@
|
||||
set -ex
|
||||
```
|
||||
|
||||
- Use `travis_retry` before a command to have it try several times before
|
||||
failing (useful for installing from third party sources). Note that this
|
||||
command is not available within a bash script.
|
||||
- Use the `retry` bash function from `before_install.sh` before a command to have it try 3 times before
|
||||
failing (useful for installing from third party sources).
|
||||
- Use the `section` function to start a folded section of the script.
|
||||
Section names must have underscores or dots instead of spaces and must be
|
||||
accompanied by a corresponding `section_end` call.
|
||||
- Feel free to cancel a build rather than waiting for it to go to completion
|
||||
if you have made a change to that branch.
|
||||
- A VM with 64bit Ubuntu 12.04 is a huge help for debugging.
|
||||
Executable
+128
@@ -0,0 +1,128 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
section "Script.Setup"
|
||||
sh -e /etc/init.d/xvfb start
|
||||
export DISPLAY=:99.0
|
||||
PYTHONWARNINGS="all"
|
||||
TEST_ARGS="--exe --ignore-files=^_test -v --with-doctest --ignore-files=^setup.py$"
|
||||
section_end "Script.Setup"
|
||||
|
||||
|
||||
section "Test.with.min.requirements"
|
||||
nosetests $TEST_ARGS skimage
|
||||
section_end "Test.with.min.requirements"
|
||||
|
||||
|
||||
section "Flake8.test"
|
||||
flake8 --exit-zero --exclude=test_*,six.py skimage doc/examples viewer_examples
|
||||
section_end "Flake8.test"
|
||||
|
||||
|
||||
section "Install.optional.dependencies"
|
||||
|
||||
# Install Qt and then update the Matplotlib settings
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
sudo apt-get install -q python-qt4
|
||||
|
||||
# http://stackoverflow.com/a/9716100
|
||||
LIBS=( PyQt4 sip.so )
|
||||
|
||||
VAR=( $(which -a python$TRAVIS_PYTHON_VERSION) )
|
||||
|
||||
GET_PYTHON_LIB_CMD="from distutils.sysconfig import get_python_lib; print (get_python_lib())"
|
||||
LIB_VIRTUALENV_PATH=$(python -c "$GET_PYTHON_LIB_CMD")
|
||||
LIB_SYSTEM_PATH=$(${VAR[-1]} -c "$GET_PYTHON_LIB_CMD")
|
||||
|
||||
for LIB in ${LIBS[@]}
|
||||
do
|
||||
sudo ln -sf $LIB_SYSTEM_PATH/$LIB $LIB_VIRTUALENV_PATH/$LIB
|
||||
done
|
||||
|
||||
else
|
||||
sudo apt-get install -q libqt4-dev
|
||||
retry pip install -q PySide $WHEELHOUSE
|
||||
python ~/venv/bin/pyside_postinstall.py -install
|
||||
fi
|
||||
|
||||
# imread does NOT support py3.2
|
||||
if [[ $TRAVIS_PYTHON_VERSION != 3.2 ]]; then
|
||||
sudo apt-get install -q libtiff4-dev libwebp-dev libpng12-dev xcftools
|
||||
retry pip install -q imread
|
||||
fi
|
||||
|
||||
# Install SimpleITK from wheelhouse if available (not 3.2 or 3.4)
|
||||
if [[ $TRAVIS_PYTHON_VERSION =~ 3\.[24] ]]; then
|
||||
echo "SimpleITK unavailable on $TRAVIS_PYTHON_VERSION"
|
||||
else
|
||||
retry pip install -q SimpleITK $WHEELHOUSE
|
||||
fi
|
||||
|
||||
sudo apt-get install -q libfreeimage3
|
||||
retry pip install -q astropy $WHEELHOUSE
|
||||
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.* ]]; then
|
||||
retry pip install -q pyamg
|
||||
fi
|
||||
|
||||
retry pip install -q tifffile
|
||||
|
||||
section_end "Install.optional.dependencies"
|
||||
|
||||
|
||||
section "Run.doc.examples"
|
||||
|
||||
# Matplotlib settings - do not show figures during doc examples
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
MPL_DIR=$HOME/.matplotlib
|
||||
else
|
||||
MPL_DIR=$HOME/.config/matplotlib
|
||||
fi
|
||||
|
||||
mkdir -p $MPL_DIR
|
||||
touch $MPL_DIR/matplotlibrc
|
||||
echo 'backend : Template' > $MPL_DIR/matplotlibrc
|
||||
|
||||
|
||||
for f in doc/examples/*.py; do
|
||||
python "$f"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
section_end "Run.doc.examples"
|
||||
|
||||
|
||||
section "Run.doc.applications"
|
||||
|
||||
for f in doc/examples/applications/*.py; do
|
||||
python "$f"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Now configure Matplotlib to use Qt4
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
MPL_QT_API=PyQt4
|
||||
export QT_API=pyqt
|
||||
else
|
||||
MPL_QT_API=PySide
|
||||
export QT_API=pyside
|
||||
fi
|
||||
echo 'backend: Agg' > $MPL_DIR/matplotlibrc
|
||||
echo 'backend.qt4 : '$MPL_QT_API >> $MPL_DIR/matplotlibrc
|
||||
|
||||
section_end "Run.doc.applications"
|
||||
|
||||
|
||||
section "Test.with.optional.dependencies"
|
||||
|
||||
# run tests again with optional dependencies to get more coverage
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 3.3 ]]; then
|
||||
TEST_ARGS="$TEST_ARGS --with-cov --cover-package skimage"
|
||||
fi
|
||||
nosetests $TEST_ARGS
|
||||
|
||||
section_end "Test.with.optional.dependencies"
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
# on Python 2.7, use the system versions of numpy, scipy, and matplotlib
|
||||
# and the minimum version of cython and networkx
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
virtualenv -p python --system-site-packages ~/venv
|
||||
sudo apt-get install python-scipy python-matplotlib
|
||||
sed -i 's/cython>=/cython==/g' requirements.txt
|
||||
sed -i 's/networkx>=/networkx==/g' requirements.txt
|
||||
else
|
||||
virtualenv -p python --system-site-packages ~/venv
|
||||
fi
|
||||
|
||||
source ~/venv/bin/activate
|
||||
pip install wheel flake8 coveralls nose
|
||||
|
||||
# install system tk for matplotlib
|
||||
sudo apt-get install python-tk
|
||||
|
||||
|
||||
# on Python 3.2, use matplotlib 1.3.1
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
sed -i 's/matplotlib>=*.*.*/matplotlib==1.3.1/g' requirements.txt
|
||||
fi
|
||||
|
||||
pip install $WHEELHOUSE -r requirements.txt
|
||||
|
||||
# clean up disk space
|
||||
sudo apt-get clean
|
||||
sudo rm -r /tmp/*
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
|
||||
MPL_QT_API=PyQt4
|
||||
MPL_DIR=$HOME/.matplotlib
|
||||
export QT_API=pyqt
|
||||
|
||||
else
|
||||
MPL_QT_API=PySide
|
||||
MPL_DIR=$HOME/.config/matplotlib
|
||||
export QT_API=pyside
|
||||
fi
|
||||
|
||||
# Matplotlib settings - do not show figures during doc examples
|
||||
mkdir -p $MPL_DIR
|
||||
touch $MPL_DIR/matplotlibrc
|
||||
echo 'backend : Template' > $MPL_DIR/matplotlibrc
|
||||
|
||||
|
||||
tools/header.py "Run doc examples"
|
||||
for f in doc/examples/*.py; do
|
||||
python "$f"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
for f in doc/examples/applications/*.py; do
|
||||
python "$f"
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Now configure Matplotlib to use Qt4
|
||||
echo 'backend: Agg' > $MPL_DIR/matplotlibrc
|
||||
echo 'backend.qt4 : '$MPL_QT_API >> $MPL_DIR/matplotlibrc
|
||||
|
||||
|
||||
tools/header.py "Run tests with all dependencies"
|
||||
# run tests again with optional dependencies to get more coverage
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 3.3 ]]; then
|
||||
TEST_ARGS="$TEST_ARGS --with-cov --cover-package skimage"
|
||||
fi
|
||||
nosetests $TEST_ARGS
|
||||
|
||||
Reference in New Issue
Block a user