Skip to content

Commit

Permalink
Move format check to top of CI script
Browse files Browse the repository at this point in the history
  • Loading branch information
palmerlao committed Jan 18, 2019
1 parent 915ac25 commit 98fb122
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions build-linux.sh
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 98fb122

Please sign in to comment.