Skip to content

Commit af4af43

Browse files
Cruz Monrreal IICruz Monrreal II
authored andcommitted
Simplified astyle travis test to be easier to reason about
1 parent 070bf2f commit af4af43

File tree

1 file changed

+14
-38
lines changed

1 file changed

+14
-38
lines changed

.travis.yml

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ before_install:
4343
- mkdir -p $HOME/.cache/apt/partial
4444
- sudo rm -rf /var/cache/apt/archives
4545
- sudo ln -s $HOME/.cache/apt /var/cache/apt/archives
46-
# Setup ppa to make sure arm-none-eabi-gcc is correct version
47-
- sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
48-
- sudo add-apt-repository -y ppa:deadsnakes/ppa
4946
# Loop until update succeeds (timeouts can occur)
5047
- travis_retry $(! sudo apt-get update 2>&1 |grep Failed)
5148

@@ -134,43 +131,21 @@ matrix:
134131
- env:
135132
- NAME=astyle
136133
install:
137-
- 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;
138-
mkdir -p BUILD && tar xf astyle.tar.gz -C BUILD;
139-
pushd BUILD/astyle/build/gcc;
140-
make;
141-
export PATH=$PWD/bin:$PATH;
142-
popd;
143-
- astyle --version
134+
- >-
135+
curl -L0 https://mbed-os.s3-eu-west-1.amazonaws.com/builds/deps/astyle_3.1_linux.tar.gz --output astyle.tar.gz;
136+
mkdir -p BUILD && tar xf astyle.tar.gz -C BUILD;
137+
cd BUILD/astyle/build/gcc;
138+
make;
139+
export PATH=$PWD/bin:$PATH;
140+
cd -
141+
- astyle --version
144142
script:
145-
# only changed files this time
146-
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;
147-
if [ $(cat astyle-files-changed.out | grep Formatted | wc -l) -ne 0 ]; then
148-
git --no-pager diff;
149-
echo "";
150-
echo "AStyle check failed, please fix style issues as shown above";
151-
(exit 1);
152-
else
153-
echo "Coding style check OK";
154-
fi
155-
after_success:
156-
# run astyle for all files on the branch
157-
- git checkout -- .
158-
- 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;
159-
# update status if we succeeded, compare with master if possible
160-
- |
161-
CURR=$(cat astyle-branch.out | grep Formatted | wc -l)
162-
PREV=$(curl -u "$MBED_BOT" https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
163-
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
164-
| .statuses[] | select(.context == \"travis-ci/$NAME\").description
165-
| capture(\", (?<files>[0-9]+) files\").files" \
166-
|| echo 0)
143+
- >-
144+
git diff --name-only HEAD..${TRAVIS_BRANCH} \
145+
| ( grep '.\(c\|cpp\|h\|hpp\)$' || true ) \
146+
| while read file; do astyle -n --options=.astylerc "${file}"; done
147+
- git diff --exit-code --color
167148

168-
STATUSM="Passed, ${CURR} files"
169-
if [ "$PREV" -ne 0 ]
170-
then
171-
STATUSM="$STATUSM ($(python -c "print '%+d' % ($CURR-$PREV)") files)"
172-
fi
173-
- bash -c "$STATUS" success "$STATUSM"
174149
- env:
175150
- NAME=events
176151
- EVENTS=events
@@ -294,6 +269,7 @@ matrix:
294269
- echo 'Checking that there is no GPL licence text in code'
295270
- ! git grep -q --ignore-case "gnu general public";
296271
- ! git grep -q --ignore-case "gnu library general public";
272+
297273
- env:
298274
- NAME=psa-autogen
299275
script:

0 commit comments

Comments
 (0)