Skip to content

Commit 7c843f1

Browse files
committed
ci: validate ARM64 artifact instead of running on x64 runner
1 parent 0e410f5 commit 7c843f1

1 file changed

Lines changed: 25 additions & 15 deletions

File tree

.github/workflows/ci_windows_arm64_native.yaml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ jobs:
287287
name: ${{ matrix.artifact_name }}
288288
path: artifact
289289

290-
- name: Run qBittorrent smoke test
290+
- name: Validate ARM64 qBittorrent artifact
291291
shell: pwsh
292292
run: |
293293
$zipFile = Get-ChildItem artifact -Filter "qbittorrent_*.zip" -File | Select-Object -First 1
@@ -304,26 +304,36 @@ jobs:
304304
throw "qbittorrent.exe was not found after extracting the build artifact"
305305
}
306306
307-
$profileDir = Join-Path $smokeRoot "profile"
308-
New-Item -ItemType Directory -Path $profileDir -Force | Out-Null
307+
$qtConfPath = Join-Path $smokeRoot "qt.conf"
308+
if (-not (Test-Path $qtConfPath)) {
309+
throw "qt.conf was not found after extracting the build artifact"
310+
}
311+
312+
$exeBytes = [System.IO.File]::ReadAllBytes($exePath)
313+
if ($exeBytes.Length -lt 0x40) {
314+
throw "qbittorrent.exe is too small to be a valid PE file"
315+
}
309316
310-
$process = Start-Process -FilePath $exePath -ArgumentList @("--profile=$profileDir") -WorkingDirectory $smokeRoot -PassThru
311-
try {
312-
Wait-Process -Id $process.Id -Timeout 45 -ErrorAction Stop
313-
} catch {
314-
if (-not $process.HasExited) {
315-
Stop-Process -Id $process.Id -Force
316-
Write-Host "qBittorrent stayed alive for the smoke-test window"
317-
return
318-
}
317+
if ($exeBytes[0] -ne 0x4D -or $exeBytes[1] -ne 0x5A) {
318+
throw "qbittorrent.exe is missing the MZ header"
319+
}
319320
320-
throw
321+
$peOffset = [System.BitConverter]::ToInt32($exeBytes, 0x3C)
322+
if ($peOffset -lt 0 -or ($peOffset + 6) -ge $exeBytes.Length) {
323+
throw "qbittorrent.exe has an invalid PE header offset"
321324
}
322325
323-
if ($process.ExitCode -ne 0) {
324-
throw "qBittorrent exited with code $($process.ExitCode) during the smoke test"
326+
if ($exeBytes[$peOffset] -ne 0x50 -or $exeBytes[$peOffset + 1] -ne 0x45 -or $exeBytes[$peOffset + 2] -ne 0x00 -or $exeBytes[$peOffset + 3] -ne 0x00) {
327+
throw "qbittorrent.exe is missing the PE signature"
325328
}
326329
330+
$machine = [System.BitConverter]::ToUInt16($exeBytes, $peOffset + 4)
331+
if ($machine -ne 0xAA64) {
332+
throw "Expected ARM64 machine type 0xAA64, got 0x$('{0:X4}' -f $machine)"
333+
}
334+
335+
Write-Host "Artifact validation passed: qbittorrent.exe is ARM64 (machine 0x$('{0:X4}' -f $machine))."
336+
327337
publish-release:
328338
name: Publish release assets
329339
needs: build-windows-arm64-native

0 commit comments

Comments
 (0)