forked from containers/libhvee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
winmake.ps1
69 lines (59 loc) · 1.58 KB
/
winmake.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
57
58
59
60
61
62
63
64
65
66
67
68
69
. ./win-lib.ps1
# Targets
function Binaries{
New-Item -ItemType Directory -Force -Path "./bin"
Run-Command "go build -o bin ./cmd/kvpctl"
Run-Command "go build -o bin ./cmd/dumpvms"
Run-Command "go build -o bin ./cmd/createvm"
Run-Command "go build -o bin ./cmd/updatevm"
}
function Make-Clean{
Remove-Item ./bin -Recurse -Force -ErrorAction Ignore -Confirm:$false
}
function Local-Test {
param (
[string]$files
);
Build-Ginkgo
if ($files) {
$files = " --focus-file $files "
}
Run-Command "./test/tools/build/ginkgo.exe $files ./test/e2e/. "
}
# Helpers
function Build-Ginkgo{
if (Test-Path -Path ./test/tools/build/ginkgo.exe -PathType Leaf) {
return
}
Write-Host "Building Ginkgo"
Push-Location ./test/tools
Run-Command "go build -o build/ginkgo.exe ./vendor/github.com/onsi/ginkgo/v2/ginkgo"
Pop-Location
}
# Init script
$target = $args[0]
# TODO: add validate target
switch ($target) {
{$_ -in '', 'binaries'} {
Binaries
}
'localtest' {
if ($args.Count -gt 1) {
$files = $args[1]
}
Local-Test -files $files
}
'clean' {
Make-Clean
}
default {
Write-Host "Usage: " $MyInvocation.MyCommand.Name "<target> [options]"
Write-Host
Write-Host "Example: Build binaries "
Write-Host " .\winmake binaries"
Write-Host
Write-Host "Example: Run all tests "
Write-Host " .\winmake localtest"
Write-Host
}
}