Skip to content

Commit 3ab2c2f

Browse files
authored
Fix error reporting in Windows preset build job (#13247)
Update the Windows preset build job to accurately report failure. Previously, it was silently failing. I've updated the script to explicitly check the last exit code. I'm not entirely sure why ErrorActionPreference=Stop isn't doing this. I played around with the escaping a bit and also added PSNativeCommandUseErrorActionPreference = True, but haven't gotten it to fail on exit code. It might be possible to make this work, but I'm just adding an explicit check for now.
1 parent 3f483df commit 3ab2c2f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.github/workflows/build-presets.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,24 @@ jobs:
119119
set -eux
120120
conda init powershell
121121
powershell -Command "& {
122-
\$ErrorActionPreference = 'Stop'
123122
Set-PSDebug -Trace 1
123+
\$ErrorActionPreference = 'Stop'
124+
\$PSNativeCommandUseErrorActionPreference = \$true
124125
125126
conda create --yes --quiet -n et python=3.12
126127
conda activate et
127128
128129
python install_requirements.py
129130
cmake --preset ${{ matrix.preset }}
131+
if (\$LASTEXITCODE -ne 0) {
132+
Write-Host "CMake configuration was unsuccessful. Exit code: \$LASTEXITCODE."
133+
exit \$LASTEXITCODE
134+
}
135+
130136
\$numCores = [System.Environment]::GetEnvironmentVariable('NUMBER_OF_PROCESSORS') - 1
131137
cmake --build cmake-out -j \$numCores
138+
if (\$LASTEXITCODE -ne 0) {
139+
Write-Host "CMake build was unsuccessful. Exit code: \$LASTEXITCODE."
140+
exit \$LASTEXITCODE
141+
}
132142
}"

0 commit comments

Comments
 (0)