95 lines
2.2 KiB
PowerShell
95 lines
2.2 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
$script:failed = @()
|
|
|
|
function Resolve-Go {
|
|
$cmd = Get-Command go -ErrorAction SilentlyContinue
|
|
if ($cmd) {
|
|
return $cmd.Source
|
|
}
|
|
foreach ($candidate in @('C:\Program Files\Go\bin\go.exe', 'C:\Go\bin\go.exe')) {
|
|
if (Test-Path -LiteralPath $candidate) {
|
|
return $candidate
|
|
}
|
|
}
|
|
throw 'Go executable not found. Install Go 1.23 or add it to PATH.'
|
|
}
|
|
|
|
function Invoke-Check {
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$Name,
|
|
[Parameter(Mandatory = $true)]
|
|
[scriptblock]$Command
|
|
)
|
|
|
|
Write-Host "[$Name]"
|
|
try {
|
|
& $Command
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "FAILED: $Name (exit $LASTEXITCODE)"
|
|
$script:failed += $Name
|
|
}
|
|
} catch {
|
|
Write-Host "FAILED: $Name - $($_.Exception.Message)"
|
|
$script:failed += $Name
|
|
}
|
|
}
|
|
|
|
$goExe = Resolve-Go
|
|
|
|
Push-Location (Join-Path $root 'server-go')
|
|
try {
|
|
Invoke-Check 'server-go test' { & $goExe test ./... }
|
|
Invoke-Check 'server-go vet' { & $goExe vet ./... }
|
|
Invoke-Check 'server-go build' { & $goExe build ./... }
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
|
|
Push-Location (Join-Path $root 'web')
|
|
try {
|
|
Invoke-Check 'web test' { npm test }
|
|
Invoke-Check 'web lint' { npm run lint }
|
|
Invoke-Check 'web build' { npm run build }
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
|
|
Push-Location (Join-Path $root 'miniapp')
|
|
try {
|
|
Invoke-Check 'miniapp typecheck' { npm run typecheck }
|
|
Invoke-Check 'miniapp build:weapp' { npm run build:weapp }
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
|
|
Push-Location (Join-Path $root 'app')
|
|
try {
|
|
Invoke-Check 'app typecheck' { npm run tsc }
|
|
Invoke-Check 'app lint' { npm run lint }
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
|
|
$aiPython = Join-Path $root 'ai-service\.venv\Scripts\python.exe'
|
|
if (-not (Test-Path -LiteralPath $aiPython)) {
|
|
$aiPython = 'python'
|
|
}
|
|
|
|
Push-Location (Join-Path $root 'ai-service')
|
|
try {
|
|
Invoke-Check 'ai-service pytest' { & $aiPython -m pytest }
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
|
|
if ($script:failed.Count -gt 0) {
|
|
Write-Error "Verification failed for: $($script:failed -join ', ')"
|
|
exit 1
|
|
}
|
|
|
|
Write-Host 'All verification checks passed.'
|
|
exit 0
|