mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 06:13:14 -07:00
Perform clang-format on Azure
This commit is contained in:
parent
f6a6aae6e6
commit
885a194634
2 changed files with 41 additions and 0 deletions
|
@ -18,6 +18,10 @@ jobs:
|
||||||
parameters:
|
parameters:
|
||||||
platform: x64
|
platform: x64
|
||||||
|
|
||||||
|
- template: ./templates/clang-format.yaml
|
||||||
|
parameters:
|
||||||
|
platform: x64
|
||||||
|
|
||||||
- template: ./templates/build-app-public.yaml
|
- template: ./templates/build-app-public.yaml
|
||||||
parameters:
|
parameters:
|
||||||
platform: x86
|
platform: x86
|
||||||
|
|
37
build/pipelines/templates/clang-format.yaml
Normal file
37
build/pipelines/templates/clang-format.yaml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# Job for running clang-format on sources.
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
platform: ''
|
||||||
|
condition: ''
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- job: Format${{ parameters.platform }}
|
||||||
|
displayName: clang-format
|
||||||
|
pool:
|
||||||
|
vmImage: 'Ubuntu-16.04'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
# Download a recent, static build of clang-format. Be quiet, but don't hide errors.
|
||||||
|
wget --no-verbose https://github.com/angular/clang-format/raw/master/bin/linux_x64/clang-format
|
||||||
|
chmod a+x clang-format
|
||||||
|
# Make sure it identifies itself
|
||||||
|
./clang-format --version
|
||||||
|
# Parse full lines
|
||||||
|
export IFS=$'\n'
|
||||||
|
# For each file in repository with name ending with ".cpp" ...
|
||||||
|
for file in $(git ls-files | grep \\.cpp$); do
|
||||||
|
# ... print its name, in case clang-format throws some errors ...
|
||||||
|
echo Formatting "$file"
|
||||||
|
# ... and format it in place, so git can pick it up.
|
||||||
|
./clang-format -style=file -i "$file"
|
||||||
|
done
|
||||||
|
# Just some visual separation
|
||||||
|
echo -e "\\n\\n\\n\\tChecking diff...\\n\\n\\n"
|
||||||
|
# Set error mode. Makes bash bail on first non-zero exit code
|
||||||
|
set -e
|
||||||
|
# Print diff, if any and report with exit code.
|
||||||
|
git diff --exit-code
|
||||||
|
# When no diff present, provide status.
|
||||||
|
echo -e "\\tStyle is fine"
|
||||||
|
displayName: 'clang-format'
|
Loading…
Add table
Add a link
Reference in a new issue