-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.ps1
executable file
·56 lines (47 loc) · 1.93 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
[CmdletBinding(PositionalBinding=$false)]
param(
[switch]$RunTests,
[switch]$RunTestsUntilFailure
)
New-Variable -Name verbose -Option Constant `
-Value ($VerbosePreference -ne 'SilentlyContinue')
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
$PSNativeCommandUseErrorActionPreference = $true
Write-Host "Run Parameters:" -ForegroundColor Cyan
Write-Host "`tPSScriptRoot: $PSScriptRoot"
Write-Host "`tRunTests: $RunTests"
Write-Host "`tdotnet --version: $(dotnet --version)"
Write-Host "Building all projects (Build.csproj traversal)..." -ForegroundColor "Magenta"
New-Variable -Name build_csproj_file -Option Constant `
-Value (Join-Path -Path $PSScriptRoot -ChildPath 'Build.csproj')
dotnet build $build_csproj_file
Write-Host "[INFO] done building." -ForegroundColor "Green"
$ErrorActionPreference = 'Continue'
$PSNativeCommandUseErrorActionPreference = $true
if ($RunTests -or $RunTestsUntilFailure)
{
Do
{
Write-Host "Running tests: Build.csproj traversal (all frameworks)" -ForegroundColor "Magenta"
if ($verbose)
{
# dotnet test $build_csproj_file --diag $(Join-Path -Path $PSScriptRoot -ChildPath diag.log) --environment=RABBITMQ_CLIENT_TESTS_VERBOSE=true --no-build --logger 'console;verbosity=detailed'
dotnet test $build_csproj_file --diag $(Join-Path -Path $PSScriptRoot -ChildPath diag | Join-Path -ChildPath diag.log) --no-build --logger 'console;verbosity=detailed'
}
else
{
dotnet test $build_csproj_file --no-build --logger 'console;verbosity=detailed'
}
if ($LASTEXITCODE -ne 0)
{
Write-Host "[ERROR] FYI, tests errored" -Foreground "Red"
# Write-Host "[ERROR] tests errored, exiting" -Foreground "Red"
# Exit 1
}
else
{
Write-Host "[INFO] tests passed" -ForegroundColor "Green"
}
} While ($RunTestsUntilFailure)
}