11# Windows on ARM: package the ARM64 release the way release.yml does (built natively on the
22# self-hosted Windows on ARM runner, unsigned here), then install that MSI on a Windows 11 ARM64 runner, check the installed
3- # binaries are ARM64, run the CLI natively, and uninstall. (A native ARM64 `cargo test` job is left
3+ # binaries are ARM64, run the CLI natively, and uninstall. A second MSI, one patch version higher,
4+ # is packaged too (same binaries): the install job upgrades to it, so the MajorUpgrade sequence
5+ # and the Start-menu shortcut surviving an upgrade are checked on a real Windows.
6+ # (A native ARM64 `cargo test` job is left
47# out for now: PdfCraft saw an intermittent access violation in egui UI tests there.)
58name : Windows ARM64
69
@@ -122,16 +125,39 @@ jobs:
122125 env :
123126 DIST : ${{ github.workspace }}\dist\arm64
124127 CRAFT_FONTS_DIR : ${{ github.workspace }}\craft-fonts
125- run : ./packaging/windows/package.ps1 -Arch arm64
128+ run : |
129+ ./packaging/windows/package.ps1 -Arch arm64
130+ # A second MSI one patch version higher (same binaries, a higher ProductVersion) for the
131+ # install job's upgrade test: a higher version is what users' updates are, and it takes
132+ # the MajorUpgrade path (the old product is unregistered, a new ProductCode installed).
133+ # The version is read the way package.ps1 falls back to reading it; PACKAGE_VERSION is
134+ # package.ps1's override for it, and -SkipBuild reuses the binaries just built.
135+ $ErrorActionPreference = 'Stop'
136+ $inPkg = $false; $workspaceVersion = $null
137+ foreach ($line in Get-Content Cargo.toml) {
138+ if ($line -match '^\s*\[') { $inPkg = ($line.Trim() -eq '[workspace.package]'); continue }
139+ if ($inPkg -and $line -match '^\s*version\s*=\s*"([^"]+)"') { $workspaceVersion = $Matches[1]; break }
140+ }
141+ if (-not $workspaceVersion) { throw 'could not read [workspace.package] version from Cargo.toml' }
142+ $n = ($workspaceVersion -split '-')[0] -split '\.'
143+ $env:DIST = "${env:DIST}-upgrade"
144+ $env:PACKAGE_VERSION = '{0}.{1}.{2}' -f [int]$n[0], [int]$n[1], ([int]$n[2] + 1)
145+ ./packaging/windows/package.ps1 -Arch arm64 -SkipBuild
126146 - uses : actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
127147 with :
128148 name : app-windows-arm64
129149 path : dist/arm64/*
130150 if-no-files-found : error
131151 retention-days : 7
152+ - uses : actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
153+ with :
154+ name : app-windows-arm64-upgrade
155+ path : dist/arm64-upgrade/*.msi
156+ if-no-files-found : error
157+ retention-days : 7
132158
133159 install :
134- name : install and run on ARM64
160+ name : install, upgrade and run on ARM64
135161 needs : package
136162 # Self-hosted Windows on ARM runner (SNAPDRAGON).
137163 runs-on : [self-hosted, Windows, ARM64, lcc]
@@ -143,7 +169,11 @@ jobs:
143169 with :
144170 name : app-windows-arm64
145171 path : dist
146- - name : Install the MSI, check it, run it, uninstall it
172+ - uses : actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
173+ with :
174+ name : app-windows-arm64-upgrade
175+ path : dist-upgrade
176+ - name : Install the MSI and check the installed binaries and shortcut
147177 shell : pwsh
148178 run : |
149179 $ErrorActionPreference = 'Stop'
@@ -162,12 +192,60 @@ jobs:
162192 if ($machine -ne 0xAA64) { throw "$exe is for machine 0x$('{0:X}' -f $machine), not ARM64" }
163193 Write-Output "ok $path (ARM64)"
164194 }
195+ # The Start-menu shortcut must be a plain link, not an advertised one: WScript.Shell
196+ # reads an empty TargetPath from advertised shortcuts, and a taskbar pin copied from one
197+ # stops working after an upgrade unregisters the product it advertises.
198+ $lnk = Join-Path ([Environment]::GetFolderPath('CommonPrograms')) "$($Brand.display_name).lnk"
199+ if (-not (Test-Path $lnk)) { throw "Start-menu shortcut not installed: $lnk" }
200+ $target = (New-Object -ComObject WScript.Shell).CreateShortcut($lnk).TargetPath
201+ if (-not $target) { throw "$lnk is advertised (no TargetPath); it must name the installed exe" }
202+ if (-not (Test-Path $target)) { throw "$lnk points at '$target', which does not exist" }
203+ if ((Resolve-Path $target).Path -ine (Resolve-Path (Join-Path $dir $appExe)).Path) {
204+ throw "$lnk points at '$target', expected '$dir\$appExe'"
205+ }
206+ Write-Output "ok shortcut $lnk -> $target"
165207 # The installed CLI runs natively on ARM64.
166208 $cli = Join-Path $dir $cliExe
167209 $out = & $cli --version 2>&1 | Out-String
168210 if ($LASTEXITCODE -ne 0) { Write-Output $out; throw "$cliExe --version exited $LASTEXITCODE" }
169211 Write-Output "ok $cliExe --version: $($out.Trim())"
170- $p = Start-Process msiexec.exe -ArgumentList '/x', "`"$msi`"", '/qn' -Wait -PassThru
212+ - name : Upgrade to the higher-version MSI and check the shortcut survives it
213+ shell : pwsh
214+ run : |
215+ $ErrorActionPreference = 'Stop'
216+ . ./packaging/windows/brand.ps1
217+ $appExe = "$($Brand.binary).exe"
218+ $dir = Join-Path $env:ProgramFiles $Brand.display_name
219+ $msiB = (Get-ChildItem dist-upgrade/*.msi | Select-Object -First 1).FullName
220+ # A higher ProductVersion over the installed one: the MajorUpgrade path every update
221+ # takes (old product unregistered, new ProductCode installed).
222+ $p = Start-Process msiexec.exe -ArgumentList '/i', "`"$msiB`"", '/qn', '/l*v', 'upgrade.log' -Wait -PassThru
223+ if ($p.ExitCode -ne 0) { Get-Content upgrade.log -Tail 60; throw "upgrade msiexec /i exited $($p.ExitCode)" }
224+ Write-Output "ok upgraded to $(Split-Path $msiB -Leaf)"
225+ if (-not (Test-Path (Join-Path $dir $appExe))) { throw "upgrade lost $appExe in $dir" }
226+ # The shortcut still resolves, to the installed exe: WScript.Shell reads an empty target
227+ # from an advertised shortcut (this is the regression guard), and a taskbar pin copied
228+ # from one stops working once the upgrade replaces the product it advertises.
229+ $lnk = Join-Path ([Environment]::GetFolderPath('CommonPrograms')) "$($Brand.display_name).lnk"
230+ if (-not (Test-Path $lnk)) { throw "Start-menu shortcut lost by the upgrade: $lnk" }
231+ $target = (New-Object -ComObject WScript.Shell).CreateShortcut($lnk).TargetPath
232+ if (-not $target) { throw "$lnk no longer names its target (advertised again?)" }
233+ if (-not (Test-Path $target)) { throw "$lnk points at '$target', which the upgrade left missing" }
234+ if ((Resolve-Path $target).Path -ine (Resolve-Path (Join-Path $dir $appExe)).Path) {
235+ throw "$lnk points at '$target', expected '$dir\$appExe'"
236+ }
237+ Write-Output "ok shortcut survives the upgrade: $lnk -> $target"
238+ - name : Uninstall and check everything goes
239+ shell : pwsh
240+ run : |
241+ $ErrorActionPreference = 'Stop'
242+ . ./packaging/windows/brand.ps1
243+ $appExe = "$($Brand.binary).exe"
244+ $dir = Join-Path $env:ProgramFiles $Brand.display_name
245+ $msiB = (Get-ChildItem dist-upgrade/*.msi | Select-Object -First 1).FullName
246+ $p = Start-Process msiexec.exe -ArgumentList '/x', "`"$msiB`"", '/qn' -Wait -PassThru
171247 if ($p.ExitCode -ne 0) { throw "msiexec /x exited $($p.ExitCode)" }
172248 if (Test-Path (Join-Path $dir $appExe)) { throw "uninstall left $appExe behind" }
249+ $lnk = Join-Path ([Environment]::GetFolderPath('CommonPrograms')) "$($Brand.display_name).lnk"
250+ if (Test-Path $lnk) { throw "uninstall left the Start-menu shortcut behind: $lnk" }
173251 Write-Output 'ok uninstalled'
0 commit comments