Skip to content

Commit

Permalink
Add support for Coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
kroman0 committed Oct 7, 2013
1 parent f9c1441 commit ac02c24
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 14 deletions.
8 changes: 8 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[report]
omit =
/home/*/.buildout/eggs/*
/usr/*
bin/test
buildout-cache/eggs/*
eggs/*
parts/*
29 changes: 17 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
python:
- 2.6
script:
- bin/coverage.sh
after_success:
- coveralls
env:
global:
secure: hsjUwQmmabdnQMJDu8ylr/wmIPpik8X7zQR1gCVUxVjlioIEhkoQv8RtLOLoP9RfSXr8Lv9CAndXI9j59XjkDYB4p8HwNx46DxQthgd5SQM+W+A456r+w//nTY4w/37wNj1ELrjXyPSuBfyyarNduB1SuOSH+qG6OL6jf/HjEpA=
language: python
python:
- 2.6
before_install:
- pip install http://effbot.org/downloads/Imaging-1.1.6.tar.gz
- sudo apt-get install -qq libxml2-dev libxslt-dev
- mkdir -p buildout-cache/eggs
- mkdir -p buildout-cache/downloads
install:
- python bootstrap.py -c test.cfg
- bin/buildout -t 5 -Nqc test.cfg
script:
- bin/test
install:
- python bootstrap.py -c test.cfg
- bin/buildout -t 5 -Nqc test.cfg
before_install:
- pip install -q http://effbot.org/downloads/Imaging-1.1.6.tar.gz coveralls
- sudo apt-get install -qq libxml2-dev libxslt-dev
- mkdir -p buildout-cache/eggs
- mkdir -p buildout-cache/downloads
45 changes: 43 additions & 2 deletions test.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
[buildout]
extends = http://svn.plone.org/svn/collective/buildout/plonetest/test-4.0.x.cfg http://good-py.appspot.com/release/plone/4.0.9
extends =
https://raw.github.com/collective/buildout.plonetest/master/test-4.0.x.cfg
http://good-py.appspot.com/release/plone/4.0.9

eggs-directory = buildout-cache/eggs
download-cache = buildout-cache/downloads

parts = download install test
parts = download install test createcoverage coverage-sh

package-name = quintagroup.plonecomments

package-min-coverage = 80

allow-hosts =
*.plone.org
*.python.org
Expand All @@ -29,5 +33,42 @@ recipe = collective.recipe.cmd
on_install = true
cmds = tar jxvf ${download:location}/${buildout:basename}/packages/buildout-cache.tar.bz2 1>/dev/null

[createcoverage]
recipe = zc.recipe.egg
eggs = createcoverage

[coverage-sh]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/coverage.sh
mode = 755
input = inline:
#! /bin/sh
# checks for report created with createcoverage and evaluate the result

DEFAULT=${buildout:package-min-coverage}
REPORT="htmlcov/index.html"

if [ "$#" -eq 1 ] && [ $1 -ge 0 ] && [ $1 -le 100 ]; then
MINIMUM=$1
else
echo "Invalid value for minimum coverage; using default: $DEFAULT%"
MINIMUM=$DEFAULT
fi

if [ ! -f "$REPORT" ]; then
bin/createcoverage run bin/test
fi

# find first percentage value in file (module test coverage) and return it
COVERAGE=`grep "[0-9]\{1,3\}[%]" $REPORT -m 1 -o | grep "[0-9]\{1,3\}" -o`

if [ $COVERAGE -lt $MINIMUM ]; then
echo "Insufficient test coverage: $COVERAGE% (minimum acceptable is $MINIMUM%)"
exit 1
else
echo "Current test coverage: $COVERAGE%"
exit 0
fi

[versions]
zc.buildout = 1.6.3

0 comments on commit ac02c24

Please sign in to comment.