ci: add Windows testbox probe

This commit is contained in:
Vincent Koc
2026-05-03 21:17:49 -07:00
parent 09e7eb6687
commit 9dc3271efb

View File

@@ -0,0 +1,111 @@
name: Windows Testbox Probe
on:
workflow_dispatch:
inputs:
target_ref:
description: "Git ref or SHA to check out"
required: false
default: "main"
type: string
keepalive_minutes:
description: "Minutes to keep the Windows runner alive for SSH inspection"
required: false
default: "20"
type: string
require_wsl2:
description: "Fail the run when WSL2 is unavailable"
required: false
default: false
type: boolean
permissions:
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
probe:
name: Windows probe
runs-on: ${{ github.repository == 'openclaw/openclaw' && 'blacksmith-16vcpu-windows-2025' || 'windows-2025' }}
timeout-minutes: 75
defaults:
run:
shell: pwsh
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ inputs.target_ref || github.ref }}
persist-credentials: false
submodules: false
- name: Probe native Windows
run: |
$ErrorActionPreference = "Stop"
Write-Host "runner=$env:RUNNER_NAME"
Write-Host "machine=$env:COMPUTERNAME"
Write-Host "workspace=$env:GITHUB_WORKSPACE"
Write-Host "target_ref=${{ inputs.target_ref || github.ref }}"
Write-Host ("os=" + [System.Environment]::OSVersion.VersionString)
Write-Host ("arch=" + [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)
Write-Host ("powershell=" + $PSVersionTable.PSVersion.ToString())
cmd.exe /c ver
git --version
- name: Probe WSL2
id: wsl2
run: |
$ErrorActionPreference = "Continue"
$ok = $false
$wsl = Get-Command wsl.exe -ErrorAction SilentlyContinue
if (-not $wsl) {
Write-Warning "wsl.exe is not available on this runner."
} else {
Write-Host "wsl.exe=$($wsl.Source)"
wsl.exe --status
Write-Host "wsl_status_exit=$LASTEXITCODE"
wsl.exe --list --verbose
Write-Host "wsl_list_exit=$LASTEXITCODE"
wsl.exe --exec bash -lc 'set -euo pipefail; uname -a; if [ -f /etc/os-release ]; then sed -n "1,8p" /etc/os-release; fi'
if ($LASTEXITCODE -eq 0) {
$ok = $true
}
Write-Host "wsl_exec_exit=$LASTEXITCODE"
}
if ($ok) {
"wsl2_ok=true" >> $env:GITHUB_OUTPUT
"OPENCLAW_WSL2_PROBE_OK=true" >> $env:GITHUB_ENV
Write-Host "wsl2_ok=true"
} else {
"wsl2_ok=false" >> $env:GITHUB_OUTPUT
"OPENCLAW_WSL2_PROBE_OK=false" >> $env:GITHUB_ENV
Write-Warning "wsl2_ok=false"
}
- name: Keep runner alive for SSH inspection
env:
KEEPALIVE_MINUTES: ${{ inputs.keepalive_minutes }}
run: |
$ErrorActionPreference = "Stop"
$minutes = 20
if ($env:KEEPALIVE_MINUTES -match '^\d+$') {
$minutes = [int]$env:KEEPALIVE_MINUTES
}
$minutes = [Math]::Max(0, [Math]::Min($minutes, 60))
Write-Host "keepalive_minutes=$minutes"
for ($i = 1; $i -le $minutes; $i++) {
Write-Host "keepalive minute $i/$minutes"
Start-Sleep -Seconds 60
}
- name: Enforce WSL2 requirement
if: ${{ inputs.require_wsl2 }}
run: |
if ($env:OPENCLAW_WSL2_PROBE_OK -ne "true") {
Write-Error "WSL2 probe failed or WSL2 is unavailable on this Windows runner."
exit 1
}