Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build.ps1 script to build all SDKs #15014

Merged
merged 3 commits into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions eng/pipelines/templates/steps/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,13 @@ parameters:

steps:

- pwsh: |
$modDirs = (./eng/scripts/get_module_dirs.ps1 -serviceDir $(SCOPE))
foreach ($md in $modDirs) {
pushd $md
Write-Host "##[command]Executing go build -v ./... in $md"
go build -v ./...
}
- pwsh: ./eng/scripts/build.ps1
displayName: 'Build'
workingDirectory: '${{parameters.GoWorkspace}}'
env:
GO111MODULE: 'on'

- pwsh: |
$modDirs = (./eng/scripts/get_module_dirs.ps1 -serviceDir $(SCOPE))
foreach ($md in $modDirs) {
pushd $md
Write-Host "##[command]Executing go vet ./... in $md"
go vet ./...
}
- pwsh: ./eng/scripts/build.ps1 -vet -skipBuild
displayName: 'Vet'
workingDirectory: '${{parameters.GoWorkspace}}'
env:
Expand Down
34 changes: 34 additions & 0 deletions eng/scripts/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#Requires -Version 7.0
param($filter, [switch]$vet, [switch]$generate, [switch]$skipBuild, $parallel = 5)

$sdks = @{};

foreach ($sdk in (./eng/scripts/get_module_dirs.ps1 -serviceDir 'sdk/...')) {
$name = $sdk | split-path -leaf
$sdks[$name] = @{
'path' = $sdk;
}
}

$keys = $sdks.Keys | Sort-Object;
if (![string]::IsNullOrWhiteSpace($filter)) {
Write-Host "Using filter: $filter"
$keys = $keys.Where( { $_ -match $filter })
}

$keys | ForEach-Object { $sdks[$_] } | ForEach-Object -Parallel {
Push-Location $_.path

if (!$skipBuild) {
Write-Host "##[command]Executing go build -v ./... in " $_.path
go build -v ./...
}
if ($vet) {
Write-Host "##[command]Executing go vet ./... in " $_.path
go vet ./...
}
if ($generate) {
Write-Host "##[command]Executing autorest.go in " $_.path
# TODO
}
} -ThrottleLimit $parallel