Skip to content

Commit df56f17

Browse files
committed
GH run is PowerShell instead of cmd, convert language
1 parent b101af1 commit df56f17

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,35 @@ jobs:
1313
steps:
1414
- name: Check Formatting
1515
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.
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 /B 1
19+
}
20+
21+
& "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
22+
23+
& .\find_clang_format.cmd
24+
if $($LASTEXITCODE -ne 0) {
25+
exit /b $LASTEXITCODE
26+
}
27+
28+
& git clang-format origin/master --binary "$env: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
29+
30+
if ($LASTEXITCODE -ne 0) {
31+
Write-Host ::error ERROR: This branch contains changes that have not been formatted with 'clang-format'
32+
Write-Host NOTE: To resolve this issue, you can run 'clang-format' in the following ways:
33+
Write-Host * Run `build_test_all.cmd` which will run 'clang-format' on _all_ source files. This script is
34+
Write-Host simpler to run, however there's a chance it may touch additional files you never changed due to you having
35+
Write-Host a mis-matched version of 'clang-format'. This may require you to manually revert changes made by
36+
Write-Host 'clang-format' to the locations where you made no code changes.
37+
Write-Host
38+
Write-Host For more information, please see https://github.com/microsoft/cppwinrt?tab=readme-ov-file#formatting
39+
Write-Host
40+
Write-Host NOTE: As an additional note, given that different versions of 'clang-format' may have different behaviors, this
41+
Write-Host may be a false positive. If you believe that to be the case ^(e.g. none of the above resulted in modifications
42+
Write-Host to the code you have changed^), please note this in your PR.
3943
exit /b 1
40-
)
44+
}
4145
4246
test-msvc-cppwinrt-build:
4347
name: '${{ matrix.compiler }}: Build (${{ matrix.arch }}, ${{ matrix.config }})'

0 commit comments

Comments
 (0)