Files
2026-08-29 21:56:51 +08:00

44 lines
1.3 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
$projectRoot = Split-Path -Parent $PSScriptRoot
Set-Location -LiteralPath $projectRoot
function Assert-NativeSuccess {
param([Parameter(Mandatory = $true)][string]$Operation)
if ($LASTEXITCODE -ne 0) {
throw "$Operation failed with exit code $LASTEXITCODE."
}
}
$unformatted = gofmt -l cmd internal
if ($unformatted) {
throw "The following Go files are not formatted:`n$($unformatted -join "`n")"
}
go vet ./...
Assert-NativeSuccess -Operation 'go vet'
# Unit tests stay independent from local service state. Database-backed suites
# are executed by test-integration.ps1 against a disposable migrated database.
go test '-coverprofile=coverage.out' ./...
Assert-NativeSuccess -Operation 'go test'
& (Join-Path $PSScriptRoot 'test-integration.ps1')
Push-Location web
try {
npm ci
Assert-NativeSuccess -Operation 'npm ci'
npm run generate:api
Assert-NativeSuccess -Operation 'OpenAPI client generation'
npm run typecheck
Assert-NativeSuccess -Operation 'web typecheck'
npm run build
Assert-NativeSuccess -Operation 'web build'
} finally {
Pop-Location
}
docker compose config --quiet
Assert-NativeSuccess -Operation 'docker compose config'
Write-Host 'All local checks passed.'