From 7a9ad883acbbd83767a991078809428f3a15b162 Mon Sep 17 00:00:00 2001 From: Fabio Utzig Date: Thu, 12 Mar 2020 09:14:05 -0300 Subject: [PATCH] Add CI style checking Signed-off-by: Fabio Utzig --- .travis.yml | 56 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 033895a41..3c1a5ef94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,19 @@ git: matrix: include: + # Style checking + - os: linux + language: python + python: + - "3.5" + addons: + apt: + packages: + - "python3-pip" + env: + - TEST=STYLE + - DEBUG=1 + # newt build - os: linux addons: *addon_conf @@ -114,24 +127,39 @@ before_install: install: - git clone https://github.com/JuulLabs-OSS/mynewt-travis-ci $HOME/ci - chmod +x $HOME/ci/*.sh - - $HOME/ci/${TRAVIS_OS_NAME}_travis_install.sh + - | + if [ "${TEST}" == "STYLE" ]; then + pip3 install requests + else + $HOME/ci/${TRAVIS_OS_NAME}_travis_install.sh + fi before_script: - - newt version - - gcc --version - - if [ "${TEST}" != "TEST_ALL" ]; then arm-none-eabi-gcc --version; fi - - cp -R $HOME/ci/mynewt-nimble-project.yml project.yml - - mkdir -p targets - - cp -R $HOME/ci/mynewt-nimble-targets targets - - $HOME/ci/prepare_test.sh $VM_AMOUNT - - mkdir -p repos && pushd repos/ - - git clone --depth=1 https://github.com/apache/mynewt-core apache-mynewt-core - - git clone --depth=1 https://github.com/JuulLabs-OSS/mcuboot mcuboot - - git clone --depth=1 https://github.com/apache/mynewt-mcumgr apache-mynewt-mcumgr - - popd + - | + if [ "${TEST}" == "STYLE" ]; then + $HOME/ci/install_uncrustify.sh + else + newt version + gcc --version + if [ "${TEST}" != "TEST_ALL" ]; then arm-none-eabi-gcc --version; fi + cp -R $HOME/ci/mynewt-nimble-project.yml project.yml + mkdir -p targets + cp -R $HOME/ci/mynewt-nimble-targets targets + $HOME/ci/prepare_test.sh $VM_AMOUNT + mkdir -p repos && pushd repos/ + git clone --depth=1 https://github.com/apache/mynewt-core apache-mynewt-core + git clone --depth=1 https://github.com/JuulLabs-OSS/mcuboot mcuboot + git clone --depth=1 https://github.com/apache/mynewt-mcumgr apache-mynewt-mcumgr + popd + fi script: - - $HOME/ci/run_test.sh + - | + if [ "${TEST}" == "STYLE" ]; then + python3 $HOME/ci/check_style.py + else + $HOME/ci/run_test.sh + fi cache: directories: