From 2c727efa2a40e9351478a757ff56f171d431d783 Mon Sep 17 00:00:00 2001 From: Charles Milette Date: Thu, 1 Oct 2020 22:05:29 -0400 Subject: [PATCH 1/3] Azure Pipelines: Skip tests if build fails, run clang-format and validate in parallel --- azure-devops/run-build.yml | 6 ++--- azure-devops/run-tool.yml | 17 +++++++++++++ azure-pipelines.yml | 50 +++++++++++++++++++------------------- 3 files changed, 44 insertions(+), 29 deletions(-) create mode 100644 azure-devops/run-tool.yml diff --git a/azure-devops/run-build.yml b/azure-devops/run-build.yml index 0a517388607..2d52b453755 100644 --- a/azure-devops/run-build.yml +++ b/azure-devops/run-build.yml @@ -4,8 +4,6 @@ jobs: - job: ${{ parameters.targetPlatform }} timeoutInMinutes: 360 - pool: - name: $(agentPool) variables: buildOutputLocation: 'D:\build\${{ parameters.targetPlatform }}' @@ -74,7 +72,7 @@ jobs: - task: CmdLine@2 displayName: 'Run Tests' timeoutInMinutes: 120 - condition: in('${{ parameters.targetPlatform }}', 'x64', 'x86') + condition: and(succeeded(), in('${{ parameters.targetPlatform }}', 'x64', 'x86')) inputs: workingDirectory: $(buildOutputLocation) script: | @@ -85,7 +83,7 @@ jobs: - task: PublishTestResults@2 displayName: 'Publish Tests' timeoutInMinutes: 10 - condition: in('${{ parameters.targetPlatform }}', 'x64', 'x86') + condition: and(succeededOrFailed(), in('${{ parameters.targetPlatform }}', 'x64', 'x86')) inputs: searchFolder: $(buildOutputLocation) testResultsFormat: JUnit diff --git a/azure-devops/run-tool.yml b/azure-devops/run-tool.yml new file mode 100644 index 00000000000..46afee7c3d8 --- /dev/null +++ b/azure-devops/run-tool.yml @@ -0,0 +1,17 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +jobs: +- job : ${{ parameters.name }} + displayName: ${{ parameters.displayName }} + dependsOn: Build_Support_Tools + timeoutInMinutes: ${{ parameters.timeout }} + steps: + - download: current + artifact: ${{ parameters.toolName }} + - task: BatchScript@1 + displayName: ${{ parameters.displayName }} + inputs: + filename: ${{ parameters.script }} + failOnStandardError: true + arguments: '$(Pipeline.Workspace)/${{ parameters.toolName }}/${{ parameters.toolName }}.exe' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 69437b81002..c3263541252 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,21 +4,19 @@ # Build STL targeting x86, x64, arm, arm64 variables: - agentPool: 'StlBuild-2020-09-14' tmpDir: 'D:\Temp' +pool: 'StlBuild-2020-09-14' + stages: - stage: Code_Format displayName: 'Code Format' + variables: + buildOutputLocation: 'D:\tools' jobs: - - job: Code_Format_Validation - timeoutInMinutes: 90 - displayName: 'Validation' - pool: - name: $(agentPool) - - variables: - buildOutputLocation: 'D:\tools' + - job: Build_Support_Tools + displayName: 'Build Support Tools' + timeoutInMinutes: 30 steps: - script: | if exist "$(tmpDir)" ( @@ -40,22 +38,24 @@ stages: cmake --build $(buildOutputLocation) displayName: 'Build Support Tools' env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - - task: BatchScript@1 - displayName: 'Enforce clang-format' - timeoutInMinutes: 60 - inputs: - filename: 'azure-devops/enforce-clang-format.cmd' - failOnStandardError: true - arguments: '$(buildOutputLocation)/parallelize/parallelize.exe' - env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - - task: BatchScript@1 - displayName: 'Validate Files' - timeoutInMinutes: 2 - inputs: - filename: 'azure-devops/validate-files.cmd' - failOnStandardError: true - arguments: '$(buildOutputLocation)/validate/validate.exe' - env: { TMP: $(tmpDir), TEMP: $(tmpDir) } + - publish: '$(buildOutputLocation)/parallelize/parallelize.exe' + artifact: parallelize + - publish: '$(buildOutputLocation)/validate/validate.exe' + artifact: validate + - template: azure-devops/run-tool.yml + parameters: + name: Enforce_Clang_Format + displayName: 'Enforce clang-format' + timeout: 60 + toolName: parallelize + script: azure-devops/enforce-clang-format.cmd + - template: azure-devops/run-tool.yml + parameters: + name: Validate_Files + displayName: 'Validate Files' + timeout: 2 + toolName: validate + script: azure-devops/validate-files.cmd - stage: Build_And_Test displayName: 'Build and Test' jobs: From 36415529718fabe42ce33bed29b96355ab3cdf32 Mon Sep 17 00:00:00 2001 From: Charles Milette Date: Sat, 3 Oct 2020 00:14:31 -0400 Subject: [PATCH 2/3] Move the buildOutputLocation variable to the Build_Support_Tools job --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c3263541252..cd976e01477 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -11,12 +11,12 @@ pool: 'StlBuild-2020-09-14' stages: - stage: Code_Format displayName: 'Code Format' - variables: - buildOutputLocation: 'D:\tools' jobs: - job: Build_Support_Tools displayName: 'Build Support Tools' timeoutInMinutes: 30 + variables: + buildOutputLocation: 'D:\tools' steps: - script: | if exist "$(tmpDir)" ( From 495e42cdaa8c77e4cc7523cd365fe5b5ea5e6bb5 Mon Sep 17 00:00:00 2001 From: Charles Milette Date: Tue, 6 Oct 2020 16:24:30 -0400 Subject: [PATCH 3/3] Go back to steps for validation --- azure-devops/run-tool.yml | 17 ---------------- azure-pipelines.yml | 42 +++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 38 deletions(-) delete mode 100644 azure-devops/run-tool.yml diff --git a/azure-devops/run-tool.yml b/azure-devops/run-tool.yml deleted file mode 100644 index 46afee7c3d8..00000000000 --- a/azure-devops/run-tool.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -jobs: -- job : ${{ parameters.name }} - displayName: ${{ parameters.displayName }} - dependsOn: Build_Support_Tools - timeoutInMinutes: ${{ parameters.timeout }} - steps: - - download: current - artifact: ${{ parameters.toolName }} - - task: BatchScript@1 - displayName: ${{ parameters.displayName }} - inputs: - filename: ${{ parameters.script }} - failOnStandardError: true - arguments: '$(Pipeline.Workspace)/${{ parameters.toolName }}/${{ parameters.toolName }}.exe' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index cd976e01477..49c9a55da32 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,9 +12,9 @@ stages: - stage: Code_Format displayName: 'Code Format' jobs: - - job: Build_Support_Tools - displayName: 'Build Support Tools' - timeoutInMinutes: 30 + - job: Code_Format_Validation + timeoutInMinutes: 90 + displayName: 'Validation' variables: buildOutputLocation: 'D:\tools' steps: @@ -38,24 +38,24 @@ stages: cmake --build $(buildOutputLocation) displayName: 'Build Support Tools' env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - - publish: '$(buildOutputLocation)/parallelize/parallelize.exe' - artifact: parallelize - - publish: '$(buildOutputLocation)/validate/validate.exe' - artifact: validate - - template: azure-devops/run-tool.yml - parameters: - name: Enforce_Clang_Format - displayName: 'Enforce clang-format' - timeout: 60 - toolName: parallelize - script: azure-devops/enforce-clang-format.cmd - - template: azure-devops/run-tool.yml - parameters: - name: Validate_Files - displayName: 'Validate Files' - timeout: 2 - toolName: validate - script: azure-devops/validate-files.cmd + - task: BatchScript@1 + displayName: 'Enforce clang-format' + timeoutInMinutes: 60 + condition: succeededOrFailed() + inputs: + filename: 'azure-devops/enforce-clang-format.cmd' + failOnStandardError: true + arguments: '$(buildOutputLocation)/parallelize/parallelize.exe' + env: { TMP: $(tmpDir), TEMP: $(tmpDir) } + - task: BatchScript@1 + displayName: 'Validate Files' + timeoutInMinutes: 2 + condition: succeededOrFailed() + inputs: + filename: 'azure-devops/validate-files.cmd' + failOnStandardError: true + arguments: '$(buildOutputLocation)/validate/validate.exe' + env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - stage: Build_And_Test displayName: 'Build and Test' jobs: