-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-package-tests.ps1
More file actions
67 lines (56 loc) · 1.96 KB
/
run-package-tests.ps1
File metadata and controls
67 lines (56 loc) · 1.96 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
#!/usr/bin/env pwsh
param(
[switch]$Debug,
[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
$DebugArgs = if ($Debug) { @('--debug') } else { @() }
$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 "stdlib tests" {
dotnet run --no-build --project "$RepoRoot/src/ZScheme.Cli" -- `
test -m "$RepoRoot/packages/stdlib/package.zspkg" @DebugArgs
}
# Rebuild stdlib package cache so dependent packages (http) pick up latest changes
dotnet run --no-build --project "$RepoRoot/src/ZScheme.Cli" -- `
install --manifest "$RepoRoot/packages/stdlib/package.zspkg" 2>&1 | Out-Null
Run-Step "http tests" {
dotnet run --no-build --project "$RepoRoot/src/ZScheme.Cli" -- `
test -m "$RepoRoot/packages/http/package.zspkg" @DebugArgs
}
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."
}