diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d5b75aece..e339f52bb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -192,8 +192,13 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - name: Test generated Windows installer - shell: ${{ matrix.shell }} + - name: Test generated Windows installer (powershell) + if: matrix.shell == 'powershell' + shell: powershell + run: ./scripts/test-windows-installer.ps1 + - name: Test generated Windows installer (pwsh) + if: matrix.shell == 'pwsh' + shell: pwsh run: ./scripts/test-windows-installer.ps1 test-cli: if: always() && needs.detect-targets.outputs.run-cli == 'true' diff --git a/scripts/test-windows-installer.ps1 b/scripts/test-windows-installer.ps1 index c95aa9d09..8428ca494 100644 --- a/scripts/test-windows-installer.ps1 +++ b/scripts/test-windows-installer.ps1 @@ -54,7 +54,12 @@ function Invoke-Installer { } $global:InstallerTestArchive = $Sandbox.Archive $global:InstallerTestDownloads = @() - & $InstallerPath *>&1 | ForEach-Object { "$_" } + $global:InstallerTestOutput = @() + & $InstallerPath *>&1 | ForEach-Object { + $line = "$_" + $global:InstallerTestOutput += $line + $line + } } function global:Invoke-RestMethod { @@ -67,6 +72,8 @@ function global:Invoke-WebRequest { Copy-Item -LiteralPath $global:InstallerTestArchive -Destination $OutFile } +Import-Module Microsoft.PowerShell.Archive + $global:InstallerTestOpenHandle = $null function global:Expand-Archive { param([string]$Path, [string]$DestinationPath, [switch]$Force) @@ -77,6 +84,7 @@ function global:Expand-Archive { } } +$global:InstallerTestOutput = @() try { Write-Host '--- install succeeds and cleans up' $global:InstallerTestHoldExtractedBinary = $false @@ -106,6 +114,11 @@ try { Write-Host '--- skipping held-file cleanup case: open files can be deleted on this platform' } } +catch { + Write-Host '--- installer output' + $global:InstallerTestOutput | ForEach-Object { Write-Host " $_" } + throw +} finally { if ($global:InstallerTestOpenHandle) { $global:InstallerTestOpenHandle.Dispose()