diff --git a/.travis.yml b/.travis.yml index d4880847c..0ff62ccdd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,8 +41,15 @@ script: after_success: - coverage report - coveralls + - pip install pep8 pyflakes - pep8 --statistics --count PIL/*.py - pep8 --statistics --count Tests/*.py - pyflakes PIL/*.py | tee >(wc -l) - pyflakes Tests/*.py | tee >(wc -l) + + + # Coverage and quality reports on just the latest diff. + # (Installation is very slow on Py3, so just do it for Py2.) + - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then Scripts/diffcover-install.sh; fi + - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then Scripts/diffcover-run.sh; fi diff --git a/Scripts/diffcover-install.sh b/Scripts/diffcover-install.sh new file mode 100755 index 000000000..93e06efe3 --- /dev/null +++ b/Scripts/diffcover-install.sh @@ -0,0 +1,7 @@ +# Fetch the remote master branch before running diff-cover on Travis CI. +# https://github.com/edx/diff-cover#troubleshooting +git fetch origin master:refs/remotes/origin/master + +# CFLAGS=-O0 means build with no optimisation. +# Makes build much quicker for lxml and other dependencies. +time CFLAGS=-O0 pip install --use-wheel diff_cover diff --git a/Scripts/diffcover-run.sh b/Scripts/diffcover-run.sh new file mode 100755 index 000000000..02efab6ae --- /dev/null +++ b/Scripts/diffcover-run.sh @@ -0,0 +1,4 @@ +coverage xml +diff-cover coverage.xml +diff-quality --violation=pyflakes +diff-quality --violation=pep8