mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #9114 from cmonr/astyle-simplification
Simplified astyle travis test to be easier to reason aboutpull/9156/head
commit
c580260504
41
.travis.yml
41
.travis.yml
|
@ -134,43 +134,21 @@ matrix:
|
||||||
- env:
|
- env:
|
||||||
- NAME=astyle
|
- NAME=astyle
|
||||||
install:
|
install:
|
||||||
- curl -L0 https://mbed-os-ci.s3-eu-west-1.amazonaws.com/jenkins-ci/deps/astyle_3.1_linux.tar.gz --output astyle.tar.gz;
|
- >-
|
||||||
|
curl -L0 https://mbed-os.s3-eu-west-1.amazonaws.com/builds/deps/astyle_3.1_linux.tar.gz --output astyle.tar.gz;
|
||||||
mkdir -p BUILD && tar xf astyle.tar.gz -C BUILD;
|
mkdir -p BUILD && tar xf astyle.tar.gz -C BUILD;
|
||||||
pushd BUILD/astyle/build/gcc;
|
cd BUILD/astyle/build/gcc;
|
||||||
make;
|
make;
|
||||||
export PATH=$PWD/bin:$PATH;
|
export PATH=$PWD/bin:$PATH;
|
||||||
popd;
|
cd -
|
||||||
- astyle --version
|
- astyle --version
|
||||||
script:
|
script:
|
||||||
# only changed files this time
|
- >-
|
||||||
git diff --name-only --diff-filter=d $TRAVIS_BRANCH | grep '.*\.\(h\|c\|hpp\|cpp\)$' | fgrep -v -f .astyleignore | xargs -n 100 -I {} bash -c "astyle -n --options=.astylerc \"{}\"" > astyle-files-changed.out;
|
git diff --name-only --diff-filter=d HEAD..${TRAVIS_BRANCH} \
|
||||||
if [ $(cat astyle-files-changed.out | grep Formatted | wc -l) -ne 0 ]; then
|
| ( grep '.\(c\|cpp\|h\|hpp\)$' || true ) \
|
||||||
git --no-pager diff;
|
| while read file; do astyle -n --options=.astylerc "${file}"; done
|
||||||
echo "";
|
- git diff --exit-code --diff-filter=d --color
|
||||||
echo "AStyle check failed, please fix style issues as shown above";
|
|
||||||
(exit 1);
|
|
||||||
else
|
|
||||||
echo "Coding style check OK";
|
|
||||||
fi
|
|
||||||
after_success:
|
|
||||||
# run astyle for all files on the branch
|
|
||||||
- git checkout -- .
|
|
||||||
- find -regex '.*\.\(h\|c\|hpp\|cpp\)$' -type f | fgrep -v -f .astyleignore | xargs -n 100 -I {} bash -c "astyle -n --options=.astylerc \"{}\"" > astyle-branch.out;
|
|
||||||
# update status if we succeeded, compare with master if possible
|
|
||||||
- |
|
|
||||||
CURR=$(cat astyle-branch.out | grep Formatted | wc -l)
|
|
||||||
PREV=$(curl -u "$MBED_BOT" https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
|
|
||||||
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
|
|
||||||
| .statuses[] | select(.context == \"travis-ci/$NAME\").description
|
|
||||||
| capture(\", (?<files>[0-9]+) files\").files" \
|
|
||||||
|| echo 0)
|
|
||||||
|
|
||||||
STATUSM="Passed, ${CURR} files"
|
|
||||||
if [ "$PREV" -ne 0 ]
|
|
||||||
then
|
|
||||||
STATUSM="$STATUSM ($(python -c "print '%+d' % ($CURR-$PREV)") files)"
|
|
||||||
fi
|
|
||||||
- bash -c "$STATUS" success "$STATUSM"
|
|
||||||
- env:
|
- env:
|
||||||
- NAME=events
|
- NAME=events
|
||||||
- EVENTS=events
|
- EVENTS=events
|
||||||
|
@ -294,6 +272,7 @@ matrix:
|
||||||
- echo 'Checking that there is no GPL licence text in code'
|
- echo 'Checking that there is no GPL licence text in code'
|
||||||
- ! git grep -q --ignore-case "gnu general public";
|
- ! git grep -q --ignore-case "gnu general public";
|
||||||
- ! git grep -q --ignore-case "gnu library general public";
|
- ! git grep -q --ignore-case "gnu library general public";
|
||||||
|
|
||||||
- env:
|
- env:
|
||||||
- NAME=psa-autogen
|
- NAME=psa-autogen
|
||||||
script:
|
script:
|
||||||
|
|
Loading…
Reference in New Issue