34 lines
803 B
PowerShell
34 lines
803 B
PowerShell
$ErrorActionPreference = "Stop"
|
|
|
|
function Invoke-Step {
|
|
param(
|
|
[string]$Name,
|
|
[scriptblock]$Command
|
|
)
|
|
|
|
Write-Host "==> $Name"
|
|
& $Command
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "$Name failed with exit code $LASTEXITCODE"
|
|
}
|
|
}
|
|
|
|
$unformatted = gofmt -l .
|
|
if ($unformatted) {
|
|
$unformatted | ForEach-Object { Write-Host $_ }
|
|
throw "gofmt check failed"
|
|
}
|
|
|
|
Invoke-Step "go vet" { go vet ./... }
|
|
Invoke-Step "unit tests" { go test -timeout 60s ./... }
|
|
|
|
Invoke-Step "protobuf contracts" { & (Join-Path $PSScriptRoot "verify-proto.ps1") }
|
|
|
|
if ((go env CGO_ENABLED) -eq "1") {
|
|
Invoke-Step "race tests" { go test -race -timeout 60s ./internal/... }
|
|
} else {
|
|
Write-Host "==> race tests skipped: CGO_ENABLED is not 1"
|
|
}
|
|
|
|
Invoke-Step "build" { go build ./... }
|