From 254d64cf8ba4a517425ca428fca542a9c05264cb Mon Sep 17 00:00:00 2001 From: hugovk Date: Sat, 28 Jun 2014 11:02:09 +0300 Subject: [PATCH 1/8] Show coverage and quality reports for just the committed diff --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4de1fde99..68c65eb8f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,6 +41,13 @@ script: after_success: - coverage report - coveralls + + - pip install diff_cover + - coverage xml + - diff-cover coverage.xml + - diff-quality --violation=pep8 + - diff-quality --violation=pyflakes + - pip install pep8 pyflakes - pep8 --statistics --count PIL/*.py - pep8 --statistics --count Tests/*.py From ae82c079df02f0e4848ca602d72ac209d0f62923 Mon Sep 17 00:00:00 2001 From: hugovk Date: Sat, 28 Jun 2014 11:18:33 +0300 Subject: [PATCH 2/8] Fetch the remote master branch before running diff-cover --- .travis.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 68c65eb8f..adaf54b6f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,14 +42,15 @@ after_success: - coverage report - coveralls - - pip install diff_cover - - coverage xml - - diff-cover coverage.xml - - diff-quality --violation=pep8 - - diff-quality --violation=pyflakes - - 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) + + - time git fetch origin master:refs/remotes/origin/master + - time pip install diff_cover + - time coverage xml + - time diff-cover coverage.xml + - time diff-quality --violation=pep8 + - time diff-quality --violation=pyflakes From 38c3dd8c7dda99e59bea035dbe7c70ef1bee4681 Mon Sep 17 00:00:00 2001 From: hugovk Date: Sun, 29 Jun 2014 10:41:41 +0300 Subject: [PATCH 3/8] Build diff_cover (and more importantly its dependencies such as lxml) with no optimisations to speed up install. Use wheel if possible --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index adaf54b6f..719fc7951 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,7 +49,7 @@ after_success: - pyflakes Tests/*.py | tee >(wc -l) - time git fetch origin master:refs/remotes/origin/master - - time pip install diff_cover + - time CFLAGS=-O0 pip install --use-wheel diff_cover - time coverage xml - time diff-cover coverage.xml - time diff-quality --violation=pep8 From 3ea4780bdc600fc26efe7c52e399710988c03034 Mon Sep 17 00:00:00 2001 From: hugovk Date: Sun, 29 Jun 2014 12:39:34 +0300 Subject: [PATCH 4/8] Comment diff-cover --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 719fc7951..d6589efc7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,6 +48,7 @@ after_success: - pyflakes PIL/*.py | tee >(wc -l) - pyflakes Tests/*.py | tee >(wc -l) + # Coverage and quality reports on just the last diff - time git fetch origin master:refs/remotes/origin/master - time CFLAGS=-O0 pip install --use-wheel diff_cover - time coverage xml From b72b6395c03af36c866b182abc166cfaa4be6acf Mon Sep 17 00:00:00 2001 From: hugovk Date: Mon, 30 Jun 2014 23:57:16 +0300 Subject: [PATCH 5/8] Don't run on Py3.x because installation takes ~4m , or ~2m with CFLAGS=-O0. Installation is ~1m30s for 2.x or ~30s with flags. --- .travis.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index d6589efc7..ec6fb2ce4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -48,10 +48,14 @@ after_success: - pyflakes PIL/*.py | tee >(wc -l) - pyflakes Tests/*.py | tee >(wc -l) - # Coverage and quality reports on just the last diff - - time git fetch origin master:refs/remotes/origin/master - - time CFLAGS=-O0 pip install --use-wheel diff_cover - - time coverage xml - - time diff-cover coverage.xml - - time diff-quality --violation=pep8 - - time diff-quality --violation=pyflakes + + # 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 + git fetch origin master:refs/remotes/origin/master + time CFLAGS=-O0 pip install --use-wheel diff_cover + coverage xml + diff-cover coverage.xml + diff-quality --violation=pep8 + diff-quality --violation=pyflakes + fi From d002e5f6901c2005083791b453429641f0cb78d0 Mon Sep 17 00:00:00 2001 From: hugovk Date: Tue, 1 Jul 2014 00:22:44 +0300 Subject: [PATCH 6/8] Move diff-cover commands to diffcover.sh --- .travis.yml | 10 ++-------- Scripts/diffcover.sh | 5 +++++ 2 files changed, 7 insertions(+), 8 deletions(-) create mode 100755 Scripts/diffcover.sh diff --git a/.travis.yml b/.travis.yml index ec6fb2ce4..4f15d19d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,11 +51,5 @@ after_success: # 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 - git fetch origin master:refs/remotes/origin/master - time CFLAGS=-O0 pip install --use-wheel diff_cover - coverage xml - diff-cover coverage.xml - diff-quality --violation=pep8 - diff-quality --violation=pyflakes - fi + - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then git fetch origin master:refs/remotes/origin/master; fi + - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then Scripts/diffcover.sh; fi diff --git a/Scripts/diffcover.sh b/Scripts/diffcover.sh new file mode 100755 index 000000000..a573c97d4 --- /dev/null +++ b/Scripts/diffcover.sh @@ -0,0 +1,5 @@ +time CFLAGS=-O0 pip install --use-wheel diff_cover +coverage xml +diff-cover coverage.xml +diff-quality --violation=pep8 +diff-quality --violation=pyflakes From e220e597bfd46b1a8b3cc789b8153860fa5c4616 Mon Sep 17 00:00:00 2001 From: hugovk Date: Tue, 1 Jul 2014 02:16:34 +0300 Subject: [PATCH 7/8] Separate install and report scripts for diff-cover --- .travis.yml | 4 ++-- Scripts/diffcover-install.sh | 7 +++++++ Scripts/{diffcover.sh => diffcover-report.sh} | 1 - 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100755 Scripts/diffcover-install.sh rename Scripts/{diffcover.sh => diffcover-report.sh} (66%) diff --git a/.travis.yml b/.travis.yml index 4f15d19d8..50bfc3294 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,5 +51,5 @@ after_success: # 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 git fetch origin master:refs/remotes/origin/master; fi - - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then Scripts/diffcover.sh; fi + - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then Scripts/diffcover-install.sh; fi + - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then Scripts/diffcover-report.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.sh b/Scripts/diffcover-report.sh similarity index 66% rename from Scripts/diffcover.sh rename to Scripts/diffcover-report.sh index a573c97d4..dacc8b42f 100755 --- a/Scripts/diffcover.sh +++ b/Scripts/diffcover-report.sh @@ -1,4 +1,3 @@ -time CFLAGS=-O0 pip install --use-wheel diff_cover coverage xml diff-cover coverage.xml diff-quality --violation=pep8 From 443cc908ae3852a077d437a2fb5fab2f4cdca06a Mon Sep 17 00:00:00 2001 From: hugovk Date: Tue, 1 Jul 2014 16:25:24 +0300 Subject: [PATCH 8/8] Show pyflakes quality violations (which can be programming errors) before pep8 (which is just style). --- .travis.yml | 2 +- Scripts/{diffcover-report.sh => diffcover-run.sh} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename Scripts/{diffcover-report.sh => diffcover-run.sh} (100%) diff --git a/.travis.yml b/.travis.yml index 50bfc3294..6ada5fc55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,4 +52,4 @@ after_success: # 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-report.sh; fi + - if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then Scripts/diffcover-run.sh; fi diff --git a/Scripts/diffcover-report.sh b/Scripts/diffcover-run.sh similarity index 100% rename from Scripts/diffcover-report.sh rename to Scripts/diffcover-run.sh index dacc8b42f..02efab6ae 100755 --- a/Scripts/diffcover-report.sh +++ b/Scripts/diffcover-run.sh @@ -1,4 +1,4 @@ coverage xml diff-cover coverage.xml -diff-quality --violation=pep8 diff-quality --violation=pyflakes +diff-quality --violation=pep8