Skip to content

Commit

Permalink
[macOS] Add Chrome to arm64 image (actions#8526)
Browse files Browse the repository at this point in the history
  • Loading branch information
vpolikarpov-akvelon authored Oct 17, 2023
1 parent 9e6658b commit c598da4
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 18 deletions.
4 changes: 2 additions & 2 deletions images/macos/provision/core/chrome.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ CHROMEDRIVER_DIR="/usr/local/share/chromedriver-${CHROME_PLATFORM}"
CHROMEDRIVER_BIN="$CHROMEDRIVER_DIR/chromedriver"

download_with_retries "$CHROMEDRIVER_URL" "/tmp" "$CHROMEDRIVER_ARCHIVE"
unzip -qq /tmp/$CHROMEDRIVER_ARCHIVE -d /usr/local/share
chmod +x $CHROMEDRIVER_BIN
unzip -qq /tmp/$CHROMEDRIVER_ARCHIVE -d /tmp/
sudo mv "/tmp/chromedriver-${CHROME_PLATFORM}" "$CHROMEDRIVER_DIR"
ln -s "$CHROMEDRIVER_BIN" /usr/local/bin/chromedriver
echo "export CHROMEWEBDRIVER=$CHROMEDRIVER_DIR" >> "${HOME}/.bashrc"

Expand Down
32 changes: 26 additions & 6 deletions images/macos/software-report/SoftwareReport.Browsers.psm1
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
function Build-BrowserSection {
return @(

$nodes = @()
$os = Get-OSVersion

$nodes += @(
[ToolVersionNode]::new("Safari", $(Get-SafariVersion))
[ToolVersionNode]::new("SafariDriver", $(Get-SafariDriverVersion))
[ToolVersionNode]::new("Google Chrome", $(Get-ChromeVersion))
[ToolVersionNode]::new("Google Chrome for Testing", $(Get-ChromeForTestingVersion))
[ToolVersionNode]::new("ChromeDriver", $(Get-ChromeDriverVersion))
[ToolVersionNode]::new("Microsoft Edge", $(Get-EdgeVersion))
[ToolVersionNode]::new("Microsoft Edge WebDriver", $(Get-EdgeDriverVersion))
[ToolVersionNode]::new("Mozilla Firefox", $(Get-FirefoxVersion))
[ToolVersionNode]::new("geckodriver", $(Get-GeckodriverVersion))
)

if (-not $os.IsVenturaArm64) {
$nodes += @(
[ToolVersionNode]::new("Microsoft Edge", $(Get-EdgeVersion))
[ToolVersionNode]::new("Microsoft Edge WebDriver", $(Get-EdgeDriverVersion))
[ToolVersionNode]::new("Mozilla Firefox", $(Get-FirefoxVersion))
[ToolVersionNode]::new("geckodriver", $(Get-GeckodriverVersion))
)
}

$nodes += @(
[ToolVersionNode]::new("Selenium server", $(Get-SeleniumVersion))
)

return $nodes
}

function Get-SafariVersion {
Expand Down Expand Up @@ -64,7 +78,13 @@ function Get-GeckodriverVersion {
}

function Get-SeleniumVersion {
$seleniumVersion = (Get-ChildItem -Path "/usr/local/Cellar/selenium-server*/*").Name
$os = Get-OSVersion
if ($os.IsVenturaArm64) {
$cellarPath = "/opt/homebrew/Cellar"
} else {
$cellarPath = "/usr/local/Cellar"
}
$seleniumVersion = (Get-ChildItem -Path "$cellarPath/selenium-server*/*").Name
return $seleniumVersion
}

Expand Down
11 changes: 5 additions & 6 deletions images/macos/software-report/SoftwareReport.Generator.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,11 @@ if ((-not $os.IsVentura) -and (-not $os.IsVenturaArm64)) {
$linters.AddToolVersion("Yamllint", $(Get-YamllintVersion))
}

if (-not $os.IsVenturaArm64) {
# Browsers
$browsers = $installedSoftware.AddHeader("Browsers")
$browsers.AddNodes($(Build-BrowserSection))
$browsers.AddNode($(Build-BrowserWebdriversEnvironmentTable))
}
# Browsers
$browsers = $installedSoftware.AddHeader("Browsers")
$browsers.AddNodes($(Build-BrowserSection))
$browsers.AddNode($(Build-BrowserWebdriversEnvironmentTable))

# Java
$java = $installedSoftware.AddHeader("Java")
$java.AddTable($(Get-JavaVersions))
Expand Down
1 change: 1 addition & 0 deletions images/macos/templates/macOS-13.arm64.anka.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ build {
"./provision/core/gcc.sh",
"./provision/core/cocoapods.sh",
"./provision/core/safari.sh",
"./provision/core/chrome.sh",
"./provision/core/bicep.sh",
"./provision/core/codeql-bundle.sh"
]
Expand Down
14 changes: 10 additions & 4 deletions images/macos/tests/Browsers.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Import-Module "$PSScriptRoot/../helpers/Common.Helpers.psm1"
$os = Get-OSVersion

Describe "Chrome" -Skip:($os.IsVenturaArm64) {
Describe "Chrome" {
BeforeAll {
$chromeLocation = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
$chromeForTestingLocation = "/Applications/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing"
Expand All @@ -28,9 +28,15 @@ Describe "Chrome" -Skip:($os.IsVenturaArm64) {
}
}

Describe "Selenium server" -Skip:($os.IsVenturaArm64) {
Describe "Selenium server" {
It "Selenium server" {
(Get-ChildItem -Path "/usr/local/Cellar/selenium-server*/*").Name | Should -BeLike "4.*"
$os = Get-OSVersion
if ($os.IsVenturaArm64) {
$cellarPath = "/opt/homebrew/Cellar"
} else {
$cellarPath = "/usr/local/Cellar"
}
(Get-ChildItem -Path "$cellarPath/selenium-server*/*").Name | Should -BeLike "4.*"
}
}

Expand Down Expand Up @@ -66,4 +72,4 @@ Describe "Safari" {
$commandResult.ExitCode | Should -Be 0
$commandResult.Output | Should -Be "true"
}
}
}

0 comments on commit c598da4

Please sign in to comment.