2026-08-26 06:41:07 +08:00
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
|
$PSNativeCommandUseErrorActionPreference = $true
|
|
|
|
|
$projectRoot = Split-Path -Parent $PSScriptRoot
|
|
|
|
|
Set-Location -LiteralPath $projectRoot
|
|
|
|
|
|
2026-08-29 21:56:51 +08:00
|
|
|
function Assert-NativeSuccess {
|
|
|
|
|
param([Parameter(Mandatory = $true)][string]$Operation)
|
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
|
|
|
throw "$Operation failed with exit code $LASTEXITCODE."
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-26 06:41:07 +08:00
|
|
|
$unformatted = gofmt -l cmd internal
|
|
|
|
|
if ($unformatted) {
|
|
|
|
|
throw "The following Go files are not formatted:`n$($unformatted -join "`n")"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
go vet ./...
|
2026-08-29 21:56:51 +08:00
|
|
|
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')
|
2026-08-26 06:41:07 +08:00
|
|
|
|
|
|
|
|
Push-Location web
|
|
|
|
|
try {
|
|
|
|
|
npm ci
|
2026-08-29 21:56:51 +08:00
|
|
|
Assert-NativeSuccess -Operation 'npm ci'
|
2026-08-26 06:41:07 +08:00
|
|
|
npm run generate:api
|
2026-08-29 21:56:51 +08:00
|
|
|
Assert-NativeSuccess -Operation 'OpenAPI client generation'
|
2026-08-26 06:41:07 +08:00
|
|
|
npm run typecheck
|
2026-08-29 21:56:51 +08:00
|
|
|
Assert-NativeSuccess -Operation 'web typecheck'
|
2026-08-26 06:41:07 +08:00
|
|
|
npm run build
|
2026-08-29 21:56:51 +08:00
|
|
|
Assert-NativeSuccess -Operation 'web build'
|
2026-08-26 06:41:07 +08:00
|
|
|
} finally {
|
|
|
|
|
Pop-Location
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
docker compose config --quiet
|
2026-08-29 21:56:51 +08:00
|
|
|
Assert-NativeSuccess -Operation 'docker compose config'
|
2026-08-26 06:41:07 +08:00
|
|
|
Write-Host 'All local checks passed.'
|