-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-all-tests.ps1
More file actions
73 lines (60 loc) · 1.8 KB
/
run-all-tests.ps1
File metadata and controls
73 lines (60 loc) · 1.8 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env pwsh
param(
[switch]$AllowOldPowerShellVersionsAndRiskFailingScripts
)
if ($PSVersionTable.PSVersion -lt [Version]'7.6.0' -and -not $AllowOldPowerShellVersionsAndRiskFailingScripts) {
Write-Error "This script requires PowerShell 7.6.0 or newer (pwsh). Current version: $($PSVersionTable.PSVersion). Pass -AllowOldPowerShellVersionsAndRiskFailingScripts to override."
exit 1
}
$ErrorActionPreference = 'Continue'
$RepoRoot = $PSScriptRoot
$failures = 0
$results = @()
function Run-Step {
param(
[string]$Label,
[scriptblock]$Action
)
Write-Host ""
Write-Host "================================================================"
Write-Host "=== $Label ==="
Write-Host "================================================================"
& $Action
if ($LASTEXITCODE -eq 0) {
$script:results += "PASS: $Label"
} else {
$script:results += "FAIL: $Label"
$script:failures++
}
}
Run-Step "dotnet build" {
dotnet build "$RepoRoot/ZScheme.slnx" --nologo
}
Run-Step "dotnet test" {
dotnet test "$RepoRoot/ZScheme.slnx" --no-build --nologo `
--collect:"XPlat Code Coverage" `
--results-directory "$PSScriptRoot/coverage" `
}
Run-Step "install packages" {
& "$RepoRoot/install-packages.ps1"
}
Run-Step "package tests" {
& "$RepoRoot/run-package-tests.ps1"
}
Run-Step "build-examples" {
& "$RepoRoot/build-examples.ps1"
}
Write-Host ""
Write-Host "================================================================"
Write-Host "=== Summary ==="
Write-Host "================================================================"
foreach ($r in $results) {
Write-Host " $r"
}
Write-Host ""
if ($failures -gt 0) {
Write-Host "$failures step(s) failed."
exit 1
} else {
Write-Host "All steps passed."
}