fix(ci): write build log to runner temp and enforce repo cwd
- run build step from git toplevel directory - store build.log under %RUNNER_TEMP% to avoid missing dist path - guard log dump when file is absent
This commit is contained in:
@@ -119,13 +119,22 @@ jobs:
|
|||||||
PYTHONIOENCODING: "utf-8"
|
PYTHONIOENCODING: "utf-8"
|
||||||
run: |
|
run: |
|
||||||
$ErrorActionPreference = "Continue"
|
$ErrorActionPreference = "Continue"
|
||||||
$buildLog = "dist/build.log"
|
$repoRoot = (git rev-parse --show-toplevel).Trim()
|
||||||
New-Item -ItemType Directory -Force -Path "dist" | Out-Null
|
if (-not [string]::IsNullOrWhiteSpace($repoRoot)) {
|
||||||
|
Set-Location $repoRoot
|
||||||
|
}
|
||||||
|
$logDir = Join-Path $env:RUNNER_TEMP "anabasis-build"
|
||||||
|
New-Item -ItemType Directory -Force -Path $logDir | Out-Null
|
||||||
|
$buildLog = Join-Path $logDir "build.log"
|
||||||
python build.py *>&1 | Tee-Object -FilePath $buildLog
|
python build.py *>&1 | Tee-Object -FilePath $buildLog
|
||||||
$code = $LASTEXITCODE
|
$code = $LASTEXITCODE
|
||||||
if ($code -ne 0) {
|
if ($code -ne 0) {
|
||||||
Write-Host "Build failed with exit code $code. Dumping build log:"
|
Write-Host "Build failed with exit code $code. Dumping build log:"
|
||||||
Get-Content -Path $buildLog -Raw
|
if (Test-Path $buildLog) {
|
||||||
|
Get-Content -Path $buildLog -Raw
|
||||||
|
} else {
|
||||||
|
Write-Host "Build log was not created: $buildLog"
|
||||||
|
}
|
||||||
exit $code
|
exit $code
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user