<# .SYNOPSIS Runs the full verification loop for the Nuvolari monorepo. .DESCRIPTION Stages run in order and the script stops at the first failure, because a formatting or analysis error makes the later stages' output noise. Stages whose target does not exist yet are skipped, so this script is runnable from milestone 0 onwards. .PARAMETER SkipBuild Skips the Android app bundle build. Useful for a fast inner loop; CI never passes this. .EXAMPLE .\tool\verify.ps1 .\tool\verify.ps1 -SkipBuild #> [CmdletBinding()] param( [switch]$SkipBuild ) $ErrorActionPreference = 'Stop' $repo = Split-Path -Parent $PSScriptRoot $app = Join-Path $repo 'app' $backend = Join-Path $repo 'backend' $failures = @() function Invoke-Stage { param( [string]$Name, [string]$WorkingDirectory, [scriptblock]$Action ) Write-Host "" Write-Host "==> $Name" -ForegroundColor Cyan Push-Location $WorkingDirectory try { & $Action if ($LASTEXITCODE -ne 0) { throw "$Name failed with exit code $LASTEXITCODE" } Write-Host " ok" -ForegroundColor Green } finally { Pop-Location } } function Test-Skip { param([string]$Path, [string]$Name) if (-not (Test-Path $Path)) { Write-Host "" Write-Host "==> $Name" -ForegroundColor Cyan Write-Host " skipped (not created yet: $Path)" -ForegroundColor DarkGray return $true } return $false } # --- Flutter app ------------------------------------------------------------ if (-not (Test-Skip -Path (Join-Path $app 'pubspec.yaml') -Name 'Flutter app')) { Invoke-Stage 'dart format' $app { dart format --set-exit-if-changed . } Invoke-Stage 'flutter analyze' $app { flutter analyze } Invoke-Stage 'flutter test' $app { flutter test } if ($SkipBuild) { Write-Host "" Write-Host "==> flutter build appbundle" -ForegroundColor Cyan Write-Host " skipped (-SkipBuild)" -ForegroundColor DarkGray } else { Invoke-Stage 'flutter build appbundle --debug' $app { flutter build appbundle --debug } } } # --- Python worker ---------------------------------------------------------- if (-not (Test-Skip -Path (Join-Path $backend 'pyproject.toml') -Name 'Python worker')) { Invoke-Stage 'ruff check' $backend { python -m ruff check . } Invoke-Stage 'pytest' $backend { python -m pytest -q } } Write-Host "" Write-Host "All verification stages passed." -ForegroundColor Green