Skip to content

Commit 77ec7f4

Browse files
authored
chore: use literal shells for the Windows installer CI matrix [skip changelog] (#136)
The Windows installer smoke-test job set `shell` from a matrix expression, which GitHub Actions rejects as an invalid workflow file, so the Test workflow no longer parses on main. The job now has one conditional step per matrix entry with a literal shell, so both `powershell` and `pwsh` still run as separate matrix jobs. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes the Windows installer smoke-test job so the Test workflow parses on main. GitHub Actions rejects `shell` values from matrix expressions, so the job now uses one conditional step per matrix entry with a literal shell, keeping `powershell` and `pwsh` as separate matrix jobs. The test script also loads the Archive module before replacing `Expand-Archive` and captures installer output as it streams, initializing it before the test body, so test failures print the output. <sup>Written for commit 3dc630b. Summary will update on new commits.</sup> <a href="https://cubic.dev/pr/speakeasy-api/openapi-generation/pull/136?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/speakeasy-api/openapi-generation/136?returnTo=https%3A%2F%2Fgithub.com%2Fspeakeasy-api%2Fopenapi-generation%2Fpull%2F136&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
1 parent b58a5a3 commit 77ec7f4

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

‎.github/workflows/test.yml‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,13 @@ jobs:
192192
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
193193
with:
194194
persist-credentials: false
195-
- name: Test generated Windows installer
196-
shell: ${{ matrix.shell }}
195+
- name: Test generated Windows installer (powershell)
196+
if: matrix.shell == 'powershell'
197+
shell: powershell
198+
run: ./scripts/test-windows-installer.ps1
199+
- name: Test generated Windows installer (pwsh)
200+
if: matrix.shell == 'pwsh'
201+
shell: pwsh
197202
run: ./scripts/test-windows-installer.ps1
198203
test-cli:
199204
if: always() && needs.detect-targets.outputs.run-cli == 'true'

‎scripts/test-windows-installer.ps1‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ function Invoke-Installer {
5454
}
5555
$global:InstallerTestArchive = $Sandbox.Archive
5656
$global:InstallerTestDownloads = @()
57-
& $InstallerPath *>&1 | ForEach-Object { "$_" }
57+
$global:InstallerTestOutput = @()
58+
& $InstallerPath *>&1 | ForEach-Object {
59+
$line = "$_"
60+
$global:InstallerTestOutput += $line
61+
$line
62+
}
5863
}
5964

6065
function global:Invoke-RestMethod {
@@ -67,6 +72,8 @@ function global:Invoke-WebRequest {
6772
Copy-Item -LiteralPath $global:InstallerTestArchive -Destination $OutFile
6873
}
6974

75+
Import-Module Microsoft.PowerShell.Archive
76+
7077
$global:InstallerTestOpenHandle = $null
7178
function global:Expand-Archive {
7279
param([string]$Path, [string]$DestinationPath, [switch]$Force)
@@ -77,6 +84,7 @@ function global:Expand-Archive {
7784
}
7885
}
7986

87+
$global:InstallerTestOutput = @()
8088
try {
8189
Write-Host '--- install succeeds and cleans up'
8290
$global:InstallerTestHoldExtractedBinary = $false
@@ -106,6 +114,11 @@ try {
106114
Write-Host '--- skipping held-file cleanup case: open files can be deleted on this platform'
107115
}
108116
}
117+
catch {
118+
Write-Host '--- installer output'
119+
$global:InstallerTestOutput | ForEach-Object { Write-Host " $_" }
120+
throw
121+
}
109122
finally {
110123
if ($global:InstallerTestOpenHandle) {
111124
$global:InstallerTestOpenHandle.Dispose()

0 commit comments

Comments
 (0)