Skip to content

Commit

Permalink
MAINT try build settings based on scikit-learn-contrib
Browse files Browse the repository at this point in the history
  • Loading branch information
mfeurer committed Mar 22, 2016
1 parent 1c71951 commit 966c419
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 30 deletions.
50 changes: 20 additions & 30 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,39 @@ cache:

sudo: false

before_cache:
- rm -f $HOME/.cache/pip/log/debug.log
cache:
apt: true
# We use three different cache directory
# to work around a Travis bug with multi-platform cache
directories:
- $HOME/.cache/pip
- $HOME/download

# command to install dependencies
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libatlas-dev
- liblapack-dev
- libatlas-base-dev
- gfortran
packages:
- gcc-4.8
- g++-4.8

env:
global:
# Directory where tests are run from
- TEST_DIR=/tmp/test_dir/
- MODULE=autosklearn
matrix:
- DISTRIB="conda" PYTHON_VERSION="2.7" NUMPY_VERSION="1.9.2" SCIPY_VERSION="0.15.1" CYTHON_VERSION="0.21"
- DISTRIB="conda" PYTHON_VERSION="3.4" COVERAGE="true" NUMPY_VERSION="1.9.2" SCIPY_VERSION="0.15.1" CYTHON_VERSION="0.23.4"

before_install:
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- conda update --yes conda

install:
- export CXX="g++-4.8" CC="gcc-4.8"
- conda install --yes python=$TRAVIS_PYTHON_VERSION pip numpy=1.9.2 scipy=0.15.1 nose scikit-learn=0.16.1 Cython pandas
- pip install mock --no-deps
- pip install lockfile==0.10.2 --no-deps
- pip install pep8 python-coveralls
- pip install coverage
- pip install psutil

# Install requirements from other repos
- pip install git+https://github.com/automl/HPOlibConfigSpace@refactor
- pip install git+https://github.com/sfalkner/pynisher@master
- pip install git+https://bitbucket.org/aadfreiburg/random_forest_run@master
- pip install git+https://bitbucket.org/aadfreiburg/smac3@development

- python setup.py install

# command to run tests, e.g. python setup.py test
script:
# - coverage run --source autosklearn setup.py test
- cd test && nosetests -v --with-coverage --cover-package=autosklearn

after_success: coveralls
install: source ci_scripts/install.sh
script: bash ci_scripts/test.sh
after_success: source ci_scripts/success.sh

39 changes: 39 additions & 0 deletions ci_scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Deactivate the travis-provided virtual environment and setup a
# conda-based environment instead
deactivate

# Use the miniconda installer for faster download / install of conda
# itself
pushd .
cd
mkdir -p download
cd download
echo "Cached in $HOME/download :"
ls -l
echo
if [[ ! -f miniconda.sh ]]
then
wget http://repo.continuum.io/miniconda/Miniconda-3.6.0-Linux-x86_64.sh \
-O miniconda.sh
fi
chmod +x miniconda.sh && ./miniconda.sh -b
cd ..
export PATH=/home/travis/miniconda/bin:$PATH
conda update --yes conda
popd

# Configure the conda environment and put it in the path using the
# provided versions
conda create -n testenv --yes python=$PYTHON_VERSION pip nose \
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION cython=$CYTHON_VERSION matplotlib
source activate testenv
pip install -r requ.txt

if [[ "$COVERAGE" == "true" ]]; then
pip install coverage coveralls
fi

python --version
python -c "import numpy; print('numpy %s' % numpy.__version__)"
python -c "import scipy; print('scipy %s' % scipy.__version__)"
python setup.py develop
48 changes: 48 additions & 0 deletions ci_scripts/push_doc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
# This script is meant to be called in the "deploy" step defined in
# circle.yml. See https://circleci.com/docs/ for more details.
# The behavior of the script is controlled by environment variable defined
# in the circle.yml in the top level folder of the project.

MSG="Pushing the docs for revision for branch: $CIRCLE_BRANCH, commit $CIRCLE_SHA1"

