From f04bb93a423ba21ed627340e1946fc3710371e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Wed, 18 Sep 2019 21:51:01 +0200 Subject: [PATCH] Extract code format validation to its own job It makes no sense to start building things if code validation is going to fail. --- azure-pipelines-windows-template.yml | 2 +- azure-pipelines.yml | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/azure-pipelines-windows-template.yml b/azure-pipelines-windows-template.yml index 74b6d744..1e5bc4c9 100644 --- a/azure-pipelines-windows-template.yml +++ b/azure-pipelines-windows-template.yml @@ -10,7 +10,7 @@ parameters: jobs: - job: ${{ parameters.name }} - dependsOn: Initialization + dependsOn: CodeFormatValidation pool: vmImage: 'vs2017-win2016' steps: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4e6b7200..6faba04e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,8 +10,21 @@ jobs: vmImage: 'vs2017-win2016' steps: - template: azure-pipelines-build-number.yml -- job: Linux +- job: CodeFormatValidation dependsOn: Initialization + pool: + vmImage: 'macOS-10.14' + steps: + - script: | + brew install clang-format + 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: 'clang-format' +- job: Linux + dependsOn: CodeFormatValidation pool: vmImage: 'ubuntu-16.04' steps: @@ -45,7 +58,7 @@ jobs: path: $(Build.ArtifactStagingDirectory) artifactName: src $(Build.BuildNumber) tarball - job: MacOS - dependsOn: Initialization + dependsOn: CodeFormatValidation variables: - group: macos-codesign pool: @@ -55,7 +68,6 @@ jobs: brew install qt brew link qt --force brew install create-dmg - brew install clang-format brew install node brew link --overwrite node npm install -g appdmg @@ -63,11 +75,6 @@ jobs: 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' - task: InstallAppleCertificate@2 inputs: certSecureFile: 'developerID_application.p12'