mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
[Windows] Minor documentation improvements (#6751)
This commit is contained in:
@@ -1,80 +1,51 @@
|
||||
function Get-GoMarkdown
|
||||
{
|
||||
$Name = "Go"
|
||||
$ToolInstances = Get-CachedToolInstances -Name $Name -VersionCommand "version"
|
||||
foreach ($Instance in $ToolInstances)
|
||||
{
|
||||
$Version = [System.Version]($Instance.Version -Split(" "))[0]
|
||||
$Instance."Environment Variable" = "GOROOT_$($Version.major)_$($Version.minor)_X64"
|
||||
function Get-ToolcacheGoVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Go"
|
||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
|
||||
}
|
||||
|
||||
$Content = $ToolInstances | New-MDTable -Columns ([ordered]@{
|
||||
Version = "left";
|
||||
Architecture = "left";
|
||||
"Environment Variable" = "left"
|
||||
})
|
||||
|
||||
return Build-MarkdownElement -Head $Name -Content $Content
|
||||
function Get-ToolcacheNodeVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Node"
|
||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
|
||||
}
|
||||
|
||||
function Get-NodeMarkdown
|
||||
{
|
||||
$Name = "Node"
|
||||
$ToolInstances = Get-CachedToolInstances -Name $Name
|
||||
$Content = $ToolInstances | New-MDTable -Columns ([ordered]@{Version = "left"; Architecture = "left"})
|
||||
|
||||
return Build-MarkdownElement -Head $Name -Content $Content
|
||||
function Get-ToolcachePythonVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Python"
|
||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
|
||||
}
|
||||
|
||||
function Get-PythonMarkdown
|
||||
{
|
||||
$Name = "Python"
|
||||
$ToolInstances = Get-CachedToolInstances -Name $Name -VersionCommand "--version"
|
||||
$Content = $ToolInstances | New-MDTable -Columns ([ordered]@{Version = "left"; Architecture = "left"})
|
||||
|
||||
return Build-MarkdownElement -Head $Name -Content $Content
|
||||
function Get-ToolcacheRubyVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "Ruby"
|
||||
return Get-ChildItem $toolcachePath -Name | Sort-Object { [Version]$_ }
|
||||
}
|
||||
|
||||
function Get-RubyMarkdown
|
||||
{
|
||||
$Name = "Ruby"
|
||||
$ToolInstances = Get-CachedToolInstances -Name $Name -VersionCommand "--version"
|
||||
$Content = $ToolInstances | New-MDTable -Columns ([ordered]@{Version = "left"; Architecture = "left"})
|
||||
|
||||
return Build-MarkdownElement -Head $Name -Content $Content
|
||||
}
|
||||
|
||||
function Get-PyPyMarkdown
|
||||
{
|
||||
$Name = "PyPy"
|
||||
$ToolInstances = Get-CachedToolInstances -Name $Name
|
||||
foreach ($Instance in $ToolInstances)
|
||||
{
|
||||
$Instance."PyPy Version" = @()
|
||||
$Instance."Python Version" = $Instance.Version
|
||||
foreach ($Arch in $Instance.Architecture_Array)
|
||||
{
|
||||
$pythonExePath = Join-Path $Instance.Path $Arch | Join-Path -ChildPath "python.exe"
|
||||
$Instance."PyPy Version" += (& $pythonExePath -c "import sys;print(sys.version.split('\n')[1])").Trim("[]")
|
||||
function Get-ToolcachePyPyVersions {
|
||||
$toolcachePath = Join-Path $env:AGENT_TOOLSDIRECTORY "PyPy"
|
||||
Get-ChildItem -Path $toolcachePath -Name | Sort-Object { [Version] $_ } | ForEach-Object {
|
||||
$pypyRootPath = Join-Path $toolcachePath $_ "x86"
|
||||
[string]$pypyVersionOutput = & "$pypyRootPath\python.exe" -c "import sys;print(sys.version)"
|
||||
$pypyVersionOutput -match "^([\d\.]+) \(.+\) \[PyPy ([\d\.]+\S*) .+]$" | Out-Null
|
||||
return "{0} [PyPy {1}]" -f $Matches[1], $Matches[2]
|
||||
}
|
||||
}
|
||||
|
||||
$Content = $ToolInstances | New-MDTable -Columns ([ordered]@{
|
||||
"Python Version" = "left";
|
||||
"PyPy Version" = "left"
|
||||
})
|
||||
|
||||
return Build-MarkdownElement -Head $Name -Content $Content
|
||||
}
|
||||
|
||||
function Build-CachedToolsMarkdown
|
||||
function Build-CachedToolsSection
|
||||
{
|
||||
$markdown = ""
|
||||
$markdown += Get-GoMarkdown
|
||||
$markdown += Get-NodeMarkdown
|
||||
$markdown += Get-PythonMarkdown
|
||||
$markdown += Get-RubyMarkdown
|
||||
$markdown += Get-PyPyMarkdown
|
||||
$output = ""
|
||||
|
||||
return $markdown
|
||||
$output += New-MDHeader "Go" -Level 4
|
||||
$output += New-MDList -Lines (Get-ToolcacheGoVersions) -Style Unordered
|
||||
|
||||
$output += New-MDHeader "Node.js" -Level 4
|
||||
$output += New-MDList -Lines (Get-ToolcacheNodeVersions) -Style Unordered
|
||||
|
||||
$output += New-MDHeader "Python" -Level 4
|
||||
$output += New-MDList -Lines (Get-ToolcachePythonVersions) -Style Unordered
|
||||
|
||||
$output += New-MDHeader "PyPy" -Level 4
|
||||
$output += New-MDList -Lines (Get-ToolcachePyPyVersions) -Style Unordered
|
||||
|
||||
$output += New-MDHeader "Ruby" -Level 4
|
||||
$output += New-MDList -Lines (Get-ToolcacheRubyVersions) -Style Unordered
|
||||
|
||||
return $output
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ function Initialize-RustEnvironment {
|
||||
}
|
||||
|
||||
function Get-OSName {
|
||||
return (Get-CimInstance -ClassName Win32_OperatingSystem).Caption
|
||||
return (Get-CimInstance -ClassName Win32_OperatingSystem).Caption | Take-Part -Part 1,2,3
|
||||
}
|
||||
|
||||
function Get-OSVersion {
|
||||
@@ -124,7 +124,7 @@ function Get-ChocoVersion {
|
||||
|
||||
function Get-VcpkgVersion {
|
||||
$commitId = git -C "C:\vcpkg" rev-parse --short HEAD
|
||||
return "Vcpkg (build from master \<$commitId>)"
|
||||
return "Vcpkg (build from commit $commitId)"
|
||||
}
|
||||
|
||||
function Get-NPMVersion {
|
||||
@@ -190,7 +190,7 @@ function Get-SbtVersion {
|
||||
|
||||
function Get-DotnetSdks {
|
||||
$sdksRawList = dotnet --list-sdks
|
||||
$sdkVersions = ($sdksRawList | Foreach-Object {$_.Split()[0]}) -join ' '
|
||||
$sdkVersions = ($sdksRawList | Foreach-Object {$_.Split()[0]}) -join ', '
|
||||
$sdkPath = $sdksRawList[0].Split(' ', 2)[1] -replace '\[|]'
|
||||
[PSCustomObject]@{
|
||||
Versions = $sdkVersions
|
||||
@@ -214,7 +214,7 @@ function Get-DotnetRuntimes {
|
||||
$runtimesRawList = dotnet --list-runtimes
|
||||
$runtimesRawList | Group-Object {$_.Split()[0]} | ForEach-Object {
|
||||
$runtimeName = $_.Name
|
||||
$runtimeVersions = ($_.Group | Foreach-Object {$_.split()[1]}) -join ' '
|
||||
$runtimeVersions = ($_.Group | Foreach-Object {$_.split()[1]}) -join ', '
|
||||
$runtimePath = $_.Group[0].Split(' ', 3)[2] -replace '\[|]'
|
||||
[PSCustomObject]@{
|
||||
"Runtime" = $runtimeName
|
||||
@@ -224,68 +224,61 @@ function Get-DotnetRuntimes {
|
||||
}
|
||||
}
|
||||
|
||||
function Get-DotnetFrameworkTools {
|
||||
$path = "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\*\*\NETFX*"
|
||||
Get-ChildItem -Path $path -Directory | Group-Object {
|
||||
$_.Fullname -Replace " \d+\.\d+(\.\d+)?", " <version>"
|
||||
} | ForEach-Object {
|
||||
[PSCustomObject]@{
|
||||
Versions = $_.Group.Name | ForEach-Object { $_.Split(" ")[1] }
|
||||
Path = $_.Name
|
||||
}
|
||||
}
|
||||
function Get-DotnetFrameworkVersions {
|
||||
$path = "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\*\*\NETFX * Tools"
|
||||
$versions = Get-ChildItem -Path $path -Directory | ForEach-Object { $_.Name | Take-Part -Part 1 }
|
||||
$versions -join ', '
|
||||
}
|
||||
|
||||
function Get-PowerShellAzureModules {
|
||||
# Module names
|
||||
$names = @{
|
||||
'az' = 'Az'
|
||||
'azurerm' = 'AzureRM'
|
||||
'azure' = 'Azure'
|
||||
[Array] $result = @()
|
||||
$defaultAzureModuleVersion = "2.1.0"
|
||||
|
||||
[Array] $azInstalledModules = Get-ChildItem -Path "C:\Modules\az_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] }
|
||||
if ($azInstalledModules.Count -gt 0) {
|
||||
$result += "Az: $($azInstalledModules -join ', ')"
|
||||
}
|
||||
|
||||
# Get default module version
|
||||
$defaults = @{
|
||||
'azurerm' = (Get-Module -Name AzureRM -ListAvailable).Version
|
||||
'azure' = (Get-Module -Name Azure -ListAvailable).Version
|
||||
[Array] $azureInstalledModules = Get-ChildItem -Path "C:\Modules\azure_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] } | ForEach-Object { if ($_ -eq $defaultAzureModuleVersion) { "$($_) (Default)" } else { $_ } }
|
||||
if ($azureInstalledModules.Count -gt 0) {
|
||||
$result += "Azure: $($azureInstalledModules -join ', ')"
|
||||
}
|
||||
|
||||
$modulesPath = "C:\Modules"
|
||||
$modules = Get-ChildItem -Path $modulesPath | Sort-Object Name | Group-Object {$_.Name.Split('_')[0]}
|
||||
$modules | ForEach-Object {
|
||||
$group = $_.group | Sort-Object {[Version]$_.Name.Split('_')[1].Replace(".zip","")}
|
||||
$moduleName = $names[$_.Name]
|
||||
$moduleVersions = $group | ForEach-Object {$_.Name.Split('_')[1]}
|
||||
$moduleVersions = $moduleVersions -join '<br>'
|
||||
$modulePath = (($group.FullName).Split("_"))[0] + '_\<version\>'
|
||||
|
||||
# set default version
|
||||
$defaultVersion = $defaults[$_.Name]
|
||||
if ($defaultVersion) {
|
||||
$moduleVersions = $moduleVersions.Replace($defaultVersion, "$defaultVersion [Installed]")
|
||||
[Array] $azurermInstalledModules = Get-ChildItem -Path "C:\Modules\azurerm_*" -Directory | ForEach-Object { $_.Name.Split("_")[1] } | ForEach-Object { if ($_ -eq $defaultAzureModuleVersion) { "$($_) (Default)" } else { $_ } }
|
||||
if ($azurermInstalledModules.Count -gt 0) {
|
||||
$result += "AzureRM: $($azurermInstalledModules -join ', ')"
|
||||
}
|
||||
|
||||
[PSCustomObject]@{
|
||||
Module = $moduleName
|
||||
Version = $moduleVersions
|
||||
Path = $modulePath
|
||||
[Array] $azCachedModules = Get-ChildItem -Path "C:\Modules\az_*.zip" -File | ForEach-Object { $_.Name.Split("_")[1] }
|
||||
if ($azCachedModules.Count -gt 0) {
|
||||
$result += "Az (Cached): $($azCachedModules -join ', ')"
|
||||
}
|
||||
|
||||
[Array] $azureCachedModules = Get-ChildItem -Path "C:\Modules\azure_*.zip" -File | ForEach-Object { $_.Name.Split("_")[1] }
|
||||
if ($azureCachedModules.Count -gt 0) {
|
||||
$result += "Azure (Cached): $($azureCachedModules -join ', ')"
|
||||
}
|
||||
|
||||
[Array] $azurermCachedModules = Get-ChildItem -Path "C:\Modules\azurerm_*.zip" -File | ForEach-Object { $_.Name.Split("_")[1] }
|
||||
if ($azurermCachedModules.Count -gt 0) {
|
||||
$result += "AzureRM: $($azurermCachedModules -join ', ')"
|
||||
}
|
||||
|
||||
return $result
|
||||
}
|
||||
|
||||
function Get-PowerShellModules {
|
||||
$modules = (Get-ToolsetContent).powershellModules.name
|
||||
[Array] $result = @()
|
||||
|
||||
$psModules = Get-Module -Name $modules -ListAvailable | Sort-Object Name | Group-Object Name
|
||||
$psModules | ForEach-Object {
|
||||
$moduleName = $_.Name
|
||||
$moduleVersions = ($_.group.Version | Sort-Object -Unique) -join '<br>'
|
||||
$result += Get-PowerShellAzureModules
|
||||
|
||||
[PSCustomObject]@{
|
||||
Module = $moduleName
|
||||
Version = $moduleVersions
|
||||
}
|
||||
$result += (Get-ToolsetContent).powershellModules.name | Sort-Object | ForEach-Object {
|
||||
$moduleName = $_
|
||||
$moduleVersions = Get-Module -Name $moduleName -ListAvailable | Select-Object -ExpandProperty Version | Sort-Object -Unique
|
||||
return "$($moduleName): $($moduleVersions -join ', ')"
|
||||
}
|
||||
|
||||
return $result
|
||||
}
|
||||
|
||||
function Get-CachedDockerImages {
|
||||
@@ -343,24 +336,14 @@ function Get-PipxVersion {
|
||||
}
|
||||
|
||||
function Build-PackageManagementEnvironmentTable {
|
||||
$envVariables = @(
|
||||
@{
|
||||
return @(
|
||||
[PSCustomObject] @{
|
||||
"Name" = "VCPKG_INSTALLATION_ROOT"
|
||||
"Value" = $env:VCPKG_INSTALLATION_ROOT
|
||||
}
|
||||
)
|
||||
if (Test-IsWin19) {
|
||||
$envVariables += @(
|
||||
@{
|
||||
},
|
||||
[PSCustomObject] @{
|
||||
"Name" = "CONDA"
|
||||
"Value" = $env:CONDA
|
||||
}
|
||||
)
|
||||
}
|
||||
return $envVariables | ForEach-Object {
|
||||
[PSCustomObject] @{
|
||||
"Name" = $_.Name
|
||||
"Value" = $_.Value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ $markdown += New-MDList -Style Unordered -Lines @(
|
||||
"Image Version: $env:IMAGE_VERSION"
|
||||
)
|
||||
|
||||
$markdown += New-MDHeader "Enabled windows optional features" -Level 2
|
||||
$markdown += New-MDHeader "Windows features" -Level 2
|
||||
$markdown += New-MDList -Style Unordered -Lines @(
|
||||
"Windows Subsystem for Linux [WSLv1]"
|
||||
"Windows Subsystem for Linux (WSLv1): Enabled"
|
||||
)
|
||||
|
||||
$markdown += New-MDHeader "Installed Software" -Level 2
|
||||
@@ -165,7 +165,7 @@ $markdown += New-MDList -Style Unordered -Lines (@(
|
||||
) | Sort-Object
|
||||
)
|
||||
|
||||
$markdown += New-MDHeader "Browsers and webdrivers" -Level 3
|
||||
$markdown += New-MDHeader "Browsers and Drivers" -Level 3
|
||||
$markdown += New-MDList -Style Unordered -Lines @(
|
||||
(Get-BrowserVersion -Browser "chrome"),
|
||||
(Get-SeleniumWebDriverVersion -Driver "chrome"),
|
||||
@@ -208,7 +208,7 @@ if (Test-IsWin19)
|
||||
}
|
||||
|
||||
$markdown += New-MDHeader "Cached Tools" -Level 3
|
||||
$markdown += (Build-CachedToolsMarkdown)
|
||||
$markdown += (Build-CachedToolsSection)
|
||||
|
||||
$markdown += New-MDHeader "Databases" -Level 3
|
||||
$markdown += Build-DatabasesMarkdown
|
||||
@@ -241,46 +241,29 @@ $markdown += New-MDNewLine
|
||||
|
||||
$markdown += New-MDHeader "Installed Windows SDKs" -Level 4
|
||||
$sdk = Get-WindowsSDKs
|
||||
$markdown += "``Location $($sdk.Path)``"
|
||||
$markdown += New-MDNewLine
|
||||
$markdown += New-MDList -Lines $sdk.Versions -Style Unordered
|
||||
|
||||
$markdown += New-MDHeader ".NET Core SDK" -Level 3
|
||||
$sdk = Get-DotnetSdks
|
||||
$markdown += "``Location $($sdk.Path)``"
|
||||
$markdown += New-MDNewLine
|
||||
$markdown += New-MDList -Lines $sdk.Versions -Style Unordered
|
||||
|
||||
$markdown += New-MDHeader ".NET Core Runtime" -Level 3
|
||||
Get-DotnetRuntimes | Foreach-Object {
|
||||
$path = $_.Path
|
||||
$versions = $_.Versions
|
||||
$markdown += "``Location: $path``"
|
||||
$markdown += New-MDNewLine
|
||||
$markdown += New-MDList -Lines $versions -Style Unordered
|
||||
$markdown += New-MDHeader ".NET Core Tools" -Level 3
|
||||
$dotnetSdk = Get-DotnetSdks
|
||||
$dotnetFrameworkVersions = Get-DotnetFrameworkVersions
|
||||
$dotnetTools = @(
|
||||
".NET Core SDK: $($dotnetSdk.Versions)",
|
||||
".NET Framework: $($dotnetFrameworkVersions)"
|
||||
)
|
||||
$dotnetTools += Get-DotnetRuntimes | ForEach-Object {
|
||||
"$($_.Runtime): $($_.Versions)"
|
||||
}
|
||||
$dotnetTools += Get-DotnetTools
|
||||
$markdown += New-MDList -Style Unordered -Lines $dotnetTools
|
||||
|
||||
$markdown += New-MDHeader ".NET Framework" -Level 3
|
||||
$markdown += "``Type: Developer Pack``"
|
||||
$markdown += New-MDNewLine
|
||||
Get-DotnetFrameworkTools | Foreach-Object {
|
||||
$path = $_.Path
|
||||
$versions = $_.Versions
|
||||
$markdown += "``Location: $path``"
|
||||
$markdown += New-MDNewLine
|
||||
$markdown += New-MDList -Lines $versions -Style Unordered
|
||||
}
|
||||
|
||||
$markdown += New-MDHeader ".NET tools" -Level 3
|
||||
$tools = Get-DotnetTools
|
||||
$markdown += New-MDList -Lines $tools -Style Unordered
|
||||
|
||||
# PowerShell Tools
|
||||
$markdown += New-MDHeader "PowerShell Tools" -Level 3
|
||||
$markdown += New-MDList -Lines (Get-PowershellCoreVersion) -Style Unordered
|
||||
|
||||
$markdown += New-MDHeader "Azure Powershell Modules" -Level 4
|
||||
$markdown += Get-PowerShellAzureModules | New-MDTable
|
||||
$markdown += New-MDHeader "Powershell Modules" -Level 4
|
||||
$markdown += New-MDList -Lines $(Get-PowerShellModules) -Style Unordered
|
||||
$reportAzPwsh = @'
|
||||
```
|
||||
Azure PowerShell module 2.1.0 and AzureRM PowerShell module 2.1.0 are installed
|
||||
@@ -290,9 +273,6 @@ All other versions are saved but not installed.
|
||||
'@
|
||||
$markdown += New-MDParagraph -Lines $reportAzPwsh
|
||||
|
||||
$markdown += New-MDHeader "Powershell Modules" -Level 4
|
||||
$markdown += Get-PowerShellModules | New-MDTable
|
||||
$markdown += New-MDNewLine
|
||||
|
||||
# Android section
|
||||
$markdown += New-MDHeader "Android" -Level 3
|
||||
|
||||
@@ -126,7 +126,7 @@ function Get-MercurialVersion {
|
||||
|
||||
function Get-NSISVersion {
|
||||
$nsisVersion = &"c:\Program Files (x86)\NSIS\makensis.exe" "/Version"
|
||||
return "NSIS $nsisVersion"
|
||||
return "NSIS $($nsisVersion.TrimStart('v'))"
|
||||
}
|
||||
|
||||
function Get-OpenSSLVersion {
|
||||
@@ -148,7 +148,8 @@ function Get-ParcelVersion {
|
||||
}
|
||||
|
||||
function Get-PulumiVersion {
|
||||
return "Pulumi $(pulumi version)"
|
||||
$pulumiVersion = $(pulumi version)
|
||||
return "Pulumi $($pulumiVersion.TrimStart('v'))"
|
||||
}
|
||||
|
||||
function Get-SQLPSVersion {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
Import-Module (Join-Path $PSScriptRoot "..\SoftwareReport\SoftwareReport.Common.psm1") -DisableNameChecking
|
||||
|
||||
Describe "Azure Cosmos DB Emulator" {
|
||||
$cosmosDbEmulatorRegKey = Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*" | Get-ItemProperty | Where-Object { $_.DisplayName -eq 'Azure Cosmos DB Emulator' }
|
||||
$installDir = $cosmosDbEmulatorRegKey.InstallLocation
|
||||
@@ -103,7 +101,7 @@ Describe "GoogleCloudSDK" -Skip:(Test-IsWin22) {
|
||||
|
||||
Describe "NET48" {
|
||||
It "NET48" {
|
||||
(Get-DotnetFrameworkTools).Versions | Should -Contain "4.8"
|
||||
Get-ChildItem -Path "${env:ProgramFiles(x86)}\Microsoft SDKs\Windows\*\*\NETFX 4.8 Tools" -Directory | Should -HaveCount 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user