Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

include QA validation on CI

  • Loading branch information...
commit 710f1e0a1bd9a3413192cb6d9903b0c33a16e2f5 1 parent 279360e
@hvelarde hvelarde authored
Showing with 87 additions and 7 deletions.
  1. +10 −7 .travis.yml
  2. +50 −0 Makefile
  3. +27 −0 coverage.sh
View
17 .travis.yml
@@ -1,9 +1,12 @@
language: python
-python: "2.7"
+python: 2.7
+env:
+ - TARGET=tests
+ - TARGET=quality-assurance
before_install:
- - mkdir -p buildout-cache/eggs
- - mkdir -p buildout-cache/downloads
-install:
- - python bootstrap.py -c travis.cfg
- - bin/buildout -c travis.cfg -N -q -t 3
-script: bin/test
+ - export DISPLAY=:99.0
+ - sh -e /etc/init.d/xvfb start
+install: make install
+script: make $TARGET
+notifications:
+ irc: irc.freenode.org#simplesconsultoria
View
50 Makefile
@@ -0,0 +1,50 @@
+# convenience makefile to boostrap & run buildout
+# use `make options=-v` to run buildout with extra options
+
+SHELL = /bin/sh
+
+options = -N -q -t 3
+src = src/collective/nitf/
+minimum_coverage = 84
+pep8_ignores = E501
+css_ignores = ! -name jquery\*
+js_ignores = ! -name jquery\*
+
+ack-install:
+ sudo apt-get install ack-grep
+
+nodejs-install:
+ sudo apt-add-repository ppa:chris-lea/node.js -y
+ sudo apt-get update 1>/dev/null
+ sudo apt-get install nodejs npm -y
+
+csslint-install: nodejs-install
+ npm install csslint -g
+
+jshint-install: nodejs-install
+ npm install jshint -g
+
+python-validation:
+ @echo Validating Python files
+ bin/pep8 --ignore=$(pep8_ignores) $(src)
+ bin/pyflakes $(src)
+
+css-validation: ack-install csslint-install
+ @echo Validating CSS files
+ find $(src) -type f -name *.css $(css_ignores) | xargs csslint | ack-grep --passthru error
+
+js-validation: ack-install jshint-install
+ @echo Validating JavaScript files
+ find $(src) -type f -name *.js $(js_ignores) -exec jshint {} ';' | ack-grep --passthru error
+
+quality-assurance: python-validation css-validation js-validation
+ @echo Quality assurance
+ ./coverage.sh $(minimum_coverage)
+
+install:
+ mkdir -p buildout-cache/downloads
+ python bootstrap.py -c travis.cfg
+ bin/buildout -c travis.cfg $(options)
+
+tests:
+ bin/test
View
27 coverage.sh
@@ -0,0 +1,27 @@
+#! /bin/sh
+# checks for report created with createzopecoverage and evaluate the result
+
+# 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
Please sign in to comment.
Something went wrong with that request. Please try again.