...
1#Requires -Version 7.0
2
3Param(
4 [string] $serviceDirectory
5)
6
7Push-Location sdk/$serviceDirectory
8
9# Find all 'testdata' directories
10$perfDirectories = Get-ChildItem -Path . -Filter testdata -Recurse
11
12if ($perfDirectories.Length -eq 0) {
13 Write-Host "Did not find any performance tests in the directory $(pwd)"
14 exit 0
15}
16
17$failed = $false
18
19foreach ($perfDir in $perfDirectories) {
20 Push-Location $perfDir
21
22 if (Test-Path -Path perf) {
23 Push-Location perf
24 Write-Host "##[command] Building and vetting performance tests in $perfDir/perf"
25
26 Write-Host "##[command] Executing 'go build .' in $perfDir/perf"
27 go build .
28 if ($LASTEXITCODE) {
29 $failed = $true
30 }
31
32 Write-Host "##[command] Executing 'go vet .' in $perfDir/perf"
33 go vet .
34 if ($LASTEXITCODE) {
35 $failed = $true
36 }
37 Pop-Location
38 }
39
40 Pop-Location
41}
42
43Pop-Location
44
45if ($failed) {
46 Write-Host "##[command] a failure occurred vetting/building one or more performance tests"
47 exit 1
48}
View as plain text