Add error handling to Store-Symbols.ps1

macos_ci_fix
AnyOldName3 7 months ago
parent 10dbfe66b3
commit 5cb5d2e166

@ -1,3 +1,5 @@
$ErrorActionPreference = "Stop"
if (-Not (Test-Path CMakeCache.txt)) if (-Not (Test-Path CMakeCache.txt))
{ {
Write-Error "This script must be run from the build directory." Write-Error "This script must be run from the build directory."
@ -8,6 +10,9 @@ if (-Not (Test-Path .cmake\api\v1\reply\index-*.json) -Or -Not ((Get-Content -Ra
Write-Output "Running CMake query..." Write-Output "Running CMake query..."
New-Item -Type File -Force .cmake\api\v1\query\codemodel-v2 New-Item -Type File -Force .cmake\api\v1\query\codemodel-v2
cmake . cmake .
if ($LASTEXITCODE -ne 0) {
Write-Error "Command exited with code $LASTEXITCODE"
}
Write-Output "Done." Write-Output "Done."
} }
@ -45,13 +50,26 @@ finally
if (-not (Test-Path symstore-venv)) if (-not (Test-Path symstore-venv))
{ {
python -m venv symstore-venv python -m venv symstore-venv
if ($LASTEXITCODE -ne 0) {
Write-Error "Command exited with code $LASTEXITCODE"
}
} }
$symstoreVersion = "0.3.4" $symstoreVersion = "0.3.4"
if (-not (Test-Path symstore-venv\Scripts\symstore.exe) -or -not ((symstore-venv\Scripts\pip show symstore | Select-String '(?<=Version: ).*').Matches.Value -eq $symstoreVersion)) if (-not (Test-Path symstore-venv\Scripts\symstore.exe) -or -not ((symstore-venv\Scripts\pip show symstore | Select-String '(?<=Version: ).*').Matches.Value -eq $symstoreVersion))
{ {
symstore-venv\Scripts\pip install symstore==$symstoreVersion symstore-venv\Scripts\pip install symstore==$symstoreVersion
if ($LASTEXITCODE -ne 0) {
Write-Error "Command exited with code $LASTEXITCODE"
}
} }
$artifacts = $artifacts | Where-Object { Test-Path $_ } $artifacts = $artifacts | Where-Object { Test-Path $_ }
Write-Output "Storing symbols..." Write-Output "Storing symbols..."
symstore-venv\Scripts\symstore --compress --skip-published .\SymStore @artifacts symstore-venv\Scripts\symstore --compress --skip-published .\SymStore @artifacts
if ($LASTEXITCODE -ne 0) {
Write-Error "Command exited with code $LASTEXITCODE"
}
Write-Output "Done." Write-Output "Done."

Loading…
Cancel
Save