Skip to content

Commit 1221cb1

Browse files
committed
[CI] Add Astyle check
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent e7122ce commit 1221cb1

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

.travis.yml

+33-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,40 @@ os:
55
- linux
66
matrix:
77
include:
8+
#
9+
# Astyle check
10+
#
811
- env:
9-
- NAME= arduinoCI
12+
- NAME=Astyle
13+
install:
14+
- curl -L0 https://fossies.org/linux/misc/astyle_3.1_linux.tar.gz --output astyle.tar.gz;
15+
mkdir -p BUILD && tar xf astyle.tar.gz -C BUILD;
16+
pushd BUILD/astyle/build/gcc;
17+
make;
18+
export PATH=$PWD/bin:$PATH;
19+
popd;
20+
- astyle --version
21+
before_script:
22+
- cd $TRAVIS_BUILD_DIR/CI/astyle/
23+
script:
24+
# Check coding style only on changed files for PR or all for master
25+
- if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then python astyle.py; fi
26+
- if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then python astyle.py -b $TRAVIS_BRANCH; fi
27+
- TEST=$([[ -f astyle.out ]] && cat astyle.out | grep Formatted | wc -l || echo 0)
28+
- |
29+
if [[ $TEST -ne 0 ]]; then
30+
cat astyle.out | grep Formatted
31+
git --no-pager diff
32+
echo "AStyle check failed, please fix style issues as shown above"
33+
exit 1
34+
else
35+
echo "Coding style check OK";
36+
fi
37+
#
38+
# Build test
39+
#
40+
- env:
41+
- NAME=arduinoCI
1042
- IDE_VERSION=1.8.8
1143
# Use in CI/build/conf/path_config_travis.json
1244
- ARDUINO_IDE_PATH=$HOME/IDE/arduino

0 commit comments

Comments
 (0)