mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 12:48:18 +00:00
[macos] Add toolcache for arm (#7974)
This commit is contained in:
committed by
GitHub
parent
9a403df7bd
commit
fc2f35d593
@@ -156,3 +156,13 @@ function Add-EnvironmentVariable {
|
|||||||
function isVeertu {
|
function isVeertu {
|
||||||
return (Test-Path -Path "/Library/Application Support/Veertu")
|
return (Test-Path -Path "/Library/Application Support/Veertu")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Get-Architecture {
|
||||||
|
$arch = arch
|
||||||
|
if ($arch -ne "arm64")
|
||||||
|
{
|
||||||
|
$arch = "x64"
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arch
|
||||||
|
}
|
||||||
|
|||||||
@@ -22,23 +22,23 @@ function Get-ToolsetToolFullPath
|
|||||||
return $installationDir
|
return $installationDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$arch = Get-Architecture
|
||||||
$toolcache = Get-ToolsetValue "toolcache"
|
$toolcache = Get-ToolsetValue "toolcache"
|
||||||
|
|
||||||
foreach ($tool in $toolcache)
|
foreach ($tool in $toolcache)
|
||||||
{
|
{
|
||||||
$toolName = $tool.name
|
$toolName = $tool.name
|
||||||
$toolArch = $tool.arch
|
$toolEnvironment = $tool.arch.$arch.variable_template
|
||||||
$toolEnvironment = $tool.variable_template
|
|
||||||
|
|
||||||
if (-not $toolEnvironment)
|
if (-not $toolEnvironment)
|
||||||
{
|
{
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($toolVersion in $tool.versions)
|
foreach ($toolVersion in $tool.arch.$arch.versions)
|
||||||
{
|
{
|
||||||
Write-Host "Set $toolName $toolVersion environment variable..."
|
Write-Host "Set $toolName $toolVersion environment variable..."
|
||||||
$toolPath = Get-ToolsetToolFullPath -ToolName $toolName -ToolVersion $toolVersion -ToolArchitecture $toolArch
|
$toolPath = Get-ToolsetToolFullPath -ToolName $toolName -ToolVersion $toolVersion -ToolArchitecture $arch
|
||||||
$envName = $toolEnvironment -f $toolVersion.split(".")
|
$envName = $toolEnvironment -f $toolVersion.split(".")
|
||||||
|
|
||||||
# Add environment variable name=value
|
# Add environment variable name=value
|
||||||
|
|||||||
@@ -75,8 +75,9 @@ function InstallPyPy
|
|||||||
rm -f $PACKAGE_TAR_TEMP_PATH
|
rm -f $PACKAGE_TAR_TEMP_PATH
|
||||||
}
|
}
|
||||||
|
|
||||||
|
arch=$(get_arch)
|
||||||
pypyVersions=$(curl https://downloads.python.org/pypy/versions.json)
|
pypyVersions=$(curl https://downloads.python.org/pypy/versions.json)
|
||||||
toolsetVersions=$(get_toolset_value '.toolcache[] | select(.name | contains("PyPy")) | .versions[]')
|
toolsetVersions=$(get_toolset_value '.toolcache[] | select(.name | contains("PyPy")) | .arch.'$arch'.versions[]')
|
||||||
|
|
||||||
for toolsetVersion in $toolsetVersions; do
|
for toolsetVersion in $toolsetVersions; do
|
||||||
latestMajorPyPyVersion=$(echo $pypyVersions |
|
latestMajorPyPyVersion=$(echo $pypyVersions |
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ if ! is_VenturaArm64; then
|
|||||||
echo "Install Ruby from toolset..."
|
echo "Install Ruby from toolset..."
|
||||||
[ -n "$API_PAT" ] && authString=(-H "Authorization: token ${API_PAT}")
|
[ -n "$API_PAT" ] && authString=(-H "Authorization: token ${API_PAT}")
|
||||||
PACKAGE_TAR_NAMES=$(curl "${authString[@]}" -s "https://api.github.com/repos/ruby/ruby-builder/releases/latest" | jq -r '.assets[].name')
|
PACKAGE_TAR_NAMES=$(curl "${authString[@]}" -s "https://api.github.com/repos/ruby/ruby-builder/releases/latest" | jq -r '.assets[].name')
|
||||||
TOOLSET_VERSIONS=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .versions[]')
|
TOOLSET_VERSIONS=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .arch.'$arch'.versions[]')
|
||||||
RUBY_PATH="$AGENT_TOOLSDIRECTORY/Ruby"
|
RUBY_PATH="$AGENT_TOOLSDIRECTORY/Ruby"
|
||||||
|
|
||||||
echo "Check if Ruby hostedtoolcache folder exists..."
|
echo "Check if Ruby hostedtoolcache folder exists..."
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ Function Install-Asset {
|
|||||||
Pop-Location
|
Pop-Location
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$arch = Get-Architecture
|
||||||
|
|
||||||
# Get toolcache content from toolset
|
# Get toolcache content from toolset
|
||||||
$toolsToInstall = @("Python", "Node", "Go")
|
$toolsToInstall = @("Python", "Node", "Go")
|
||||||
$tools = Get-ToolsetValue "toolcache" | Where-Object {$toolsToInstall -contains $_.Name}
|
$tools = Get-ToolsetValue "toolcache" | Where-Object {$toolsToInstall -contains $_.Name}
|
||||||
@@ -37,10 +39,10 @@ foreach ($tool in $tools) {
|
|||||||
$assets = Invoke-RestMethodWithRetry -Url $tool.url
|
$assets = Invoke-RestMethodWithRetry -Url $tool.url
|
||||||
|
|
||||||
# Get github release asset for each version
|
# Get github release asset for each version
|
||||||
foreach ($version in $tool.versions) {
|
foreach ($version in $tool.arch.$arch.versions) {
|
||||||
$asset = $assets | Where-Object version -like $version `
|
$asset = $assets | Where-Object version -like $version `
|
||||||
| Select-Object -ExpandProperty files `
|
| Select-Object -ExpandProperty files `
|
||||||
| Where-Object { ($_.platform -eq $tool.platform) -and ($_.arch -eq $tool.arch) -and ($_.platform_version -eq $tool.platform_version)} `
|
| Where-Object { ($_.platform -eq $tool.platform) -and ($_.arch -eq $arch)} `
|
||||||
| Select-Object -First 1
|
| Select-Object -First 1
|
||||||
|
|
||||||
Write-Host "Installing $($tool.name) $version..."
|
Write-Host "Installing $($tool.name) $version..."
|
||||||
|
|||||||
@@ -206,6 +206,13 @@ build {
|
|||||||
]
|
]
|
||||||
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
|
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} {{ .Path }}"
|
||||||
}
|
}
|
||||||
|
provisioner "shell" {
|
||||||
|
scripts = [
|
||||||
|
"./provision/core/toolset.ps1",
|
||||||
|
"./provision/core/configure-toolset.ps1"
|
||||||
|
]
|
||||||
|
execute_command = "chmod +x {{ .Path }}; source $HOME/.bash_profile; {{ .Vars }} pwsh -f {{ .Path }}"
|
||||||
|
}
|
||||||
provisioner "shell" {
|
provisioner "shell" {
|
||||||
script = "./provision/core/delete-duplicate-sims.rb"
|
script = "./provision/core/delete-duplicate-sims.rb"
|
||||||
execute_command = "source $HOME/.bash_profile; ruby {{ .Path }}"
|
execute_command = "source $HOME/.bash_profile; ruby {{ .Path }}"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
|
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
|
||||||
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking
|
Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking
|
||||||
|
|
||||||
|
$arch = Get-Architecture
|
||||||
$os = Get-OSVersion
|
$os = Get-OSVersion
|
||||||
|
|
||||||
Describe "Toolcache" {
|
Describe "Toolcache" {
|
||||||
@@ -8,12 +9,12 @@ Describe "Toolcache" {
|
|||||||
[array]$packages += Get-ToolsetValue -KeyPath "toolcache" | ForEach-Object {
|
[array]$packages += Get-ToolsetValue -KeyPath "toolcache" | ForEach-Object {
|
||||||
return [PSCustomObject] @{
|
return [PSCustomObject] @{
|
||||||
ToolName = ($_.name).ToLower()
|
ToolName = ($_.name).ToLower()
|
||||||
Arch = $_.arch
|
Arch = $arch
|
||||||
Versions = $_.versions | ForEach-Object { $_.Replace(".*", "") }
|
Versions = $_.arch.$arch | Where-Object{ $_ } | ForEach-Object { $_.versions.Replace(".*", "") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Context "Python" -Skip:($os.IsVenturaArm64) {
|
Context "Python" {
|
||||||
$pythonDirectory = Join-Path $toolcacheDirectory "Python"
|
$pythonDirectory = Join-Path $toolcacheDirectory "Python"
|
||||||
$pythonPackage = $packages | Where-Object { $_.ToolName -eq "python" } | Select-Object -First 1
|
$pythonPackage = $packages | Where-Object { $_.ToolName -eq "python" } | Select-Object -First 1
|
||||||
$testCase = @{ PythonDirectory = $pythonDirectory }
|
$testCase = @{ PythonDirectory = $pythonDirectory }
|
||||||
@@ -142,7 +143,7 @@ Describe "Toolcache" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Context "Node" -Skip:($os.IsVenturaArm64) {
|
Context "Node" {
|
||||||
$nodeDirectory = Join-Path $toolcacheDirectory "node"
|
$nodeDirectory = Join-Path $toolcacheDirectory "node"
|
||||||
$nodePackage = $packages | Where-Object { $_.ToolName -eq "node" } | Select-Object -First 1
|
$nodePackage = $packages | Where-Object { $_.ToolName -eq "node" } | Select-Object -First 1
|
||||||
$testCase = @{ NodeDirectory = $nodeDirectory }
|
$testCase = @{ NodeDirectory = $nodeDirectory }
|
||||||
@@ -192,7 +193,7 @@ Describe "Toolcache" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Context "Go" -Skip:($os.IsVenturaArm64) {
|
Context "Go" {
|
||||||
$goDirectory = Join-Path $toolcacheDirectory "go"
|
$goDirectory = Join-Path $toolcacheDirectory "go"
|
||||||
$goPackage = $packages | Where-Object { $_.ToolName -eq "go" } | Select-Object -First 1
|
$goPackage = $packages | Where-Object { $_.ToolName -eq "go" } | Select-Object -First 1
|
||||||
$testCase = @{ GoDirectory = $goDirectory }
|
$testCase = @{ GoDirectory = $goDirectory }
|
||||||
|
|||||||
@@ -245,8 +245,9 @@
|
|||||||
{
|
{
|
||||||
"name": "Python",
|
"name": "Python",
|
||||||
"url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json",
|
"url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json",
|
||||||
"arch": "x64",
|
|
||||||
"platform" : "darwin",
|
"platform" : "darwin",
|
||||||
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"3.7.*",
|
"3.7.*",
|
||||||
"3.8.*",
|
"3.8.*",
|
||||||
@@ -254,44 +255,56 @@
|
|||||||
"3.10.*",
|
"3.10.*",
|
||||||
"3.11.*"
|
"3.11.*"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PyPy",
|
"name": "PyPy",
|
||||||
"arch": "x64",
|
|
||||||
"platform" : "darwin",
|
"platform" : "darwin",
|
||||||
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"2.7",
|
"2.7",
|
||||||
"3.7",
|
"3.7",
|
||||||
"3.8",
|
"3.8",
|
||||||
"3.9"
|
"3.9"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Node",
|
"name": "Node",
|
||||||
"url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json",
|
"url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json",
|
||||||
"platform" : "darwin",
|
"platform" : "darwin",
|
||||||
"arch": "x64",
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"14.*",
|
"14.*",
|
||||||
"16.*",
|
"16.*",
|
||||||
"18.*"
|
"18.*"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Go",
|
"name": "Go",
|
||||||
"url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json",
|
"url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json",
|
||||||
"arch": "x64",
|
|
||||||
"platform" : "darwin",
|
"platform" : "darwin",
|
||||||
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"variable_template" : "GOROOT_{0}_{1}_X64",
|
"variable_template" : "GOROOT_{0}_{1}_X64",
|
||||||
"versions": [
|
"versions": [
|
||||||
"1.18.*",
|
"1.18.*",
|
||||||
"1.19.*",
|
"1.19.*",
|
||||||
"1.20.*"
|
"1.20.*"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Ruby",
|
"name": "Ruby",
|
||||||
"arch": "x64",
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"2.4.*",
|
"2.4.*",
|
||||||
"2.5.*",
|
"2.5.*",
|
||||||
@@ -301,6 +314,8 @@
|
|||||||
"3.1.*"
|
"3.1.*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"pipx": [
|
"pipx": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -231,8 +231,9 @@
|
|||||||
{
|
{
|
||||||
"name": "Python",
|
"name": "Python",
|
||||||
"url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json",
|
"url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json",
|
||||||
"arch": "x64",
|
|
||||||
"platform" : "darwin",
|
"platform" : "darwin",
|
||||||
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"3.7.*",
|
"3.7.*",
|
||||||
"3.8.*",
|
"3.8.*",
|
||||||
@@ -240,50 +241,64 @@
|
|||||||
"3.10.*",
|
"3.10.*",
|
||||||
"3.11.*"
|
"3.11.*"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "PyPy",
|
"name": "PyPy",
|
||||||
"arch": "x64",
|
|
||||||
"platform" : "darwin",
|
"platform" : "darwin",
|
||||||
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"2.7",
|
"2.7",
|
||||||
"3.7",
|
"3.7",
|
||||||
"3.8",
|
"3.8",
|
||||||
"3.9"
|
"3.9"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Node",
|
"name": "Node",
|
||||||
"url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json",
|
"url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json",
|
||||||
"platform" : "darwin",
|
"platform" : "darwin",
|
||||||
"arch": "x64",
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"14.*",
|
"14.*",
|
||||||
"16.*",
|
"16.*",
|
||||||
"18.*"
|
"18.*"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Go",
|
"name": "Go",
|
||||||
"url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json",
|
"url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json",
|
||||||
"arch": "x64",
|
|
||||||
"platform" : "darwin",
|
"platform" : "darwin",
|
||||||
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"variable_template" : "GOROOT_{0}_{1}_X64",
|
"variable_template" : "GOROOT_{0}_{1}_X64",
|
||||||
"versions": [
|
"versions": [
|
||||||
"1.18.*",
|
"1.18.*",
|
||||||
"1.19.*",
|
"1.19.*",
|
||||||
"1.20.*"
|
"1.20.*"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Ruby",
|
"name": "Ruby",
|
||||||
"arch": "x64",
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"2.7.*",
|
"2.7.*",
|
||||||
"3.0.*",
|
"3.0.*",
|
||||||
"3.1.*"
|
"3.1.*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"pipx": [
|
"pipx": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -121,8 +121,9 @@
|
|||||||
{
|
{
|
||||||
"name": "Python",
|
"name": "Python",
|
||||||
"url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json",
|
"url" : "https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json",
|
||||||
"arch": "x64",
|
|
||||||
"platform" : "darwin",
|
"platform" : "darwin",
|
||||||
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"3.8.*",
|
"3.8.*",
|
||||||
"3.9.*",
|
"3.9.*",
|
||||||
@@ -130,46 +131,79 @@
|
|||||||
"3.11.*"
|
"3.11.*"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"arm64": {
|
||||||
|
"versions": [
|
||||||
|
"3.10.*",
|
||||||
|
"3.11.*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "PyPy",
|
"name": "PyPy",
|
||||||
"arch": "x64",
|
|
||||||
"platform" : "darwin",
|
"platform" : "darwin",
|
||||||
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"2.7",
|
"2.7",
|
||||||
"3.7",
|
"3.7",
|
||||||
"3.8",
|
"3.8",
|
||||||
"3.9"
|
"3.9"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Node",
|
"name": "Node",
|
||||||
"url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json",
|
"url" : "https://raw.githubusercontent.com/actions/node-versions/main/versions-manifest.json",
|
||||||
"platform" : "darwin",
|
"platform" : "darwin",
|
||||||
"arch": "x64",
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"16.*",
|
"16.*",
|
||||||
"18.*"
|
"18.*"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"arm64": {
|
||||||
|
"versions": [
|
||||||
|
"16.*",
|
||||||
|
"18.*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Go",
|
"name": "Go",
|
||||||
"url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json",
|
"url" : "https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json",
|
||||||
"arch": "x64",
|
|
||||||
"platform" : "darwin",
|
"platform" : "darwin",
|
||||||
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"variable_template" : "GOROOT_{0}_{1}_X64",
|
"variable_template" : "GOROOT_{0}_{1}_X64",
|
||||||
"versions": [
|
"versions": [
|
||||||
"1.19.*",
|
"1.19.*",
|
||||||
"1.20.*"
|
"1.20.*"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"arm64": {
|
||||||
|
"variable_template" : "GOROOT_{0}_{1}_ARM64",
|
||||||
|
"versions": [
|
||||||
|
"1.19.*",
|
||||||
|
"1.20.*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Ruby",
|
"name": "Ruby",
|
||||||
"arch": "x64",
|
"arch": {
|
||||||
|
"x64": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"3.0.*",
|
"3.0.*",
|
||||||
"3.1.*"
|
"3.1.*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"go": {
|
"go": {
|
||||||
"default": "1.20"
|
"default": "1.20"
|
||||||
|
|||||||
Reference in New Issue
Block a user