diff --git a/build-linux.sh b/build-linux.sh index 60cc4e3332f..bb5973608c3 100755 --- a/build-linux.sh +++ b/build-linux.sh @@ -4,6 +4,29 @@ set -x export PATH="$HOME/miniconda/bin:$PATH" +# Check if any clang-formatting necessary + +# TODO: de-dupe with Dockerfile. At time of writing Dockerfile changes +# did not result in the CI image getting changed. + +cd /vw +sudo apt-get update +sudo apt-get install -y wget +sudo echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main" >> /etc/apt/sources.list +sudo echo "deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main" >> /etc/apt/sources.list +sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - +sudo apt-get update +sudo apt-get install --yes clang-format-3.4 + +for VW_FILE in $(find vowpalwabbit -type f -name '*.cc' -o -name '*.h'); do + diff $VW_FILE <(clang-format $VW_FILE); + if [ $? -ne 0 ] + then + echo "Run clang-format on all .cc and .h files under vowpalwabbit." + exit 1 + fi +done + sudo apt remove --yes --force-yes cmake # Upgrade CMake @@ -48,25 +71,3 @@ cd .. cd test export PATH=../build/vowpalwabbit/:$PATH && ./RunTests -d -fe -E 0.001 cd .. -# Check if any clang-formatting necessary - -# TODO: de-dupe with Dockerfile. At time of writing Dockerfile changes -# did not result in the CI image getting changed. - -cd .. -sudo apt-get update -sudo apt-get install -y wget -sudo echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main" >> /etc/apt/sources.list -sudo echo "deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main" >> /etc/apt/sources.list -sudo wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - -sudo apt-get update -sudo apt-get install --yes clang-format-3.4 - -for VW_FILE in $(find vowpalwabbit -type f -name '*.cc' -o -name '*.h'); do - diff $VW_FILE <(clang-format $VW_FILE); - if [ $? -ne 0 ] - then - echo "Run clang-format on all .cc and .h files under vowpalwabbit." - exit 1 - fi -done