mirror of
https://github.com/actions/runner-images.git
synced 2025-12-28 20:58:32 +08:00
Implement new software report generator for macOS (#6690)
* Create environmentVariables.yml * Update environmentVariables.yml * Delete environmentVariables.yml * Add new SoftwareReport generator * Output generation fixes after review * Add json output print in pipeline * Modify json output print in pipeline * Removed redundant space character
This commit is contained in:
committed by
GitHub
parent
fb3b6fd699
commit
69cdead4fc
@@ -1,64 +1,70 @@
|
||||
function Get-BrowserSection {
|
||||
return New-MDList -Style Unordered -Lines @(
|
||||
(Get-SafariVersion),
|
||||
(Get-SafariDriverVersion),
|
||||
(Get-ChromeVersion),
|
||||
(Get-ChromeDriverVersion),
|
||||
(Get-EdgeVersion),
|
||||
(Get-EdgeDriverVersion),
|
||||
(Get-FirefoxVersion),
|
||||
(Get-GeckodriverVersion),
|
||||
(Get-SeleniumVersion)
|
||||
function Build-BrowserSection {
|
||||
return @(
|
||||
[ToolNode]::new("Safari", $(Get-SafariVersion))
|
||||
[ToolNode]::new("SafariDriver", $(Get-SafariDriverVersion))
|
||||
[ToolNode]::new("Google Chrome", $(Get-ChromeVersion))
|
||||
[ToolNode]::new("ChromeDriver", $(Get-ChromeDriverVersion))
|
||||
[ToolNode]::new("Microsoft Edge", $(Get-EdgeVersion))
|
||||
[ToolNode]::new("Microsoft Edge WebDriver", $(Get-EdgeDriverVersion))
|
||||
[ToolNode]::new("Mozilla Firefox", $(Get-FirefoxVersion))
|
||||
[ToolNode]::new("geckodriver", $(Get-GeckodriverVersion))
|
||||
[ToolNode]::new("Selenium server", $(Get-SeleniumVersion))
|
||||
)
|
||||
}
|
||||
|
||||
function Get-SafariVersion {
|
||||
$version = Run-Command "defaults read /Applications/Safari.app/Contents/Info CFBundleShortVersionString"
|
||||
$build = Run-Command "defaults read /Applications/Safari.app/Contents/Info CFBundleVersion"
|
||||
"Safari $version ($build)"
|
||||
return "$version ($build)"
|
||||
}
|
||||
|
||||
function Get-SafariDriverVersion {
|
||||
$version = Run-Command "safaridriver --version" | Take-Part -Part 3,4
|
||||
"SafariDriver $version"
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-ChromeVersion {
|
||||
$chromePath = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
||||
return Run-Command "'${chromePath}' --version"
|
||||
$version = Run-Command "'${chromePath}' --version"
|
||||
return ($version -replace ("^Google Chrome")).Trim()
|
||||
}
|
||||
|
||||
function Get-ChromeDriverVersion {
|
||||
$rawOutput = Run-Command "chromedriver --version"
|
||||
$version = $rawOutput | Take-Part -Part 1
|
||||
return "ChromeDriver ${version}"
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-EdgeVersion {
|
||||
$edgePath = "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
|
||||
return Run-Command "'${edgePath}' --version"
|
||||
$version = Run-Command "'${edgePath}' --version"
|
||||
return ($version -replace ("^Microsoft Edge")).Trim()
|
||||
}
|
||||
|
||||
function Get-EdgeDriverVersion {
|
||||
return Run-Command "msedgedriver --version" | Take-Part -Part 0,1,2,3
|
||||
return Run-Command "msedgedriver --version" | Take-Part -Part 3
|
||||
}
|
||||
|
||||
function Get-FirefoxVersion {
|
||||
$firefoxPath = "/Applications/Firefox.app/Contents/MacOS/firefox"
|
||||
return Run-Command "'${firefoxPath}' --version"
|
||||
$version = Run-Command "'${firefoxPath}' --version"
|
||||
return ($version -replace "^Mozilla Firefox").Trim()
|
||||
}
|
||||
|
||||
function Get-GeckodriverVersion {
|
||||
return Run-Command "geckodriver --version" | Select-Object -First 1
|
||||
$version = Run-Command "geckodriver --version" | Select-Object -First 1
|
||||
return ($version -replace "^geckodriver").Trim()
|
||||
}
|
||||
|
||||
function Get-SeleniumVersion {
|
||||
$seleniumVersion = (Get-ChildItem -Path "/usr/local/Cellar/selenium-server*/*").Name
|
||||
return "Selenium server $seleniumVersion"
|
||||
return $seleniumVersion
|
||||
}
|
||||
|
||||
function Build-BrowserWebdriversEnvironmentTable {
|
||||
return @(
|
||||
$node = [HeaderNode]::new("Environment variables")
|
||||
|
||||
$table = @(
|
||||
@{
|
||||
"Name" = "CHROMEWEBDRIVER"
|
||||
"Value" = $env:CHROMEWEBDRIVER
|
||||
@@ -77,4 +83,8 @@ function Build-BrowserWebdriversEnvironmentTable {
|
||||
"Value" = $_.Value
|
||||
}
|
||||
}
|
||||
|
||||
$node.AddTableNode($table)
|
||||
|
||||
return $node
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user