ci / verify (push) Canceled after 0s
Add customer and operator login, BLE provisioning, device fleet controls, call memory, memoir generation, and refreshed family and maintenance portals. Include API contracts, migrations, firmware sources, tests, assets, and deployment documentation.
45 lines
2.7 KiB
PowerShell
45 lines
2.7 KiB
PowerShell
param(
|
|
[string[]]$Packages = @('onboarding','devicereset','opsdevice','hardwareprovision','idempotency','httpapi','orchestration','saas','outbox','privacy'),
|
|
[switch]$VerboseTests,
|
|
[string]$OutputDirectory = '.tmp-onboarding'
|
|
)
|
|
$ErrorActionPreference='Continue'
|
|
Set-Location (Split-Path $PSScriptRoot -Parent)
|
|
$taskTemplate='codex_onboarding_template_'+[Guid]::NewGuid().ToString('N').Substring(0,12)
|
|
$taskDatabases=[System.Collections.Generic.List[string]]::new()
|
|
$taskPreviousDatabase = $env:TEST_DATABASE_URL
|
|
$taskPreviousRedis = $env:TEST_REDIS_ADDR
|
|
New-Item -ItemType Directory -Force -Path $OutputDirectory | Out-Null
|
|
try {
|
|
docker compose exec -T postgres psql -U voice -d postgres -v ON_ERROR_STOP=1 -c "CREATE DATABASE $taskTemplate" | Out-Null
|
|
if($LASTEXITCODE -ne 0){throw 'Test database creation failed'}
|
|
$taskDatabases.Add($taskTemplate)
|
|
docker compose run --rm --no-deps migrate -path=/migrations "-database=postgres://voice:voice_dev_only@postgres:5432/$taskTemplate`?sslmode=disable" up 2>&1 | Out-File (Join-Path $OutputDirectory 'migration-validation.log')
|
|
if($LASTEXITCODE -ne 0){throw 'Migration validation failed'}
|
|
docker compose run --rm --no-deps -e PGPASSWORD=voice_dev_only seed psql -h postgres -U voice -d $taskTemplate -v ON_ERROR_STOP=1 -f /fixtures/local_seed.sql 2>&1 | Out-File (Join-Path $OutputDirectory 'seed-validation.log')
|
|
if($LASTEXITCODE -ne 0){throw 'Seed validation failed'}
|
|
foreach($taskPackage in $Packages) {
|
|
if($taskPackage -notmatch '^[a-z]+$'){throw 'Invalid package'}
|
|
$taskDatabase='codex_onboarding_test_'+[Guid]::NewGuid().ToString('N').Substring(0,12)
|
|
docker compose exec -T postgres psql -U voice -d postgres -v ON_ERROR_STOP=1 -c "CREATE DATABASE $taskDatabase TEMPLATE $taskTemplate" | Out-Null
|
|
if($LASTEXITCODE -ne 0){throw 'Package database creation failed'}
|
|
$taskDatabases.Add($taskDatabase)
|
|
$env:TEST_DATABASE_URL="postgres://voice:voice_dev_only@127.0.0.1:55432/$taskDatabase`?sslmode=disable"
|
|
$env:TEST_REDIS_ADDR='127.0.0.1:56379'
|
|
$taskGoArgs = @('test', '-count=1', '-p', '1')
|
|
if ($VerboseTests) { $taskGoArgs += '-v' }
|
|
$taskGoArgs += "./internal/$taskPackage"
|
|
go @taskGoArgs 2>&1 | Tee-Object (Join-Path $OutputDirectory "integration-$taskPackage.log")
|
|
if($LASTEXITCODE -ne 0){throw "Integration failed: $taskPackage"}
|
|
}
|
|
} finally {
|
|
$env:TEST_DATABASE_URL = $taskPreviousDatabase
|
|
$env:TEST_REDIS_ADDR = $taskPreviousRedis
|
|
foreach($taskDatabase in $taskDatabases) {
|
|
# Only databases created by this invocation can be removed.
|
|
if($taskDatabase -match '^codex_onboarding_(template|test)_[0-9a-f]{12}$'){
|
|
docker compose exec -T postgres psql -U voice -d postgres -c "DROP DATABASE $taskDatabase WITH (FORCE)" | Out-Null
|
|
}
|
|
}
|
|
}
|