Skip to content

Commit

Permalink
Fix coveralls report sending
Browse files Browse the repository at this point in the history
* coveralls need to be run from a git checkout
* needs setup.cfg to be copied to the test folder in order to have
  nosetests running with the right arguments
* moved after_success step to a script on its own
* some clean-up in particular to have environment variable defined in
  .travis.yml as much as possible
  • Loading branch information
lesteve committed Dec 1, 2015
1 parent f63ac6e commit ba2e638
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 21 deletions.
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@ addons:
- python-scipy

env:
global:
# Directory where tests are run from
- TEST_DIR=/tmp/sklearn
matrix:
# This environment tests that scikit-learn can be built against
# versions of numpy, scipy with ATLAS that comes with Ubuntu Precise 12.04
- DISTRIB="ubuntu" PYTHON_VERSION="2.7" COVERAGE="true"
CYTHON_VERSION="0.23.4" NAME="ubuntu"
CYTHON_VERSION="0.23.4" CACHED_BUILD_DIR="$HOME/sklearn_build_ubuntu"
# This environment tests the oldest supported anaconda env
- DISTRIB="conda" PYTHON_VERSION="2.6" INSTALL_MKL="false"
NUMPY_VERSION="1.6.2" SCIPY_VERSION="0.11.0" CYTHON_VERSION="0.21"
NAME="oldest"
CACHED_BUILD_DIR="$HOME/sklearn_build_oldest"
# This environment tests the newest supported anaconda env
- DISTRIB="conda" PYTHON_VERSION="3.5" INSTALL_MKL="true"
NUMPY_VERSION="1.10.1" SCIPY_VERSION="0.16.0" CYTHON_VERSION="0.23.4"
NAME="latest"
CACHED_BUILD_DIR="$HOME/sklearn_build_latest"

install: source continuous_integration/install.sh
script: bash continuous_integration/test_script.sh
after_success:
# 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.
- if [[ "$COVERAGE" == "true" ]]; then coveralls || echo "failed"; fi
after_success: source continuous_integration/after_success.sh
notifications:
webhooks:
urls:
Expand Down
19 changes: 19 additions & 0 deletions continuous_integration/after_success.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# This script is meant to be called by the "after_success" step defined in
# .travis.yml. See http://docs.travis-ci.com/ for more details.

# License: 3-clause BSD

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
15 changes: 6 additions & 9 deletions continuous_integration/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,14 @@ if [[ "$COVERAGE" == "true" ]]; then
pip install coverage coveralls
fi

GIT_TRAVIS_REPO=$(pwd)
echo $GIT_TRAVIS_REPO

cd $HOME
if [ ! -d "sklearn_build_$NAME" ]; then
mkdir sklearn_build_$NAME
if [ ! -d "$CACHED_BUILD_DIR" ]; then
mkdir -p $CACHED_BUILD_DIR
fi

rsync -av --exclude='.git/' --exclude='testvenv/' $GIT_TRAVIS_REPO \
sklearn_build_${NAME}
cd sklearn_build_${NAME}/scikit-learn
rsync -av --exclude '.git/' --exclude='testvenv/' \
$TRAVIS_BUILD_DIR $CACHED_BUILD_DIR

cd $CACHED_BUILD_DIR/scikit-learn

# Build scikit-learn in the install.sh script to collapse the verbose
# build output in the travis output when it succeeds.
Expand Down
10 changes: 6 additions & 4 deletions continuous_integration/test_script.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ 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 /tmp/sklearn_tmp
cd /tmp/sklearn_tmp
mkdir -p $TEST_DIR
# We need the setup.cfg for the nose settings
cp setup.cfg $TEST_DIR
cd $TEST_DIR

python --version
python -c "import numpy; print('numpy %s' % numpy.__version__)"
Expand All @@ -29,8 +31,8 @@ else
fi

# Is directory still empty ?
ls
ls -ltra

# Test doc
cd $HOME/sklearn_build_$NAME/scikit-learn
cd $CACHED_BUILD_DIR/scikit-learn
make test-doc test-sphinxext

0 comments on commit ba2e638

Please sign in to comment.