Skip to content

Commit 1680b05

Browse files
committed
Merge pull request scikit-learn#5925 from lesteve/fix-coveralls
[MRG+1] Fix for coveralls not sending coverage report
2 parents 34ebbd3 + ba2e638 commit 1680b05

File tree

4 files changed

+39
-21
lines changed

4 files changed

+39
-21
lines changed

.travis.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,26 @@ addons:
2222
- python-scipy
2323

2424
env:
25+
global:
26+
# Directory where tests are run from
27+
- TEST_DIR=/tmp/sklearn
2528
matrix:
2629
# This environment tests that scikit-learn can be built against
2730
# versions of numpy, scipy with ATLAS that comes with Ubuntu Precise 12.04
2831
- DISTRIB="ubuntu" PYTHON_VERSION="2.7" COVERAGE="true"
29-
CYTHON_VERSION="0.23.4" NAME="ubuntu"
32+
CYTHON_VERSION="0.23.4" CACHED_BUILD_DIR="$HOME/sklearn_build_ubuntu"
3033
# This environment tests the oldest supported anaconda env
3134
- DISTRIB="conda" PYTHON_VERSION="2.6" INSTALL_MKL="false"
3235
NUMPY_VERSION="1.6.2" SCIPY_VERSION="0.11.0" CYTHON_VERSION="0.21"
33-
NAME="oldest"
36+
CACHED_BUILD_DIR="$HOME/sklearn_build_oldest"
3437
# This environment tests the newest supported anaconda env
3538
- DISTRIB="conda" PYTHON_VERSION="3.5" INSTALL_MKL="true"
3639
NUMPY_VERSION="1.10.1" SCIPY_VERSION="0.16.0" CYTHON_VERSION="0.23.4"
37-
NAME="latest"
40+
CACHED_BUILD_DIR="$HOME/sklearn_build_latest"
41+
3842
install: source continuous_integration/install.sh
3943
script: bash continuous_integration/test_script.sh
40-
after_success:
41-
# Ignore coveralls failures as the coveralls server is not very reliable
42-
# but we don't want travis to report a failure in the github UI just
43-
# because the coverage report failed to be published.
44-
- if [[ "$COVERAGE" == "true" ]]; then coveralls || echo "failed"; fi
44+
after_success: source continuous_integration/after_success.sh
4545
notifications:
4646
webhooks:
4747
urls:
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
# This script is meant to be called by the "after_success" step defined in
3+
# .travis.yml. See http://docs.travis-ci.com/ for more details.
4+
5+
# License: 3-clause BSD
6+
7+
set -e
8+
9+
if [[ "$COVERAGE" == "true" ]]; then
10+
# Need to run coveralls from a git checkout, so we copy .coverage
11+
# from TEST_DIR where nosetests has been run
12+
cp $TEST_DIR/.coverage $TRAVIS_BUILD_DIR
13+
cd $TRAVIS_BUILD_DIR
14+
# Ignore coveralls failures as the coveralls server is not
15+
# very reliable but we don't want travis to report a failure
16+
# in the github UI just because the coverage report failed to
17+
# be published.
18+
coveralls || echo "Coveralls upload failed"
19+
fi

continuous_integration/install.sh

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,14 @@ if [[ "$COVERAGE" == "true" ]]; then
8383
pip install coverage coveralls
8484
fi
8585

86-
GIT_TRAVIS_REPO=$(pwd)
87-
echo $GIT_TRAVIS_REPO
88-
89-
cd $HOME
90-
if [ ! -d "sklearn_build_$NAME" ]; then
91-
mkdir sklearn_build_$NAME
86+
if [ ! -d "$CACHED_BUILD_DIR" ]; then
87+
mkdir -p $CACHED_BUILD_DIR
9288
fi
9389

94-
rsync -av --exclude='.git/' --exclude='testvenv/' $GIT_TRAVIS_REPO \
95-
sklearn_build_${NAME}
96-
cd sklearn_build_${NAME}/scikit-learn
90+
rsync -av --exclude '.git/' --exclude='testvenv/' \
91+
$TRAVIS_BUILD_DIR $CACHED_BUILD_DIR
92+
93+
cd $CACHED_BUILD_DIR/scikit-learn
9794

9895
# Build scikit-learn in the install.sh script to collapse the verbose
9996
# build output in the travis output when it succeeds.

continuous_integration/test_script.sh

100644100755
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ set -e
1010

1111
# Get into a temp directory to run test from the installed scikit learn and
1212
# check if we do not leave artifacts
13-
mkdir -p /tmp/sklearn_tmp
14-
cd /tmp/sklearn_tmp
13+
mkdir -p $TEST_DIR
14+
# We need the setup.cfg for the nose settings
15+
cp setup.cfg $TEST_DIR
16+
cd $TEST_DIR
1517

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

3133
# Is directory still empty ?
32-
ls
34+
ls -ltra
3335

3436
# Test doc
35-
cd $HOME/sklearn_build_$NAME/scikit-learn
37+
cd $CACHED_BUILD_DIR/scikit-learn
3638
make test-doc test-sphinxext

0 commit comments

Comments
 (0)