Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extract code format validation into a new template #4029

Merged
merged 1 commit into from Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 52 additions & 0 deletions azure-devops/format-validation.yml
@@ -0,0 +1,52 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# run the `validator` tool, and ensure code is properly clang-formatted

jobs:
- job: Code_Format_Validation
timeoutInMinutes: 5
displayName: 'Validation'
steps:
- script: |
if exist "$(tmpDir)" (
rmdir /S /Q $(tmpDir)
)
mkdir $(tmpDir)
displayName: 'Setup TMP Directory'
- checkout: self
clean: true
submodules: false
- script: |
cd $(Build.SourcesDirectory)
git clean --quiet -x -d -f -f
displayName: 'Clean after checkout'
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=amd64 -arch=amd64 -no_logo
cmake -G Ninja -S $(Build.SourcesDirectory)/tools -B $(tmpDir)/format-validate-build
cmake --build $(tmpDir)/format-validate-build
displayName: 'Build format and validation'
timeoutInMinutes: 5
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=amd64 -arch=amd64 -no_logo
cmake --build $(tmpDir)/format-validate-build --target run-format
displayName: 'clang-format Files'
timeoutInMinutes: 5
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=amd64 -arch=amd64 -no_logo
cmake --build $(tmpDir)/format-validate-build --target run-validate
displayName: 'Validate Files'
timeoutInMinutes: 2
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- task: Powershell@2
displayName: 'Create Diff'
inputs:
filePath: azure-devops/create-prdiff.ps1
pwsh: false
condition: succeededOrFailed()
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
47 changes: 1 addition & 46 deletions azure-pipelines.yml
Expand Up @@ -19,52 +19,7 @@ stages:
- stage: Code_Format
displayName: 'Code Format'
jobs:
- job: Code_Format_Validation
timeoutInMinutes: 5
displayName: 'Validation'
steps:
- script: |
if exist "$(tmpDir)" (
rmdir /S /Q $(tmpDir)
)
mkdir $(tmpDir)
displayName: 'Setup TMP Directory'
- checkout: self
clean: true
submodules: false
- script: |
cd $(Build.SourcesDirectory)
git clean --quiet -x -d -f -f
displayName: 'Clean after checkout'
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=amd64 -arch=amd64 -no_logo
cmake -G Ninja -S $(Build.SourcesDirectory)/tools -B $(tmpDir)/format-validate-build
cmake --build $(tmpDir)/format-validate-build
displayName: 'Build format and validation'
timeoutInMinutes: 5
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=amd64 -arch=amd64 -no_logo
cmake --build $(tmpDir)/format-validate-build --target run-format
displayName: 'clang-format Files'
timeoutInMinutes: 5
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- script: |
call "%ProgramFiles%\Microsoft Visual Studio\2022\Preview\Common7\Tools\VsDevCmd.bat" ^
-host_arch=amd64 -arch=amd64 -no_logo
cmake --build $(tmpDir)/format-validate-build --target run-validate
displayName: 'Validate Files'
timeoutInMinutes: 2
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- task: Powershell@2
displayName: 'Create Diff'
inputs:
filePath: azure-devops/create-prdiff.ps1
pwsh: false
condition: succeededOrFailed()
env: { TMP: $(tmpDir), TEMP: $(tmpDir) }
- template: azure-devops/format-validation.yml

- stage: Build_And_Test_x64
dependsOn: Code_Format
Expand Down