From 396fa5f75a196b949eb9ee1a4b3d879c30ee247f Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Wed, 14 Mar 2018 13:13:32 -0500 Subject: [PATCH] Astyle: Changed from test failure to status note --- .travis.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a75a348cb3..2395e787f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -109,11 +109,25 @@ matrix: if [ $(cat astyle.out | grep Formatted | wc -l) -ne 0 ]; then git --no-pager diff; echo "Please fix style issues as shown above"; - exit 1; else echo "Coding style check OK"; - exit 0; fi + after_success: + # update status if we succeeded, compare with master if possible + - | + CURR=$(cat astyle.out | grep Formatted | wc -l) + PREV=$(curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \ + | jq -re "select(.sha != \"$TRAVIS_COMMIT\") + | .statuses[] | select(.context == \"travis-ci/$NAME\").description + | capture(\", (?[0-9]+) warnings\").warnings" \ + || echo 0) + + STATUSM="Passed, ${CURR} warnings" + if [ "$PREV" -ne 0 ] + then + STATUSM="$STATUSM ($(python -c "print '%+d' % ($CURR-$PREV)") warnings)" + fi + - bash -c "$STATUS" success "$STATUSM" - env: - NAME=events