github.com/neilgarb/delve@v1.9.2-nobreaks/_scripts/test_windows.ps1 (about) 1 param ( 2 [Parameter(Mandatory = $true)][string]$version, 3 [Parameter(Mandatory = $true)][string]$arch 4 ) 5 6 Set-MpPreference -DisableRealtimeMonitoring $true 7 8 # Install Chocolatey 9 #Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) 10 11 # Install MinGW. 12 choco install -y mingw --version 10.2.0 13 14 # Install Procdump 15 if (-Not(Test-Path "C:\procdump")) 16 { 17 mkdir C:\procdump 18 Invoke-WebRequest -UserAgent wget -Uri https://download.sysinternals.com/files/Procdump.zip -OutFile C:\procdump\procdump.zip 19 &7z x -oC:\procdump\ C:\procdump\procdump.zip > $null 20 } 21 22 $env:PATH += ";C:\procdump;C:\mingw64\bin" 23 24 function GetGo($version) { 25 $env:GOROOT = "C:\go\$version" 26 if (-Not(Test-Path $env:GOROOT)) 27 { 28 $file = "$version.windows-$arch.zip" 29 $url = "https://dl.google.com/go/$file" 30 Invoke-WebRequest -UserAgent wget -Uri $url -OutFile $file 31 &7z x -oC:\go $file > $null 32 Move-Item -Path C:\go\go -Destination $env:GOROOT -force 33 } 34 } 35 36 if ($version -eq "gotip") { 37 #Exit 0 38 $latest = Invoke-WebRequest -Uri https://golang.org/VERSION?m=text -UseBasicParsing | Select-Object -ExpandProperty Content 39 GetGo $latest 40 $env:GOROOT_BOOTSTRAP = $env:GOROOT 41 $env:GOROOT = "C:\go\go-tip" 42 Write-Host "Building Go with GOROOT_BOOTSTRAP $env:GOROOT_BOOTSTRAP" 43 if (-Not(Test-Path $env:GOROOT)) { 44 git clone https://go.googlesource.com/go C:\go\go-tip 45 Push-Location -Path C:\go\go-tip\src 46 } else { 47 Push-Location -Path C:\go\go-tip\src 48 git pull 49 } 50 .\make.bat 51 Pop-Location 52 } else { 53 # Install Go 54 Write-Host "Finding latest patch version for $version" 55 $versions = Invoke-WebRequest -Uri 'https://golang.org/dl/?mode=json&include=all' -UseBasicParsing | foreach {$_.Content} | ConvertFrom-Json 56 $v = $versions | foreach {$_.version} | Select-String -Pattern "^$version($|\.)" | Sort-Object -Descending | Select-Object -First 1 57 if ($v -eq $null) { 58 $v = $versions | foreach {$_.version} | Select-String -Pattern "^$version(rc)" | Sort-Object -Descending | Select-Object -First 1 59 } 60 if ($v -eq $null) { 61 $v = $versions | foreach {$_.version} | Select-String -Pattern "^$version(beta)" | Sort-Object -Descending | Select-Object -First 1 62 } 63 Write-Host "Go $v on $arch" 64 GetGo $v 65 } 66 67 $env:GOPATH = "C:\gopath" 68 $env:PATH += ";$env:GOROOT\bin;$env:GOPATH\bin" 69 Write-Host $env:PATH 70 Write-Host $env:GOROOT 71 Write-Host $env:GOPATH 72 73 go version 74 go env 75 go run _scripts/make.go test 76 $x = $LastExitCode 77 if ($version -ne "gotip") { 78 Exit $x 79 }