Files
http-client-app-plan/scripts/verify-all.ps1
T

91 lines
1.8 KiB
PowerShell

param(
[switch]$SkipAudit
)
$ErrorActionPreference = "Stop"
$root = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot "..")
function Invoke-Step {
param(
[string]$Name,
[scriptblock]$Command
)
Write-Host ""
Write-Host "==> $Name"
$global:LASTEXITCODE = 0
& $Command
if ($LASTEXITCODE -ne 0) {
throw "$Name failed with exit code $LASTEXITCODE."
}
}
function Invoke-External {
param(
[string]$FilePath,
[string[]]$Arguments
)
& $FilePath @Arguments
if ($LASTEXITCODE -ne 0) {
throw "$FilePath failed with exit code $LASTEXITCODE."
}
}
Invoke-Step "Backend tests" {
Push-Location (Join-Path $root "backend")
try {
go test ./...
}
finally {
Pop-Location
}
}
Invoke-Step "Frontend tests" {
Push-Location (Join-Path $root "frontend")
try {
npm test
}
finally {
Pop-Location
}
}
Invoke-Step "Frontend production build" {
Push-Location (Join-Path $root "frontend")
try {
npm run build
}
finally {
Pop-Location
}
}
Invoke-Step "Documentation verification" {
Invoke-External "powershell" @("-NoProfile", "-ExecutionPolicy", "Bypass", "-File", (Join-Path $root "scripts\verify-docs.ps1"))
}
Invoke-Step "API contract verification" {
Invoke-External "powershell" @("-NoProfile", "-ExecutionPolicy", "Bypass", "-File", (Join-Path $root "scripts\verify-api-contract.ps1"))
}
Invoke-Step "Backend smoke verification" {
Invoke-External "powershell" @("-NoProfile", "-ExecutionPolicy", "Bypass", "-File", (Join-Path $root "scripts\verify-backend-smoke.ps1"))
}
if (-not $SkipAudit) {
Invoke-Step "Frontend dependency audit" {
Push-Location (Join-Path $root "frontend")
try {
npm audit --audit-level=high
}
finally {
Pop-Location
}
}
}
Write-Host ""
Write-Host "All verification steps passed."