Skip to content

Commit e2d0e4c

Browse files
committed
ci: reuse release artifact for Windows installer
Upload the Windows AMD64 archive from the existing Linux release build and test it in a lightweight Windows job. Avoid rebuilding the full cross-platform release matrix on the slow Windows runner.
1 parent d976d13 commit e2d0e4c

1 file changed

Lines changed: 66 additions & 43 deletions

File tree

.github/workflows/ci.yml

Lines changed: 66 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -61,49 +61,6 @@ jobs:
6161
test -n "$(subcommit --completion "$shell")"
6262
done
6363
64-
- name: Smoke-test Windows installer
65-
if: matrix.target == 'windows-amd64'
66-
shell: pwsh
67-
run: |
68-
$ErrorActionPreference = "Stop"
69-
$originalUserPath = [System.Environment]::GetEnvironmentVariable(
70-
"Path",
71-
[System.EnvironmentVariableTarget]::User
72-
)
73-
$installDir = Join-Path $PWD "installer-smoke"
74-
try {
75-
mise run release:snapshot
76-
$env:SUBCOMMIT_INSTALL_FIXTURES = (Resolve-Path dist).Path
77-
function Invoke-WebRequest {
78-
param(
79-
[switch]$UseBasicParsing,
80-
[string]$Uri,
81-
[string]$OutFile
82-
)
83-
$file = [System.IO.Path]::GetFileName($Uri)
84-
Copy-Item -LiteralPath (Join-Path $env:SUBCOMMIT_INSTALL_FIXTURES $file) `
85-
-Destination $OutFile
86-
}
87-
88-
New-Item -ItemType Directory -Path $installDir | Out-Null
89-
& ./assets/install.ps1 -InstallDir $installDir
90-
& "$installDir/subcommit.exe" --version
91-
if ($LASTEXITCODE -ne 0) {
92-
throw "installed subcommit.exe failed"
93-
}
94-
& "$installDir/git-subcommit.exe" --version
95-
if ($LASTEXITCODE -ne 0) {
96-
throw "installed git-subcommit.exe failed"
97-
}
98-
} finally {
99-
[System.Environment]::SetEnvironmentVariable(
100-
"Path",
101-
$originalUserPath,
102-
[System.EnvironmentVariableTarget]::User
103-
)
104-
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $installDir
105-
}
106-
10764
release-matrix:
10865
name: Cross-build release matrix
10966
runs-on: ubuntu-24.04
@@ -179,3 +136,69 @@ jobs:
179136
bash assets/install.sh -d "$PWD/installer-smoke/bin"
180137
installer-smoke/bin/subcommit --version
181138
installer-smoke/bin/git-subcommit --version
139+
140+
- name: Upload Windows installer fixture
141+
uses: actions/upload-artifact@v7.0.1
142+
with:
143+
name: windows-installer-fixture
144+
path: |
145+
dist/checksums.txt
146+
dist/subcommit_*_Windows_x86_64.zip
147+
if-no-files-found: error
148+
retention-days: 1
149+
compression-level: 0
150+
151+
windows-installer:
152+
name: Windows installer
153+
needs: release-matrix
154+
runs-on: windows-2025
155+
steps:
156+
- uses: actions/checkout@v6.1.0
157+
with:
158+
persist-credentials: false
159+
160+
- uses: actions/download-artifact@v8.0.1
161+
with:
162+
name: windows-installer-fixture
163+
path: dist
164+
165+
- name: Smoke-test Windows installer
166+
shell: pwsh
167+
run: |
168+
$ErrorActionPreference = "Stop"
169+
$originalUserPath = [System.Environment]::GetEnvironmentVariable(
170+
"Path",
171+
[System.EnvironmentVariableTarget]::User
172+
)
173+
$installDir = Join-Path $PWD "installer-smoke"
174+
try {
175+
$env:SUBCOMMIT_INSTALL_FIXTURES = (Resolve-Path dist).Path
176+
function Invoke-WebRequest {
177+
param(
178+
[switch]$UseBasicParsing,
179+
[string]$Uri,
180+
[string]$OutFile
181+
)
182+
$file = [System.IO.Path]::GetFileName($Uri)
183+
Copy-Item -LiteralPath (Join-Path $env:SUBCOMMIT_INSTALL_FIXTURES $file) `
184+
-Destination $OutFile
185+
}
186+
187+
New-Item -ItemType Directory -Path $installDir | Out-Null
188+
& ./assets/install.ps1 -InstallDir $installDir
189+
& "$installDir/subcommit.exe" --version
190+
if ($LASTEXITCODE -ne 0) {
191+
throw "installed subcommit.exe failed"
192+
}
193+
& "$installDir/git-subcommit.exe" --version
194+
if ($LASTEXITCODE -ne 0) {
195+
throw "installed git-subcommit.exe failed"
196+
}
197+
} finally {
198+
[System.Environment]::SetEnvironmentVariable(
199+
"Path",
200+
$originalUserPath,
201+
[System.EnvironmentVariableTarget]::User
202+
)
203+
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $installDir
204+
}

0 commit comments

Comments
 (0)