-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathbuild.ps1
executable file
·27 lines (23 loc) · 1.04 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[CmdletBinding(PositionalBinding=$false)]
param(
[switch]$RunTests
)
Write-Host "Run Parameters:" -ForegroundColor Cyan
Write-Host "`tPSScriptRoot: $PSScriptRoot"
Write-Host "`tRunTests: $RunTests"
Write-Host "`tdotnet --version: $(dotnet --version)"
Write-Host "[INFO] building all projects (Build.csproj traversal)..." -ForegroundColor "Magenta"
dotnet build "$PSScriptRoot\Build.csproj"
Write-Host "[INFO] done building." -ForegroundColor "Green"
if ($RunTests) {
Write-Host "Running tests: Build.csproj traversal (all frameworks)" -ForegroundColor "Magenta"
$csproj_file = Join-Path -Path $PSScriptRoot -ChildPath 'Tests' | Join-Path -ChildPath 'Tests.csproj'
Write-Host "[INFO] running tests from '$csproj_file' (all frameworks)" -ForegroundColor "Magenta"
dotnet test $csproj_file --no-build --logger "console;verbosity=detailed"
if ($LastExitCode -ne 0) {
Write-Host "Error with tests, aborting build." -Foreground "Red"
Exit 1
}
Write-Host "Tests passed!" -ForegroundColor "Green"
}
Write-Host "Done."