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"
|
||||
run: |
|
||||
$ErrorActionPreference = "Continue"
|
||||
$buildLog = "dist/build.log"
|
||||
New-Item -ItemType Directory -Force -Path "dist" | Out-Null
|
||||
$repoRoot = (git rev-parse --show-toplevel).Trim()
|
||||
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
|
||||
$code = $LASTEXITCODE
|
||||
if ($code -ne 0) {
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user