|
7 | 7 | - master |
8 | 8 |
|
9 | 9 | jobs: |
10 | | -- job: CheckFormatting |
11 | | - |
12 | | - pool: |
13 | | - vmImage: 'windows-2022' |
14 | | - |
15 | | - steps: |
16 | | - - script: | |
17 | | - if NOT EXIST "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" ( |
18 | | - echo ERROR: Could not locate 'vcvars' batch file. This script is intended to be run from a build machine & exit /B 1 |
19 | | - ) |
20 | | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" |
21 | | -
|
22 | | - call find_clang_format.cmd |
23 | | - if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% |
24 | | -
|
25 | | - git clang-format origin/master --binary "%CLANG_FORMAT%" --style file -- cppwinrt/*.h cppwinrt/*.cpp fast_fwd/*.h fast_fwd/*.cpp prebuild/*.h prebuild/*.cpp scratch/*.h scratch/*.cpp strings/*.h strings/*.cpp test/*.h test/*.cpp vsix/*.h vsix/*.cpp |
26 | | -
|
27 | | - if %ERRORLEVEL% neq 0 ( |
28 | | - echo ##vso[task.logissue type=error]ERROR: This branch contains changes that have not been formatted with 'clang-format' |
29 | | - echo NOTE: To resolve this issue, you can run 'clang-format' in the following ways: |
30 | | - echo * Run `build_test_all.cmd` which will run 'clang-format' on _all_ source files. This script is |
31 | | - echo simpler to run, however there's a chance it may touch additional files you never changed due to you having |
32 | | - echo a mis-matched version of 'clang-format'. This may require you to manually revert changes made by |
33 | | - echo 'clang-format' to the locations where you made no code changes. |
34 | | - echo. |
35 | | - echo For more information, please see https://github.com/microsoft/cppwinrt?tab=readme-ov-file#formatting |
36 | | - echo. |
37 | | - echo NOTE: As an additional note, given that different versions of 'clang-format' may have different behaviors, this |
38 | | - echo may be a false positive. If you believe that to be the case ^(e.g. none of the above resulted in modifications |
39 | | - echo to the code you have changed^), please note this in your PR. |
40 | | - exit /b 1 |
41 | | - ) |
42 | | - displayName: 'Check Formatting of Changes' |
| 10 | + check-formatting: |
| 11 | + name: 'Check Formatting of Changes' |
| 12 | + runs-on: windows-latest |
| 13 | + steps: |
| 14 | + - name: Check Formatting |
| 15 | + run: | |
| 16 | + if NOT EXIST "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" ( |
| 17 | + echo ERROR: Could not locate 'vcvars' batch file. This script is intended to be run from a build machine & exit /B 1 |
| 18 | + ) |
| 19 | + call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" |
| 20 | +
|
| 21 | + call find_clang_format.cmd |
| 22 | + if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% |
| 23 | +
|
| 24 | + git clang-format origin/master --binary "%CLANG_FORMAT%" --style file -- cppwinrt/*.h cppwinrt/*.cpp fast_fwd/*.h fast_fwd/*.cpp prebuild/*.h prebuild/*.cpp scratch/*.h scratch/*.cpp strings/*.h strings/*.cpp test/*.h test/*.cpp vsix/*.h vsix/*.cpp |
| 25 | +
|
| 26 | + if %ERRORLEVEL% neq 0 ( |
| 27 | + echo ##vso[task.logissue type=error]ERROR: This branch contains changes that have not been formatted with 'clang-format' |
| 28 | + echo NOTE: To resolve this issue, you can run 'clang-format' in the following ways: |
| 29 | + echo * Run `build_test_all.cmd` which will run 'clang-format' on _all_ source files. This script is |
| 30 | + echo simpler to run, however there's a chance it may touch additional files you never changed due to you having |
| 31 | + echo a mis-matched version of 'clang-format'. This may require you to manually revert changes made by |
| 32 | + echo 'clang-format' to the locations where you made no code changes. |
| 33 | + echo. |
| 34 | + echo For more information, please see https://github.com/microsoft/cppwinrt?tab=readme-ov-file#formatting |
| 35 | + echo. |
| 36 | + echo NOTE: As an additional note, given that different versions of 'clang-format' may have different behaviors, this |
| 37 | + echo may be a false positive. If you believe that to be the case ^(e.g. none of the above resulted in modifications |
| 38 | + echo to the code you have changed^), please note this in your PR. |
| 39 | + exit /b 1 |
| 40 | + ) |
43 | 41 |
|
44 | 42 | test-msvc-cppwinrt-build: |
45 | 43 | name: '${{ matrix.compiler }}: Build (${{ matrix.arch }}, ${{ matrix.config }})' |
|
0 commit comments