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
|
#Requires -Version 7.0
Param(
[string] $serviceDirectory
)
Push-Location sdk/$serviceDirectory
# Find all 'testdata' directories
$perfDirectories = Get-ChildItem -Path . -Filter testdata -Recurse
if ($perfDirectories.Length -eq 0) {
Write-Host "Did not find any performance tests in the directory $(pwd)"
exit 0
}
$failed = $false
foreach ($perfDir in $perfDirectories) {
Push-Location $perfDir
if (Test-Path -Path perf) {
Push-Location perf
Write-Host "##[command] Building and vetting performance tests in $perfDir/perf"
Write-Host "##[command] Executing 'go build .' in $perfDir/perf"
go build .
if ($LASTEXITCODE) {
$failed = $true
}
Write-Host "##[command] Executing 'go vet .' in $perfDir/perf"
go vet .
if ($LASTEXITCODE) {
$failed = $true
}
Pop-Location
}
Pop-Location
}
Pop-Location
if ($failed) {
Write-Host "##[command] a failure occurred vetting/building one or more performance tests"
exit 1
}
|