Skip to content

Commit

Permalink
add travis-ci tools to improve qa testing of addons
Browse files Browse the repository at this point in the history
  • Loading branch information
toutpt committed Jan 21, 2013
1 parent 3b62c02 commit 5abbdfa
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 1 deletion.
85 changes: 85 additions & 0 deletions qa.cfg
@@ -0,0 +1,85 @@
[buildout]
package-src =

[createzopecoverage]
recipe = createzopecoverage

[flake8]
recipe = zc.recipe.egg
eggs =
flake8
${buildout:eggs}
entry-points = flake8=flake8.run:main

[python-validation-sh]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/python-validation.sh
mode = 755
input = inline:
#! /bin/sh
src=${buildout:package-src}
pep8_ignores=E501
echo Validating Python files
bin/flake8 --ignore=$pep8_ignores $src

[coverage-sh]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/coverage.sh
mode = 755
input = inline:
#! /bin/sh
# default minimum coverage is 80%
DEFAULT=80
REPORT="coverage/reports/all.html"

if [ "$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/createzopecoverage 1>/dev/null
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
exit 0
fi

[css-validation-sh]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/css-validation.sh
mode = 755
input = inline:
#! /bin/sh
src=${buildout:package-src}
css_ignores=! -name bootstrap\* ! -name jquery\*
find $src -type f -name *.css $css_ignores | xargs csslint | ack-grep --passthru error

[js-validation-sh]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/js-validation.sh
mode = 755
input = inline:
#! /bin/sh
src=${buildout:package-src}
js_ignores=! -name bootstrap\* ! -name jquery\*
find $src -type f -name *.js $js_ignores -exec jshint {} ';' | ack-grep --passthru error

[python-validation-sh]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/python-validation.sh
mode = 755
input = inline:
#! /bin/sh
src=${buildout:package-src}
pep8_ignores=E501,W404
echo Validating Python files
bin/flake8 --ignore=$pep8_ignores $src
3 changes: 2 additions & 1 deletion travis-4.x.cfg
@@ -1,7 +1,8 @@
[buildout]
extends = test-4.x.cfg buildout-cache.cfg
extends = test-4.x.cfg buildout-cache.cfg qa.cfg
parts = download install test
plone-series = 4.2
package-name =
package-extras =
package-src =
test-eggs =

0 comments on commit 5abbdfa

Please sign in to comment.