Skip to content

Commit 83b47ef

Browse files
geky0xc0170
authored andcommitted
Astyle: Changed from test failure to status note
1 parent ef9dbc5 commit 83b47ef

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

.travis.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,25 @@ matrix:
109109
if [ $(cat astyle.out | grep Formatted | wc -l) -ne 0 ]; then
110110
git --no-pager diff;
111111
echo "Please fix style issues as shown above";
112-
exit 1;
113112
else
114113
echo "Coding style check OK";
115-
exit 0;
116114
fi
115+
after_success:
116+
# update status if we succeeded, compare with master if possible
117+
- |
118+
CURR=$(cat astyle.out | grep Formatted | wc -l)
119+
PREV=$(curl https://github.com/api/repos/$TRAVIS_REPO_SLUG/status/master \
120+
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
121+
| .statuses[] | select(.context == \"travis-ci/$NAME\").description
122+
| capture(\", (?<warnings>[0-9]+) warnings\").warnings" \
123+
|| echo 0)
124+
125+
STATUSM="Passed, ${CURR} warnings"
126+
if [ "$PREV" -ne 0 ]
127+
then
128+
STATUSM="$STATUSM ($(python -c "print '%+d' % ($CURR-$PREV)") warnings)"
129+
fi
130+
- bash -c "$STATUS" success "$STATUSM"
117131

118132
- env:
119133
- NAME=events

0 commit comments

Comments
 (0)