disktree: test: build and check the Windows setup on every pull request

CI compiled nothing of the installer, so a broken disktree.iss would first
fail inside a release, after its draft exists, and the Arm64 setup had
never been built at all. The Windows job now compiles the x64 setup and
the Windows aarch64 job the Arm64 one; both run check-setup.ps1, which
installs it silently for the current user, checks the exe, Start menu and
desktop shortcuts and the uninstall entry, installs again as an upgrade
(one entry left), uninstalls and checks nothing remains.

install-inno.ps1 takes over the pinned, hash-checked Inno Setup install
from release.yml and now fails on a non-zero installer exit or a missing
ISCC.exe instead of leaving the next step to report it.

Verified locally on Windows 11 x64: both scripts pass, and the CI
Installer step body, run as written, compiles a 0.0.0 setup and reports
"setup installs, upgrades and uninstalls cleanly". Upgrading while
disktree runs closes it through Restart Manager without a reboot. The
Arm64 job has not run yet.
This commit is contained in:
Abdulwahb Isam
2026-10-16 09:02:06 +03:00
parent 7ee70c5846
commit c8a9336acb
5 changed files with 90 additions and 18 deletions
+25
View File
@@ -117,6 +117,18 @@ jobs:
throw "disktree.exe has no embedded icon"
}
# Here rather than only at release time, so a broken installer script
# fails the pull request instead of a release half-way through.
- name: Installer
shell: pwsh
run: |
packaging/windows/install-inno.ps1 -Dir "$env:RUNNER_TEMP\inno"
& "$env:RUNNER_TEMP\inno\ISCC.exe" /Q /DAppVersion=0.0.0 `
/DArch=x86_64 packaging/windows/disktree.iss
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
packaging/windows/check-setup.ps1 `
-Setup target/bundle/disktree-0.0.0-x86_64-windows-setup.exe
# The other half of each release: the same tests on the architectures
# the release builds for but the jobs above do not run on.
other-architectures:
@@ -152,3 +164,16 @@ jobs:
- name: Test
run: cargo xtask test
# The Arm64 setup, which no other job builds before a release does.
- name: Installer
if: runner.os == 'Windows'
shell: pwsh
run: |
cargo build --release --locked -p disktree-app
packaging/windows/install-inno.ps1 -Dir "$env:RUNNER_TEMP\inno"
& "$env:RUNNER_TEMP\inno\ISCC.exe" /Q /DAppVersion=0.0.0 `
/DArch=aarch64 packaging/windows/disktree.iss
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
packaging/windows/check-setup.ps1 `
-Setup target/bundle/disktree-0.0.0-aarch64-windows-setup.exe
+1 -17
View File
@@ -252,23 +252,7 @@ jobs:
- name: Install Inno Setup
shell: pwsh
# Pinned and checked rather than the runner's own: the two images
# carry different, older versions.
env:
INNO_URL: https://github.com/jrsoftware/issrc/releases/download/is-7_1_0/innosetup-7.1.0-x64.exe
INNO_SHA256: 0362a383ed217d4c4239b5933866dd96d3eb2102737da92f80f6057a4b40df2f
run: |
$setup = "$env:RUNNER_TEMP/innosetup.exe"
$dir = "$env:RUNNER_TEMP/inno"
Invoke-WebRequest $env:INNO_URL -OutFile $setup
$hash = (Get-FileHash $setup -Algorithm SHA256).Hash.ToLower()
if ($hash -ne $env:INNO_SHA256) {
throw "Inno Setup download has SHA256 $hash"
}
Start-Process $setup -Wait -ArgumentList `
'/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', '/SP-',
'/CURRENTUSER', "/DIR=$dir"
"$dir" >> $env:GITHUB_PATH
run: packaging/windows/install-inno.ps1 -Dir "$env:RUNNER_TEMP\inno"
- name: Installer
id: installer
+3 -1
View File
@@ -41,7 +41,9 @@ from `packaging/windows/disktree.iss` after `cargo build --release`:
`ISCC.exe /DAppVersion=<version> /DArch=x86_64 packaging\windows\disktree.iss`
writes `target\bundle\disktree-<version>-x86_64-windows-setup.exe`. Its
`AppId` is how upgrades and the uninstaller find an existing install; never
change it.
change it (`check-setup.ps1` names it too). CI installs the pinned Inno Setup
with `install-inno.ps1`, then compiles the setup on x64 and Arm64 and runs
`check-setup.ps1`, which installs, upgrades and uninstalls it.
`cargo xtask lint` is the gate. It must be green before anything is called
done, and it must not fix anything: a red local run is the same signal CI gives.
+39
View File
@@ -0,0 +1,39 @@
# Install a built setup silently for the current user, check what it put in
# place, install it again over itself as an upgrade, then uninstall and check
# that nothing is left. Exits non-zero on the first thing out of place.
param([Parameter(Mandatory)] [string] $Setup)
$ErrorActionPreference = 'Stop'
$app = Join-Path $env:LOCALAPPDATA 'Programs\disktree'
$exe = Join-Path $app 'disktree.exe'
$start = Join-Path ([Environment]::GetFolderPath('Programs')) 'disktree.lnk'
$desktop = Join-Path ([Environment]::GetFolderPath('Desktop')) 'disktree.lnk'
# The AppId in disktree.iss, as Inno Setup names its uninstall key.
$key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\' +
'{354830A5-B031-45DE-8595-4513BA422E5F}_is1'
$installed = @($exe, $start, $desktop, $key)
function Invoke-Quiet([string] $Path) {
$p = Start-Process $Path -Wait -PassThru -ArgumentList `
'/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', '/CURRENTUSER'
if ($p.ExitCode -ne 0) { throw "$Path exited $($p.ExitCode)" }
}
Invoke-Quiet $Setup
foreach ($path in $installed) {
if (-not (Test-Path $path)) { throw "not installed: $path" }
}
Invoke-Quiet $Setup
$entries = @(Get-ChildItem 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall' |
Where-Object PSChildName -Like '*354830A5-B031-45DE-8595-4513BA422E5F*')
if ($entries.Count -ne 1) { throw "upgrade left $($entries.Count) entries" }
Invoke-Quiet (Join-Path $app 'unins000.exe')
# The uninstaller hands the last deletions to a copy of itself that outlives
# the process waited on, so give it a moment before looking.
$deadline = (Get-Date).AddSeconds(30)
while ((Test-Path $app) -and (Get-Date) -lt $deadline) { Start-Sleep 1 }
foreach ($path in $installed + $app) {
if (Test-Path $path) { throw "left after uninstall: $path" }
}
Write-Output "setup installs, upgrades and uninstalls cleanly: $Setup"
+22
View File
@@ -0,0 +1,22 @@
# Install the pinned Inno Setup into -Dir for the current user and put it on
# the GitHub Actions PATH. Pinned and checked rather than the runner's own:
# the x64 and Arm64 images carry different, older versions.
param([Parameter(Mandatory)] [string] $Dir)
$ErrorActionPreference = 'Stop'
$url = 'https://github.com/jrsoftware/issrc/releases/download/is-7_1_0/innosetup-7.1.0-x64.exe'
$sha256 = '0362a383ed217d4c4239b5933866dd96d3eb2102737da92f80f6057a4b40df2f'
$setup = Join-Path ([IO.Path]::GetTempPath()) 'innosetup-7.1.0-x64.exe'
Invoke-WebRequest $url -OutFile $setup
$hash = (Get-FileHash $setup -Algorithm SHA256).Hash.ToLower()
if ($hash -ne $sha256) { throw "Inno Setup download has SHA256 $hash" }
$p = Start-Process $setup -Wait -PassThru -ArgumentList `
'/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', '/SP-',
'/CURRENTUSER', "/DIR=$Dir"
if ($p.ExitCode -ne 0) { throw "Inno Setup install exited $($p.ExitCode)" }
if (-not (Test-Path (Join-Path $Dir 'ISCC.exe'))) {
throw "ISCC.exe is missing from $Dir"
}
if ($env:GITHUB_PATH) { $Dir >> $env:GITHUB_PATH }