@@ -437,73 +437,6 @@ jobs:
437437 @{ Name='lite'; SC='false'; Suffix='-lite'; Edition='lite' }
438438 )
439439
440- function Test-FrontendSmoke {
441- param(
442- [Parameter(Mandatory = $true)]
443- [string]$ExePath,
444- [Parameter(Mandatory = $true)]
445- [string]$Label
446- )
447-
448- function Get-StatusCode {
449- param([string]$Url)
450- try {
451- return [int](Invoke-WebRequest -Uri $Url -UseBasicParsing -TimeoutSec 2).StatusCode
452- } catch {
453- if ($_.Exception.Response) {
454- return [int]$_.Exception.Response.StatusCode
455- }
456- return $null
457- }
458- }
459-
460- $probeRoot = Join-Path $env:RUNNER_TEMP ("xunitytoolkit-smoke-" + [guid]::NewGuid().ToString('N'))
461- $launcherDir = Join-Path $env:RUNNER_TEMP ("xunitytoolkit-launcher-" + [guid]::NewGuid().ToString('N'))
462- $port = Get-Random -Minimum 42000 -Maximum 52000
463- $proc = $null
464-
465- try {
466- New-Item -ItemType Directory -Path $probeRoot -Force | Out-Null
467- New-Item -ItemType Directory -Path $launcherDir -Force | Out-Null
468-
469- $settings = @{ aiTranslation = @{ port = $port } } | ConvertTo-Json -Depth 3
470- Set-Content -Path (Join-Path $probeRoot 'settings.json') -Value $settings -Encoding UTF8
471-
472- $env:AppData__Root = $probeRoot
473- $proc = Start-Process -FilePath $ExePath -WorkingDirectory $launcherDir -PassThru
474-
475- $rootStatus = $null
476- $apiStatus = $null
477- for ($i = 0; $i -lt 40; $i++) {
478- Start-Sleep -Milliseconds 500
479- $rootStatus = Get-StatusCode "http://127.0.0.1:$port/"
480- $apiStatus = Get-StatusCode "http://127.0.0.1:$port/api/settings/version"
481- if ($null -ne $rootStatus -and $null -ne $apiStatus) {
482- break
483- }
484- }
485-
486- if ($rootStatus -ne 200 -or $apiStatus -ne 200) {
487- $rootText = if ($null -eq $rootStatus) { 'n/a' } else { [string]$rootStatus }
488- $apiText = if ($null -eq $apiStatus) { 'n/a' } else { [string]$apiStatus }
489- throw ("Smoke check failed for {0}: root={1} api={2}" -f $Label, $rootText, $apiText)
490- }
491-
492- Write-Host ("Smoke check passed for {0} (root={1}, api={2})" -f $Label, $rootStatus, $apiStatus)
493- } finally {
494- if ($proc -and -not $proc.HasExited) {
495- Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue
496- }
497- Remove-Item Env:AppData__Root -ErrorAction SilentlyContinue
498- if (Test-Path $probeRoot) {
499- Remove-Item $probeRoot -Recurse -Force -ErrorAction SilentlyContinue
500- }
501- if (Test-Path $launcherDir) {
502- Remove-Item $launcherDir -Recurse -Force -ErrorAction SilentlyContinue
503- }
504- }
505- }
506-
507440 foreach ($ed in $editions) {
508441 $outDir = "Release\win-x64$($ed.Suffix)"
509442 Write-Host "`n--- Publishing edition: $($ed.Name) ---"
@@ -550,8 +483,6 @@ jobs:
550483 Copy-Item $updaterExe "$outDir/" -Force
551484 }
552485
553- Test-FrontendSmoke -ExePath (Join-Path $outDir "XUnityToolkit-WebUI.exe") -Label $ed.Name
554-
555486 $exeFile = Get-Item (Join-Path $outDir "XUnityToolkit-WebUI.exe")
556487 $sizeMB = [math]::Round($exeFile.Length / 1MB, 1)
557488 Write-Host "$($ed.Name) done (exe: $sizeMB MB)"
0 commit comments