From 63090ce877ba1f124ecafeb1eaa15cd7c1446133 Mon Sep 17 00:00:00 2001 From: Chaim Date: Mon, 11 May 2026 16:22:17 +0000 Subject: [PATCH] ci: capture build output via Tee-Object for artifact retrieval Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitea/workflows/build.yml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 2e1a5d0..9fc5591 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -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"