mirror of
https://github.com/actions/runner-images.git
synced 2025-12-13 20:56:47 +00:00
[macOS] Add virtualbox to macOS-12 (#5594)
* Add virtualbox to macOS-12 * Fix Get_OSVersion function as isBigSur didn't work * Use proper comparison
This commit is contained in:
@@ -28,17 +28,14 @@ function Get-EnvironmentVariable($variable) {
|
|||||||
function Get-OSVersion {
|
function Get-OSVersion {
|
||||||
$osVersion = [Environment]::OSVersion
|
$osVersion = [Environment]::OSVersion
|
||||||
$osVersionMajorMinor = $osVersion.Version.ToString(2)
|
$osVersionMajorMinor = $osVersion.Version.ToString(2)
|
||||||
# Monterey needs future review:
|
|
||||||
# [Environment]::OSVersion returns 11.0 for Monterey preview.
|
|
||||||
[SemVer]$osMontereyVersion = sw_vers -productVersion
|
|
||||||
return [PSCustomObject]@{
|
return [PSCustomObject]@{
|
||||||
Version = $osVersion.Version
|
Version = $osVersion.Version
|
||||||
Platform = $osVersion.Platform
|
Platform = $osVersion.Platform
|
||||||
IsCatalina = $osVersionMajorMinor -eq "10.15"
|
IsCatalina = $osVersionMajorMinor -eq "10.15"
|
||||||
IsBigSur = $osVersionMajorMinor -eq "11.0"
|
IsBigSur = $osVersion.Version.Major -eq "11"
|
||||||
IsMonterey = $osMontereyVersion.Major -eq "12"
|
IsMonterey = $osVersion.Version.Major -eq "12"
|
||||||
IsLessThanMonterey = $osMontereyVersion -lt "12.0"
|
IsLessThanMonterey = $osVersion.Version.Major -lt "12"
|
||||||
IsHigherThanCatalina = [SemVer]$osVersion.Version -ge "11.0"
|
IsHigherThanCatalina = $osVersion.Version.Major -ge "11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,12 @@ for package in $cask_packages; do
|
|||||||
brew install --cask $package
|
brew install --cask $package
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Execute AppleScript to change security preferences for virtualbox
|
||||||
|
# System Preferences -> Security & Privacy -> General -> Unlock -> Allow -> Not now
|
||||||
|
if is_Monterey; then
|
||||||
|
osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD
|
||||||
|
fi
|
||||||
|
|
||||||
# Invoke bazel to download bazel version via bazelisk
|
# Invoke bazel to download bazel version via bazelisk
|
||||||
bazel
|
bazel
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
# This AppleScript confirms developers in security preferences via macOS UI.
|
||||||
|
# It uses after VirtualBox installation to add 'Oracle Inc' as identified developer.
|
||||||
|
# Steps:
|
||||||
|
# - Close security preferences pop-up (it can be open after VirtualBox installation)
|
||||||
|
# - Open System Preferences -> Security & Privacy -> General
|
||||||
|
# - Unlock security preferences with user password (button 'Click the lock to make changes')
|
||||||
|
# - Click 'Allow' or 'Details…' button to confirm developers
|
||||||
|
# - Click 'Not now' button on restarting pop-up
|
||||||
|
# - Close System Preferences
|
||||||
|
|
||||||
|
on run argv
|
||||||
|
set userpassword to item 1 of argv
|
||||||
|
set secpane to "Security & Privacy"
|
||||||
|
|
||||||
|
tell application "System Events"
|
||||||
|
tell security preferences
|
||||||
|
keystroke return
|
||||||
|
delay 5
|
||||||
|
end tell
|
||||||
|
end tell
|
||||||
|
|
||||||
|
activate application "System Preferences"
|
||||||
|
delay 5
|
||||||
|
tell application "System Events"
|
||||||
|
tell process "System Preferences"
|
||||||
|
click menu item secpane of menu "View" of menu bar 1
|
||||||
|
delay 5
|
||||||
|
click button 1 of window 1
|
||||||
|
delay 5
|
||||||
|
keystroke userpassword
|
||||||
|
delay 5
|
||||||
|
keystroke return
|
||||||
|
delay 5
|
||||||
|
click radio button "General" of tab group 1 of window 1
|
||||||
|
delay 5
|
||||||
|
if exists of UI element "Details…" of tab group 1 of window 1 then
|
||||||
|
click button "Details…" of tab group 1 of window 1
|
||||||
|
delay 5
|
||||||
|
keystroke return
|
||||||
|
delay 5
|
||||||
|
keystroke return
|
||||||
|
delay 5
|
||||||
|
end if
|
||||||
|
if exists of UI element "Allow" of tab group 1 of window 1 then
|
||||||
|
click button "Allow" of tab group 1 of window 1
|
||||||
|
delay 5
|
||||||
|
keystroke return
|
||||||
|
delay 5
|
||||||
|
end if
|
||||||
|
click button 5 of window 1
|
||||||
|
end tell
|
||||||
|
end tell
|
||||||
|
end run
|
||||||
@@ -389,7 +389,7 @@ function Get-NewmanVersion {
|
|||||||
|
|
||||||
function Get-VirtualBoxVersion {
|
function Get-VirtualBoxVersion {
|
||||||
$virtualBox = Run-Command "vboxmanage -v"
|
$virtualBox = Run-Command "vboxmanage -v"
|
||||||
return "virtualbox $virtualBox"
|
return "VirtualBox $virtualBox"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-VagrantVersion {
|
function Get-VagrantVersion {
|
||||||
|
|||||||
@@ -141,12 +141,17 @@ if ($os.IsLessThanMonterey) {
|
|||||||
|
|
||||||
if ($os.IsCatalina) {
|
if ($os.IsCatalina) {
|
||||||
$utilitiesList += @(
|
$utilitiesList += @(
|
||||||
(Get-VirtualBoxVersion),
|
|
||||||
(Get-VagrantVersion),
|
(Get-VagrantVersion),
|
||||||
(Get-ParallelVersion)
|
(Get-ParallelVersion)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (-not $os.IsBigSur) {
|
||||||
|
$utilitiesList += @(
|
||||||
|
(Get-VirtualBoxVersion)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
$markdown += New-MDList -Style Unordered -Lines ($utilitiesList | Sort-Object)
|
$markdown += New-MDList -Style Unordered -Lines ($utilitiesList | Sort-Object)
|
||||||
|
|
||||||
# Tools
|
# Tools
|
||||||
|
|||||||
@@ -152,10 +152,12 @@
|
|||||||
"./provision/core/ruby.sh",
|
"./provision/core/ruby.sh",
|
||||||
"./provision/core/rubygem.sh",
|
"./provision/core/rubygem.sh",
|
||||||
"./provision/core/git.sh",
|
"./provision/core/git.sh",
|
||||||
"./provision/core/node.sh"
|
"./provision/core/node.sh",
|
||||||
|
"./provision/core/commonutils.sh"
|
||||||
],
|
],
|
||||||
"environment_vars": [
|
"environment_vars": [
|
||||||
"API_PAT={{user `github_api_pat`}}"
|
"API_PAT={{user `github_api_pat`}}",
|
||||||
|
"USER_PASSWORD={{user `vm_password`}}"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -177,7 +179,6 @@
|
|||||||
"type": "shell",
|
"type": "shell",
|
||||||
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
|
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} {{ .Path }}",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"./provision/core/commonutils.sh",
|
|
||||||
"./provision/core/llvm.sh",
|
"./provision/core/llvm.sh",
|
||||||
"./provision/core/golang.sh",
|
"./provision/core/golang.sh",
|
||||||
"./provision/core/swiftlint.sh",
|
"./provision/core/swiftlint.sh",
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ Describe "vagrant" -Skip:($os.IsHigherThanCatalina) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Describe "virtualbox" -Skip:($os.IsHigherThanCatalina) {
|
Describe "virtualbox" -Skip:($os.IsBigSur) {
|
||||||
It "virtualbox" {
|
It "virtualbox" {
|
||||||
"vboxmanage -v" | Should -ReturnZeroExitCode
|
"vboxmanage -v" | Should -ReturnZeroExitCode
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,3 +121,9 @@ Describe "GraalVM" {
|
|||||||
'$GRAALVM_11_ROOT/native-image --version' | Should -ReturnZeroExitCode
|
'$GRAALVM_11_ROOT/native-image --version' | Should -ReturnZeroExitCode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Describe "VirtualBox" -Skip:($os.IsBigSur) {
|
||||||
|
It "Check kext kernel modules" {
|
||||||
|
kextstat | Out-String | Should -Match "org.virtualbox.kext"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -149,7 +149,8 @@
|
|||||||
"imagemagick"
|
"imagemagick"
|
||||||
],
|
],
|
||||||
"cask_packages": [
|
"cask_packages": [
|
||||||
"julia"
|
"julia",
|
||||||
|
"virtualbox"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"gcc": {
|
"gcc": {
|
||||||
|
|||||||
Reference in New Issue
Block a user