diff --git a/.buildkite/hooks/pre-command.ps1 b/.buildkite/hooks/pre-command.ps1 index 8b9698d2578..ed1d4adfd19 100644 --- a/.buildkite/hooks/pre-command.ps1 +++ b/.buildkite/hooks/pre-command.ps1 @@ -1,21 +1,23 @@ +# Install gcc TODO: Move to the VM image +choco install mingw + # Install gvm and go +# TODO: Move GVM download to the base VM image $env:GvmVersion = "0.5.2" -$Env:GOTMPDIR = $Env:BUILDKITE_BUILD_CHECKOUT_PATH #https://github.com/golang/go/issues/42224#issuecomment-1021149948 -$Env:GOPATH = "$Env:BUILDKITE_BUILD_CHECKOUT_PATH\gopath" - [Net.ServicePointManager]::SecurityProtocol = "tls12" $env:GoVersion = Get-Content -Path .go-version Invoke-WebRequest -URI https://github.com/andrewkroh/gvm/releases/download/v$env:GvmVersion/gvm-windows-amd64.exe -Outfile C:\Windows\System32\gvm.exe gvm --format=powershell $env:GoVersion | Invoke-Expression go version +$GOPATH = $(go env GOPATH) +$env:Path = "$GOPATH\bin;" + $env:Path +[Environment]::SetEnvironmentVariable("GOPATH", "$GOPATH", [EnvironmentVariableTarget]::Machine) +[Environment]::SetEnvironmentVariable("Path", "$GOPATH\bin;$env:Path", [EnvironmentVariableTarget]::Machine) + # Install tools go install github.com/magefile/mage go install github.com/elastic/go-licenser go install golang.org/x/tools/cmd/goimports go install github.com/jstemmer/go-junit-report go install gotest.tools/gotestsum - -# debug -Write-Host "GOPATH: $env:GOPATH" -#Get-ChildItem -Path $env:GOPATH\bin diff --git a/.buildkite/scripts/steps/unit-tests.ps1 b/.buildkite/scripts/steps/unit-tests.ps1 index e6149ebadf6..2589e7ac323 100644 --- a/.buildkite/scripts/steps/unit-tests.ps1 +++ b/.buildkite/scripts/steps/unit-tests.ps1 @@ -1,10 +1,8 @@ $ErrorActionPreference = "Stop" -Write-Host "--- Unit tests" -#debug -Write-Host "GOPATH: $env:GOPATH" -# Get-ChildItem -Path $env:GOPATH\bin -# run tests -$Env:TEST_COVERAGE = $true -.\gopath\mage unitTest +Write-Host "--- Build" +mage build +Write-Host "--- Unit tests" +$Env:TEST_COVERAGE = $true +mage unitTest