Files
goauto/scripts/verify.ps1
T

48 lines
1.3 KiB
PowerShell

param(
[ValidateSet("all", "server", "web", "android")]
[string]$Component = "all"
)
$ErrorActionPreference = "Stop"
$projectRoot = Split-Path -Parent $PSScriptRoot
function Invoke-Step([string]$Name, [scriptblock]$Action) {
Write-Host "==> $Name"
& $Action
if ($LASTEXITCODE -ne 0) {
throw "$Name failed with exit code $LASTEXITCODE"
}
}
if ($Component -in @("all", "server")) {
Push-Location (Join-Path $projectRoot "server")
try {
$env:GOTOOLCHAIN = "auto"
Invoke-Step "server: go test ./..." { go test ./... }
Invoke-Step "server: go build" { go build -o (Join-Path $env:TEMP "goauto-server-check.exe") . }
} finally {
Pop-Location
}
}
if ($Component -in @("all", "web")) {
Push-Location (Join-Path $projectRoot "web")
try {
Invoke-Step "web: pnpm install" { pnpm install --frozen-lockfile }
Invoke-Step "web: lint" { pnpm run lint }
Invoke-Step "web: build" { pnpm run build:prod }
} finally {
Pop-Location
}
}
if ($Component -in @("all", "android")) {
Push-Location (Join-Path $projectRoot "android")
try {
Invoke-Step "android: unit tests" { .\gradlew.bat test }
Invoke-Step "android: debug APK" { .\gradlew.bat assembleDebug }
} finally {
Pop-Location
}
}