Add clang-format to ci

This commit is contained in:
Konstantinos Sideris 2017-09-24 17:08:11 +03:00
parent f351b00075
commit 37ff1398b7
3 changed files with 17 additions and 6 deletions

14
.ci/format.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Runs the Clang Formatter
# Return codes:
# - 1 there are files to be formatted
# - 0 everything looks fine
set -o errexit
set -o pipefail
set -o nounset
FILES=`find include src tests -type f -type f \( -iname "*.cc" -o -iname "*.h" \)`
clang-format -i $FILES && git diff --exit-code

View File

@ -17,7 +17,7 @@ matrix:
before_install:
- if [ $TRAVIS_OS_NAME == linux ]; then ./.ci/linux/gtest.sh; fi
install:
- if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install qt5 lmdb; fi
- if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install qt5 lmdb clang-format; fi
- if [ $TRAVIS_OS_NAME == osx ]; then export CMAKE_PREFIX_PATH=/usr/local/opt/qt5; fi
- if [ $TRAVIS_OS_NAME == linux ]; then ./.ci/linux/install-deps.sh; fi
before_script:
@ -26,3 +26,4 @@ before_script:
script:
- make -C build -j2
- if [ $TRAVIS_OS_NAME == linux ]; then ./.ci/linux/run-tests.sh; fi
- if [ $TRAVIS_OS_NAME == osx ]; then make lint; fi

View File

@ -3,9 +3,6 @@ APP_NAME = nheko
MAC_DIST_DIR = dist/MacOS
APP_TEMPLATE = $(MAC_DIST_DIR)/Nheko.app
SRC := $(shell find include src -type f -type f \( -iname "*.cc" -o -iname "*.h" \))
# Linux specific helpers
debug:
@cmake -DBUILD_TESTS=OFF -H. -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Debug
@ -38,8 +35,7 @@ run:
@./build/nheko
lint:
@clang-format -i $(SRC)
@./.ci/format.sh
clean:
rm -rf build