cd $HOME
# Copy the build docs to a temporary folder
rm -rf tmp
mkdir tmp
cp -R $HOME/$DOC_REPO/doc/build/html/* ./tmp/

# Clone the docs repo if it isnt already there
if [ ! -d $DOC_REPO ];
then git clone "[email protected]:$USERNAME/"$DOC_REPO".git";
fi

cd $DOC_REPO
git branch gh-pages
git checkout -f gh-pages
git reset --hard origin/gh-pages
git clean -dfx

for name in $(ls -A $HOME/$DOC_REPO); do
case $name in
.nojekyll) # So that github does not build this as a Jekyll website.
;;
circle.yml) # Config so that build gh-pages branch.
;;
*)
git rm -rf $name
;;
esac
done

# Copy the new build docs
mkdir $DOC_URL
cp -R $HOME/tmp/* ./$DOC_URL/

git config --global user.email $EMAIL
git config --global user.name $USERNAME
git add -f ./$DOC_URL/
git commit -m "$MSG"
git push -f origin gh-pages

echo $MSG
13 changes: 13 additions & 0 deletions ci_scripts/success.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
set -e

if [[ "$COVERAGE" == "true" ]]; then
# Need to run coveralls from a git checkout, so we copy .coverage
# from TEST_DIR where nosetests has been run
cp $TEST_DIR/.coverage $TRAVIS_BUILD_DIR
cd $TRAVIS_BUILD_DIR
# Ignore coveralls failures as the coveralls server is not
# very reliable but we don't want travis to report a failure
# in the github UI just because the coverage report failed to
# be published.
coveralls || echo "Coveralls upload failed"
fi
16 changes: 16 additions & 0 deletions ci_scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set -e

# Get into a temp directory to run test from the installed scikit learn and
# check if we do not leave artifacts
mkdir -p $TEST_DIR

cwd=`pwd`
test_dir=$cwd/tests

cd $TEST_DIR

if [[ "$COVERAGE" == "true" ]]; then
nosetests -sv --with-coverage --cover-package=$MODULE $test_dir
else
nosetests -sv $test_dir
fi
57 changes: 57 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
machine:
environment:
# The github organization or username of the repository which hosts the
# project and documentation.
USERNAME: "automl"

# The repository where the documentation will be hosted
DOC_REPO: "auto-sklearn"

# The base URL for the Github page where the documentation will be hosted
DOC_URL: ""

# The email is to be used for commits in the Github Page
EMAIL: "[email protected]"

dependencies:

# Various dependencies
pre:
- sudo -E apt-get -yq remove texlive-binaries --purge
- sudo apt-get update
- sudo apt-get install libatlas-dev libatlas3gf-base
- sudo apt-get install build-essential python-dev python-setuptools
# install numpy first as it is a compile time dependency for other packages
- pip install --upgrade numpy
# install documentation building dependencies
- pip install --upgrade matplotlib setuptools nose coverage sphinx pillow sphinx-gallery sphinx_bootstrap_theme cython numpydoc
# Installing required packages for `make -C doc check command` to work.
- sudo -E apt-get -yq update
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install dvipng texlive-latex-base texlive-latex-extra
# finally install the requirements of the package to allow autodoc
- pip install -r requirements.txt

# The --user is needed to let sphinx see the source and the binaries
# The pipefail is requested to propagate exit code
override:
- python setup.py clean
- python setup.py develop
- set -o pipefail && cd doc && make html 2>&1 | tee ~/log.txt
test:
# Grep error on the documentation
override:
- cat ~/log.txt && if grep -q "Traceback (most recent call last):" ~/log.txt; then false; else true; fi
deployment:
push:
branch: develop
commands:
- bash ci_scripts/push_doc.sh
general:
# Open the doc to the API
artifacts:
- "doc/_build/html"
- "~/log.txt"
# Restric the build to the branch master only
branches:
only:
- develop

0 comments on commit 966c419

Please sign in to comment.