ci: capture build output via Tee-Object for artifact retrieval

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-11 16:22:17 +00:00
parent 64a1d63656
commit 63090ce877
+18 -11
View File
@@ -77,29 +77,36 @@ jobs:
else { Set-Content -Path $csproj -Value $patched -NoNewline; Write-Host "Patched: $orig -> $env:THUMB" }
- name: Build (restore + compile)
# `msbuild /restore` runs restore and build in the same MSBuild process,
# so the package cache + project.assets.json + assembly resolution stay
# consistent (avoids NETSDK1064).
# /flp dumps detailed log to build.log so we can retrieve it via the
# Gitea Actions artifacts API even when MSBuild fails mid-target.
shell: powershell
run: |
msbuild OutlookAddin.sln /restore /t:Build /p:Configuration=Release /p:Platform="Any CPU" /m `
/flp:logfile=build.log`;verbosity=detailed `
/flp1:logfile=build-errors.log`;errorsonly `
/flp2:logfile=build-warnings.log`;warningsonly
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$msbuildArgs = @(
'OutlookAddin.sln',
'/restore',
'/t:Build',
'/p:Configuration=Release',
'/p:Platform="Any CPU"',
'/m',
'/flp:logfile=build.log;verbosity=detailed',
'/flp1:logfile=build-errors.log;errorsonly',
'/flp2:logfile=build-warnings.log;warningsonly'
)
& msbuild @msbuildArgs 2>&1 | Tee-Object -FilePath build.console.log
$code = $LASTEXITCODE
Write-Host "msbuild exit code: $code"
if ($code -ne 0) { exit $code }
- name: Upload build logs
if: always()
uses: actions/upload-artifact@v4
with:
name: build-logs-${{ github.run_id }}
name: build-logs-run${{ github.run_id }}
path: |
build.log
build-errors.log
build-warnings.log
build.console.log
retention-days: 7
if-no-files-found: warn
- name: Test
run: dotnet test src/OutlookAddin.Tests/OutlookAddin.Tests.csproj --configuration Release --no-build --logger "trx;LogFileName=test-results.trx"