From 17a32020515b6bea941d8284632e4b063e44f991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sat, 17 Aug 2019 19:43:19 +0200 Subject: [PATCH] Add a step to ensure that the code follows clang format I tested this in macos so I am adding it to macos build, no need to do the same in all the platforms, but we should move it to linux, it is the job that finishes earlier. --- azure-pipelines.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6537d483..55d6cf43 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -29,10 +29,16 @@ jobs: brew install qt brew link qt --force brew install create-dmg + brew install clang-format wget "https://sourceforge.net/projects/p7zip/files/p7zip/16.02/p7zip_16.02_src_all.tar.bz2" -P $(Build.SourcesDirectory)/compressed_archive tar xjf $(Build.SourcesDirectory)/compressed_archive/p7zip_16.02_src_all.tar.bz2 -C $(Build.SourcesDirectory)/compressed_archive mv $(Build.SourcesDirectory)/compressed_archive/p7zip_16.02 $(Build.SourcesDirectory)/compressed_archive/libp7zip displayName: 'Install dependencies' + - script: | + cd $(Build.SourcesDirectory) + find . \( -name '*.h' -or -name '*.cpp' -or -name '*.c' -or -name '*.mm' -or -name '*.m' \) -print0 | xargs -0 clang-format -style=file -i + if [ "$(git diff $(Build.SourceVersion))" != "" ]; then exit 1; fi + displayName: 'Check format' - script: | cd $(Build.SourcesDirectory) VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' )"