Skip to content
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
3 changes: 0 additions & 3 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ steps:
- label: ":windows: Tests on Windows"
key: windows-test
command: ".buildkite/scripts/run-win-tests.ps1"
env:
# Latest 1.24 version supported by Chocolatey.
GO_VERSION: "1.24.6"
Comment on lines -38 to -40
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now this step will run the Golang version defined in .go-version file.

agents:
provider: "gcp"
image: "${GO_WINDOWS_AGENT_IMAGE}"
Expand Down
33 changes: 28 additions & 5 deletions .buildkite/scripts/run-win-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,35 @@ function fixCRLF {
git rm --quiet --cached -r .
git reset --quiet --hard
}
function ensureBinPath {
$workDir = if ($env:WORKSPACE) { $env:WORKSPACE } else { $PWD.Path }
$binDir = Join-Path $workDir "bin"
if (-not (Test-Path $binDir)) { New-Item -ItemType Directory -Path $binDir | Out-Null }
$env:PATH = "$binDir;$env:PATH"
return $binDir
}

function withGolang($version) {
Write-Host "--- Install golang $version"
choco install -y golang --version $version
$env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.."
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
refreshenv
Write-Host "--- Install golang (GVM)"
$binDir = ensureBinPath
$gvmExe = Join-Path $binDir "gvm-windows-amd64.exe"
$gvmUrl = "https://github.com/andrewkroh/gvm/releases/download/$env:SETUP_GVM_VERSION/gvm-windows-amd64.exe"

Write-Host "Installing GVM tool"
$maxTries = 5
for ($i = 1; $i -le $maxTries; $i++) {
try {
Invoke-WebRequest -Uri $gvmUrl -OutFile $gvmExe -UseBasicParsing
break
} catch {
if ($i -eq $maxTries) { throw }
Start-Sleep -Seconds 3
}
}

Write-Host "Installing Go version $version"
& $gvmExe --format=powershell $version | Invoke-Expression
$env:PATH = "$(go env GOPATH)\bin;$env:PATH"
go version
go env
}
Expand Down