mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
ci: check examples code style
Use code style defined in Arduino project to check code style of the examples. The check is done by formatting all files with astyle and checking whether any changes have been introduced.
This commit is contained in:
committed by
Ivan Grokhotkov
parent
af74a10d27
commit
e226251b27
@ -213,8 +213,30 @@ function build_sketches_with_arduino()
|
||||
echo -e "travis_fold:end:size_report"
|
||||
}
|
||||
|
||||
function check_examples_style()
|
||||
{
|
||||
echo -e "travis_fold:start:check_examples_style"
|
||||
|
||||
find $TRAVIS_BUILD_DIR/libraries -name '*.ino' -exec \
|
||||
astyle \
|
||||
--suffix=none \
|
||||
--options=$TRAVIS_BUILD_DIR/tests/examples_style.conf {} \;
|
||||
|
||||
git diff --exit-code -- $TRAVIS_BUILD_DIR/libraries
|
||||
|
||||
echo -e "travis_fold:end:check_examples_style"
|
||||
}
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "$TRAVIS_BUILD_DIR" ]; then
|
||||
echo "TRAVIS_BUILD_DIR is not set, trying to guess:"
|
||||
pushd $(dirname $0)/../ > /dev/null
|
||||
TRAVIS_BUILD_DIR=$PWD
|
||||
popd > /dev/null
|
||||
echo "TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR"
|
||||
fi
|
||||
|
||||
if [ "$BUILD_TYPE" = "build" ]; then
|
||||
install_arduino
|
||||
build_sketches_with_arduino
|
||||
@ -236,5 +258,11 @@ elif [ "$BUILD_TYPE" = "host_tests" ]; then
|
||||
# Run host side tests
|
||||
cd $TRAVIS_BUILD_DIR/tests
|
||||
run_host_tests
|
||||
elif [ "$BUILD_TYPE" = "style_check" ]; then
|
||||
# Check code style
|
||||
check_examples_style
|
||||
else
|
||||
echo "BUILD_TYPE not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user