This commit is contained in:
+19
-4
@@ -3,26 +3,41 @@ $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 ./...
|
||||
# Database-backed packages share the seeded local tenant. Run packages
|
||||
# sequentially whenever integration variables are present so temporary SaaS
|
||||
# fixtures cannot become visible to identity assertions in another package.
|
||||
go test -p 1 '-coverprofile=coverage.out' ./...
|
||||
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.'
|
||||
|
||||
Reference in New Issue
Block a user