From cadfbed43b6e7c3f308d6c3dd746f9224088e353 Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 17 Oct 2018 22:24:05 +0300 Subject: [PATCH] Run lint in own job, but don't let it fail build --- .travis.yml | 37 +++++++++++++++++++++++++----------- .travis/after_success.sh | 9 --------- depends/diffcover-install.sh | 1 + depends/diffcover-run.sh | 1 + 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 480e98d20..b94923933 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,13 +6,18 @@ cache: pip notifications: irc: "chat.freenode.net#pil" -# Run slow PyPy* first, to give them a headstart and reduce waiting time. +# Run fast lint first to get fast feedback. +# Run slow PyPy* next, to give them a headstart and reduce waiting time. # Run latest 3.x and 2.x next, to get quick compatibility results. # Then run the remainder, with fastest Docker jobs last. matrix: fast_finish: true include: + - python: "3.6" + name: "Lint" + env: LINT="true" + sudo: false - python: "pypy" name: "PyPy Trusty" dist: trusty @@ -62,7 +67,12 @@ services: - docker install: - - if [ "$DOCKER" == "" ]; then .travis/install.sh; fi + - | + if [ "$LINT" == "true" ]; then + pip install -U flake8 + elif [ "$DOCKER" == "" ]; then + .travis/install.sh; + fi before_install: - if [ "$DOCKER" ]; then travis_retry docker pull pythonpillow/$DOCKER:$DOCKER_TAG; fi @@ -73,14 +83,19 @@ before_script: - "sh -e /etc/init.d/xvfb start" script: - - | - if [ "$DOCKER" == "" ]; then - .travis/script.sh - else - # the Pillow user in the docker container is UID 1000 - sudo chown -R 1000 $TRAVIS_BUILD_DIR - docker run -v $TRAVIS_BUILD_DIR:/Pillow pythonpillow/$DOCKER:$DOCKER_TAG - fi +- | + if [ "$DOCKER" == "" ] && [ "$LINT" == "" ]; then + .travis/script.sh + elif [ "$DOCKER" ]; then + # the Pillow user in the docker container is UID 1000 + sudo chown -R 1000 $TRAVIS_BUILD_DIR + docker run -v $TRAVIS_BUILD_DIR:/Pillow pythonpillow/$DOCKER:$DOCKER_TAG + fi after_success: - - .travis/after_success.sh +- | + if [ "$LINT" == "true" ]; then + flake8 --statistics --count + else + .travis/after_success.sh + fi diff --git a/.travis/after_success.sh b/.travis/after_success.sh index c215f4219..ad1aeffa3 100755 --- a/.travis/after_success.sh +++ b/.travis/after_success.sh @@ -15,15 +15,6 @@ pip install coveralls-merge coveralls-merge coverage.c.json codecov -if [ "$DOCKER" == "" ]; then - pip install pyflakes pycodestyle - pyflakes *.py | tee >(wc -l) - pyflakes src/PIL/*.py | tee >(wc -l) - pyflakes Tests/*.py | tee >(wc -l) - pycodestyle --statistics --count src/PIL/*.py - pycodestyle --statistics --count Tests/*.py -fi - if [ "$TRAVIS_PYTHON_VERSION" == "2.7" ] && [ "$DOCKER" == "" ]; then # Coverage and quality reports on just the latest diff. # (Installation is very slow on Py3, so just do it for Py2.) diff --git a/depends/diffcover-install.sh b/depends/diffcover-install.sh index 8a8cee076..a0b462b56 100755 --- a/depends/diffcover-install.sh +++ b/depends/diffcover-install.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # Fetch the remote master branch before running diff-cover on Travis CI. # https://github.com/Bachmann1234/diff-cover#troubleshooting git fetch origin master:refs/remotes/origin/master diff --git a/depends/diffcover-run.sh b/depends/diffcover-run.sh index a0d545bc2..b007494e9 100755 --- a/depends/diffcover-run.sh +++ b/depends/diffcover-run.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash coverage xml diff-cover coverage.xml diff-quality --violation=pyflakes