mirror of
https://github.com/actions/runner-images.git
synced 2026-01-04 09:13:33 +08:00
Switch provisioners to install Go from GitHub releases on Windows (#1026)
* add go to json toolset * add install and validate go * fiixing go tests * fix validation for go * check zero build version * add 1.9 version * setup variables for go * fix comments * remove script invokation * remove lines * fixing install go * remove comments * remove fake url Co-authored-by: Dmitry Shibanov <v-dmshib@microsoft.com>
This commit is contained in:
@@ -9,13 +9,13 @@ function Run-ExecutableTests {
|
||||
[Parameter(Mandatory)] [string[]] $Executables,
|
||||
[Parameter(Mandatory)] [string] $ToolPath
|
||||
)
|
||||
|
||||
foreach ($executable in $Executables) {
|
||||
$versionCommand = $Executables["command"]
|
||||
foreach ($executable in $Executables["tools"]) {
|
||||
$executablePath = Join-Path $ToolPath $executable
|
||||
|
||||
Write-Host "Check $executable..."
|
||||
if (Test-Path $executablePath) {
|
||||
Write-Host "$executable is successfully installed: $(& $executablePath --version)"
|
||||
Write-Host "$executable is successfully installed: $(& $executablePath $versionCommand)"
|
||||
} else {
|
||||
Write-Host "$executablePath is not installed!"
|
||||
exit 1
|
||||
@@ -29,11 +29,12 @@ function Validate-SystemDefaultTool {
|
||||
[Parameter(Mandatory)] [string] $ExpectedVersion
|
||||
)
|
||||
|
||||
$versionCommand = $toolsExecutables[$ToolName]["command"]
|
||||
$binName = $ToolName.ToLower()
|
||||
|
||||
# Check if tool on path
|
||||
if (Get-Command -Name $binName) {
|
||||
$versionOnPath = $(& $binName --version 2>&1) | Select-String -Pattern ".*(\d+\.\d+\.\d+)"
|
||||
$versionOnPath = $(& $binName $versionCommand 2>&1) | Select-String -Pattern ".*(\d+\.\d+[\.\d+]+)"
|
||||
|
||||
# Check if version is correct
|
||||
if ($versionOnPath.matches.Groups[1].Value -notlike $ExpectedVersion) {
|
||||
@@ -52,9 +53,22 @@ $ErrorActionPreference = "Stop"
|
||||
|
||||
# Define executables for cached tools
|
||||
$toolsExecutables = @{
|
||||
Python = @("python.exe", "Scripts\pip.exe")
|
||||
node = @("node.exe", "npm")
|
||||
PyPy = @("python.exe", "Scripts\pip.exe")
|
||||
Python = @{
|
||||
tools = @("python.exe", "Scripts\pip.exe")
|
||||
command = "--version"
|
||||
}
|
||||
node = @{
|
||||
tools = @("node.exe", "npm")
|
||||
command = "--version"
|
||||
}
|
||||
PyPy = @{
|
||||
tools = @("python.exe", "Scripts\pip.exe")
|
||||
command = "--version"
|
||||
}
|
||||
go = @{
|
||||
tools = @("bin\go.exe")
|
||||
command = "version"
|
||||
}
|
||||
}
|
||||
|
||||
# Get toolcache content from toolset
|
||||
|
||||
Reference in New Issue
Block a user