|
13 | 13 | steps: |
14 | 14 | - name: Check Formatting |
15 | 15 | run: | |
16 | | - if (!(Test-Path "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat")) { |
17 | | - Write-Host ERROR: Could not locate 'vcvars' batch file. This script is intended to be run from a build machine |
18 | | - exit 1 |
19 | | - } |
20 | | - |
21 | | - & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" |
22 | | -
|
23 | | - $repoRoot = "$env:GITHUB_WORKSPACE\.." |
24 | | - Write-Host "The root of the repository is $repoRoot" |
25 | | -
|
26 | | - & $repoRoot\find_clang_format.cmd |
27 | | - if ($LASTEXITCODE -ne 0) { |
28 | | - exit $LASTEXITCODE |
29 | | - } |
30 | | -
|
31 | | - & git clang-format origin/master --binary "$env:CLANG_FORMAT" --style file -- $repoRoot/cppwinrt/*.h $repoRoot/cppwinrt/*.cpp $repoRoot/fast_fwd/*.h $repoRoot/fast_fwd/*.cpp $repoRoot/prebuild/*.h $repoRoot/prebuild/*.cpp $repoRoot/scratch/*.h $repoRoot/scratch/*.cpp $repoRoot/strings/*.h $repoRoot/strings/*.cpp $repoRoot/test/*.h $repoRoot/test/*.cpp $repoRoot/vsix/*.h $repoRoot/vsix/*.cpp |
32 | | -
|
33 | | - if ($LASTEXITCODE -ne 0) { |
34 | | - Write-Host ::error ERROR: This branch contains changes that have not been formatted with `'clang-format`' |
35 | | - Write-Host NOTE: To resolve this issue, you can run `'clang-format`' in the following ways: |
36 | | - Write-Host * Run ``build_test_all.cmd`` which will run `'clang-format`' on _all_ source files. This script is |
37 | | - Write-Host simpler to run, however there`'s a chance it may touch additional files you never changed due to you having |
38 | | - Write-Host a mis-matched version of `'clang-format`'. This may require you to manually revert changes made by |
39 | | - Write-Host `'clang-format`' to the locations where you made no code changes. |
40 | | - Write-Host |
41 | | - Write-Host For more information, please see https://github.com/microsoft/cppwinrt?tab=readme-ov-file#formatting |
42 | | - Write-Host |
43 | | - Write-Host NOTE: As an additional note, given that different versions of `'clang-format`' may have different behaviors, this |
44 | | - Write-Host may be a false positive. If you believe that to be the case ^`(e.g. none of the above resulted in modifications |
45 | | - Write-Host to the code you have changed^`), please note this in your PR. |
46 | | - exit 1 |
47 | | - } |
| 16 | + cmd /c "powershell CheckClangFormatting.ps1" |
48 | 17 |
|
49 | 18 | test-msvc-cppwinrt-build: |
50 | 19 | name: '${{ matrix.compiler }}: Build (${{ matrix.arch }}, ${{ matrix.config }})' |
|
0 commit comments