diff options
author | Alan Antonuk <alan.antonuk@gmail.com> | 2017-12-04 23:52:48 -0800 |
---|---|---|
committer | Alan Antonuk <alan.antonuk@gmail.com> | 2017-12-05 00:19:29 -0800 |
commit | 9cb126c64759fd1294df5cfd4e16dcf938d40743 (patch) | |
tree | 22c7587785b2b599be2ece0df54ccc2201edccf4 | |
parent | afaab64a3f4c6977d66811cb7235431a085de0b2 (diff) | |
download | rabbitmq-c-9cb126c64759fd1294df5cfd4e16dcf938d40743.tar.gz |
ci: add format check to travis-ci build matrix
Add a check that validates that running clang-format across the codebase
does not produce diffs. This will (hopefully) reduce the amount of
effort spent formatting stuff during PR reviews.
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | .travis.yml | 5 | ||||
-rwxr-xr-x | travis.sh | 6 | ||||
-rwxr-xr-x | travis/clang-format.sh | 5 | ||||
m--------- | travis/run-clang-format | 0 |
5 files changed, 18 insertions, 1 deletions
diff --git a/.gitmodules b/.gitmodules index 29d3eac..b7f37f7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "codegen"] path = codegen url = https://github.com/rabbitmq/rabbitmq-codegen.git +[submodule "travis/run-clang-format"] + path = travis/run-clang-format + url = https://github.com/Sarcasm/run-clang-format.git diff --git a/.travis.yml b/.travis.yml index 424fe97..cf2abf3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,9 @@ matrix: env: CONFIG=cmake - compiler: gcc os: linux + env: CONFIG=format + - compiler: gcc + os: linux env: CONFIG=coverage - compiler: clang os: linux @@ -52,7 +55,7 @@ before_install: wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo apt-add-repository "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main" sudo apt-get -q update; - sudo apt-get install -y clang-3.9 libpopt-dev; + sudo apt-get install -y clang-3.9 clang-format-3.9 libpopt-dev; fi # ugly hack; if running a coverity scan abort all except the 1st build # see note re gcc compiler above needing to be 1st @@ -8,6 +8,12 @@ build_cmake() { ctest -V . } +build_format() { + ./travis/run-clang-format/run-clang-format.py \ + --clang-format-executable="${PWD}/travis/clang-format.sh" \ + --recursive examples librabbitmq tests tools +} + build_coverage() { mkdir $PWD/_build && cd $PWD/_build cmake .. -DCMAKE_BUILD_TYPE=Coverage -DCMAKE_INSTALL_PREFIX=$PWD/../_install \ diff --git a/travis/clang-format.sh b/travis/clang-format.sh new file mode 100755 index 0000000..3b48c3b --- /dev/null +++ b/travis/clang-format.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -e + +exec clang-format-3.9 -style=file $@ diff --git a/travis/run-clang-format b/travis/run-clang-format new file mode 160000 +Subproject 6491e7957d8f76d0e3efada87e754478aab438d |