Skip to content

Commit c7474ab

Browse files
committed
ci(release): smoke-test the Windows resource monitor on target hardware
1 parent 14e41be commit c7474ab

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎.github/workflows/release-desktop.yml‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,3 +741,29 @@ jobs:
741741
if: inputs.cli_archive
742742
shell: bash
743743
run: node verify/smoke-cli-archive.mjs --archive release-cli/* --expect-version "${{ inputs.version }}"
744+
745+
# cargo-xwin links this binary on Linux, and nothing else runs it before users do.
746+
- name: Smoke-test resource monitor
747+
shell: pwsh
748+
run: |
749+
$startInfo = [System.Diagnostics.ProcessStartInfo]::new(
750+
"verify\${{ inputs.platform }}-${{ inputs.arch }}-unpacked\resources\resource-monitor\t3-resource-monitor.exe")
751+
$startInfo.UseShellExecute = $false
752+
$startInfo.RedirectStandardInput = $true
753+
$startInfo.RedirectStandardOutput = $true
754+
$monitor = [System.Diagnostics.Process]::Start($startInfo)
755+
$hello = $monitor.StandardOutput.ReadLine() | ConvertFrom-Json
756+
if ($hello.type -ne "hello" -or $hello.arch -ne "${{ inputs.arch == 'arm64' && 'aarch64' || 'x86_64' }}") {
757+
throw "Unexpected hello: $($hello | ConvertTo-Json -Compress)"
758+
}
759+
$monitor.StandardInput.WriteLine((@{ version = $hello.version; type = "configure"; rootPid = $PID; sampleIntervalMs = 1000 } | ConvertTo-Json -Compress))
760+
$monitor.StandardInput.WriteLine((@{ version = $hello.version; type = "sampleNow"; requestId = "verify" } | ConvertTo-Json -Compress))
761+
$monitor.StandardInput.Close()
762+
$output = $monitor.StandardOutput.ReadToEnd()
763+
$monitor.WaitForExit()
764+
$sample = $output -split "`n" | Where-Object { $_.Trim() } | ForEach-Object { $_ | ConvertFrom-Json } |
765+
Where-Object { $_.requestId -eq "verify" }
766+
if ($monitor.ExitCode -ne 0 -or $sample.type -ne "snapshot" -or -not ($sample.processes | Where-Object { $_.pid -eq $PID })) {
767+
throw "Resource monitor exited $($monitor.ExitCode) with: $output"
768+
}
769+
"Resource monitor sampled $($sample.scannedProcessCount) processes."

0 commit comments

Comments
 (0)