dragon-iso/build-and-test.ps1

35 lines
1.2 KiB
PowerShell
Raw Permalink Normal View History

$ErrorActionPreference = 'Stop'
if (-not (Test-Path 'Dragon-ISO.Windows.slnf')) {
throw "Run from the Dragon-ISO repo root."
}
$env:Path = "C:\Program Files\dotnet;$env:Path"
Write-Host "=== dotnet --version ===" -ForegroundColor Cyan
dotnet --version
Write-Host ""
Write-Host "=== Restore ===" -ForegroundColor Cyan
dotnet restore Dragon-ISO.Windows.slnf
if ($LASTEXITCODE -ne 0) { throw "Restore failed." }
Write-Host ""
Write-Host "=== Build (Release, TreatWarningsAsErrors=true) ===" -ForegroundColor Cyan
dotnet build Dragon-ISO.Windows.slnf --configuration Release --no-restore --nologo
if ($LASTEXITCODE -ne 0) {
throw "Build failed. Most likely cause for this batch: System.Windows.Automation needs an explicit Reference. If so, add to src/Dragon-ISO.App/Dragon-ISO.App.csproj inside an <ItemGroup>: <Reference Include='UIAutomationClient' /> <Reference Include='UIAutomationTypes' />"
}
Write-Host ""
Write-Host "=== Tests (excluding requires=ndi) ===" -ForegroundColor Cyan
dotnet test Dragon-ISO.Windows.slnf `
--configuration Release `
--no-build `
--nologo `
--filter "Category!=ndi&requires!=ndi"
if ($LASTEXITCODE -ne 0) { throw "Tests failed." }
Write-Host ""
Write-Host "Build + tests green." -ForegroundColor Green