mirror of
https://github.com/actions/runner-images.git
synced 2025-12-29 05:17:11 +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,12 +1,12 @@
|
||||
function Get-BashVersion {
|
||||
$version = bash -c 'echo ${BASH_VERSION}'
|
||||
return "Bash $version"
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-DotnetVersionList {
|
||||
$sdkRawList = Run-Command "dotnet --list-sdks"
|
||||
$sdkVersionList = $sdkRawList | ForEach-Object { Take-Part $_ -Part 0 }
|
||||
return ".NET SDK " + [string]::Join(" ", $sdkVersionList)
|
||||
return [string]::Join(" ", $sdkVersionList)
|
||||
}
|
||||
|
||||
function Get-GoVersion {
|
||||
@@ -15,101 +15,109 @@ function Get-GoVersion {
|
||||
$goOutput = $goOutput.Substring(2)
|
||||
}
|
||||
|
||||
return "Go $goOutput"
|
||||
return $goOutput
|
||||
}
|
||||
|
||||
function Get-RVersion {
|
||||
$rVersion = Run-Command "R --version | grep 'R version'" | Take-Part -Part 2
|
||||
return "R $rVersion"
|
||||
return $rVersion
|
||||
}
|
||||
|
||||
function Get-RustVersion {
|
||||
$rustVersion = Run-Command "rustc --version" | Take-Part -Part 1
|
||||
return "Rust $rustVersion"
|
||||
return $rustVersion
|
||||
}
|
||||
|
||||
function Get-RustfmtVersion {
|
||||
$version = Run-Command "rustfmt --version" | Take-Part -Part 1
|
||||
return "Rustfmt $version"
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-RustdocVersion {
|
||||
$version = Run-Command "rustdoc --version" | Take-Part -Part 1
|
||||
return "Rustdoc $version"
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-RustCargoVersion {
|
||||
$version = Run-Command "cargo --version" | Take-Part -Part 1
|
||||
return "Cargo $version"
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-RustClippyVersion {
|
||||
$version = Run-Command "cargo clippy --version" | Take-Part -Part 1
|
||||
return "Clippy $version"
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-Bindgen {
|
||||
$bindgenVersion = Run-Command "bindgen --version" | Take-Part -Part 1
|
||||
return "Bindgen $bindgenVersion"
|
||||
return $bindgenVersion
|
||||
}
|
||||
|
||||
function Get-Cbindgen {
|
||||
$cbindgenVersion = Run-Command "cbindgen --version" | Take-Part -Part 1
|
||||
return "Cbindgen $cbindgenVersion"
|
||||
return $cbindgenVersion
|
||||
}
|
||||
|
||||
function Get-Cargooutdated {
|
||||
$cargoOutdatedVersion = Run-Command "cargo outdated --version" | Take-Part -Part 1
|
||||
return "Cargo-outdated $cargoOutdatedVersion"
|
||||
return $cargoOutdatedVersion
|
||||
}
|
||||
|
||||
function Get-Cargoaudit {
|
||||
$cargoAuditVersion = Run-Command "cargo-audit --version" | Take-Part -Part 1
|
||||
return "Cargo-audit $cargoAuditVersion"
|
||||
return $cargoAuditVersion
|
||||
}
|
||||
|
||||
function Get-RustupVersion {
|
||||
$rustupVersion = Run-Command "rustup --version" | Select-Object -First 1 | Take-Part -Part 1
|
||||
return "Rustup ${rustupVersion}"
|
||||
return $rustupVersion
|
||||
}
|
||||
|
||||
function Get-VcpkgVersion {
|
||||
$vcpkgVersion = Run-Command "vcpkg version" | Select-Object -First 1 | Take-Part -Part 5 | Take-Part -Part 0 -Delimiter "-"
|
||||
$commitId = git -C "/usr/local/share/vcpkg" rev-parse --short HEAD
|
||||
return "Vcpkg $vcpkgVersion (build from master \<$commitId>)"
|
||||
return "$vcpkgVersion (build from master \<$commitId>)"
|
||||
}
|
||||
|
||||
function Get-GccVersion {
|
||||
function Get-GccVersions {
|
||||
$versionList = Get-ToolsetValue -KeyPath gcc.versions
|
||||
$versionList | Foreach-Object {
|
||||
$version = Run-Command "gcc-${_} --version" | Select-Object -First 1
|
||||
"$version - available by ``gcc-${_}`` alias"
|
||||
$nameVersion = Run-Command "gcc-${_} --version" | Select-Object -First 1
|
||||
$version = ($nameVersion -replace "^gcc-${_}").Trim() -replace '\).*$', ')'
|
||||
return [ToolNode]::new("GCC ${_}", "$version - available by ``gcc-${_}`` alias")
|
||||
}
|
||||
}
|
||||
|
||||
function Get-FortranVersion {
|
||||
function Get-FortranVersions {
|
||||
$versionList = Get-ToolsetValue -KeyPath gcc.versions
|
||||
$versionList | Foreach-Object {
|
||||
$version = Run-Command "gfortran-${_} --version" | Select-Object -First 1
|
||||
"$version - available by ``gfortran-${_}`` alias"
|
||||
$nameVersion = Run-Command "gfortran-${_} --version" | Select-Object -First 1
|
||||
$version = ($nameVersion -replace "^GNU Fortran").Trim() -replace '\).*$', ')'
|
||||
return [ToolNode]::new("GNU Fortran ${_}", "$version - available by ``gfortran-${_}`` alias")
|
||||
}
|
||||
}
|
||||
|
||||
function Get-ClangLLVMVersion {
|
||||
$toolsetVersion = '$(brew --prefix llvm@{0})/bin/clang' -f (Get-ToolsetValue 'llvm.version')
|
||||
$locationsList = @("$((Get-Command clang).Source)", $toolsetVersion)
|
||||
$locationsList | Foreach-Object {
|
||||
(Run-Command "${_} --version" | Out-String) -match "(?<version>\d+\.\d+\.\d+)" | Out-Null
|
||||
$version = $Matches.version
|
||||
"Clang/LLVM $version " + $(if(${_} -Match "brew") {"is available on ```'${_}`'``"} else {"is default"})
|
||||
}
|
||||
function Get-ClangLLVMVersions {
|
||||
$clangVersionRegex = [Regex]::new("(?<version>\d+\.\d+\.\d+)")
|
||||
|
||||
$defaultClangOutput = Run-Command "clang --version" | Out-String
|
||||
$defaultClangVersion = $clangVersionRegex.Match($defaultClangOutput).Groups['version'].Value
|
||||
|
||||
$homebrewClangPath = '$(brew --prefix llvm@{0})/bin/clang' -f (Get-ToolsetValue 'llvm.version')
|
||||
$homebrewClangOutput = Run-Command "$homebrewClangPath --version" | Out-String
|
||||
$homebrewClangVersion = $clangVersionRegex.Match($homebrewClangOutput).Groups['version'].Value
|
||||
|
||||
return @(
|
||||
[ToolNode]::new("Clang/LLVM", $defaultClangVersion)
|
||||
[ToolNode]::new("Clang/LLVM (Homebrew)", "$homebrewClangVersion - available on ```'$homebrewClangPath`'``")
|
||||
)
|
||||
}
|
||||
|
||||
function Get-NVMVersion {
|
||||
$nvmPath = Join-Path $env:HOME ".nvm" "nvm.sh"
|
||||
$nvmInitCommand = ". ${nvmPath} > /dev/null 2>&1 || true"
|
||||
$nodejsVersion = Run-Command "${nvmInitCommand} && nvm --version"
|
||||
return "NVM $nodejsVersion"
|
||||
return $nodejsVersion
|
||||
}
|
||||
|
||||
function Get-PipVersion {
|
||||
@@ -123,12 +131,12 @@ function Get-PipVersion {
|
||||
$versionPart1 = $commandOutput | Take-Part -Part 1
|
||||
$versionPart2 = $commandOutput | Take-Part -Part 4
|
||||
$versionPart3 = $commandOutput | Take-Part -Part 5
|
||||
return "Pip ${versionPart1} ${versionPart2} ${versionPart3}"
|
||||
return "${versionPart1} ${versionPart2} ${versionPart3}"
|
||||
}
|
||||
|
||||
function Get-PipxVersion {
|
||||
$pipxVersion = Run-Command "pipx --version" -SuppressStderr
|
||||
return "Pipx $pipxVersion"
|
||||
return $pipxVersion
|
||||
}
|
||||
|
||||
function Get-NVMNodeVersionList {
|
||||
@@ -137,19 +145,27 @@ function Get-NVMNodeVersionList {
|
||||
$nodejsVersionsRaw = Run-Command "${nvmInitCommand} && nvm ls"
|
||||
$nodeVersions = $nodejsVersionsRaw | ForEach-Object { $_.TrimStart(" ").TrimEnd(" *") } | Where-Object { $_.StartsWith("v") }
|
||||
$result = [string]::Join(" ", $nodeVersions)
|
||||
return "NVM - Cached node versions: $result"
|
||||
return $result
|
||||
}
|
||||
|
||||
function Build-OSInfoSection {
|
||||
param (
|
||||
[string] $ImageName
|
||||
)
|
||||
|
||||
$fieldsToInclude = @("System Version:", "Kernel Version:")
|
||||
$rawSystemInfo = Invoke-Expression "system_profiler SPSoftwareDataType"
|
||||
$parsedSystemInfo = $rawSystemInfo | Where-Object { -not ($_ | Select-String -NotMatch $fieldsToInclude) } | ForEach-Object { $_.Trim() }
|
||||
$output = ""
|
||||
$parsedSystemInfo[0] -match "System Version: macOS (?<version>\d+\.\d+)" | Out-Null
|
||||
$version = $Matches.Version
|
||||
$output += New-MDHeader "macOS $version info" -Level 1
|
||||
$output += New-MDList -Style Unordered -Lines $parsedSystemInfo -NoNewLine
|
||||
return $output
|
||||
$systemVersion = $parsedSystemInfo[0].Replace($fieldsToInclude[0],"").Trim()
|
||||
$kernelVersion = $parsedSystemInfo[1].Replace($fieldsToInclude[1],"").Trim()
|
||||
|
||||
$osInfoNode = [HeaderNode]::new("macOS $version info")
|
||||
$osInfoNode.AddToolNode("System Version:", $systemVersion)
|
||||
$osInfoNode.AddToolNode("Kernel Version:", $kernelVersion)
|
||||
$osInfoNode.AddToolNode("Image Version:", $ImageName.Split('_')[1])
|
||||
return $osInfoNode
|
||||
}
|
||||
|
||||
function Get-MSBuildVersion {
|
||||
@@ -157,404 +173,407 @@ function Get-MSBuildVersion {
|
||||
$result = Select-String -Path (Get-Command msbuild).Source -Pattern "msbuild"
|
||||
$result -match "(?<path>\/\S*\.dll)" | Out-Null
|
||||
$msbuildPath = $Matches.path
|
||||
return "MSBuild $msbuildVersion (from $msbuildPath)"
|
||||
return "$msbuildVersion (from $msbuildPath)"
|
||||
}
|
||||
|
||||
function Get-NodeVersion {
|
||||
$nodeVersion = Run-Command "node --version"
|
||||
return "Node.js $nodeVersion"
|
||||
return $nodeVersion
|
||||
}
|
||||
|
||||
function Get-PerlVersion {
|
||||
$version = Run-Command "perl -e 'print substr(`$^V,1)'"
|
||||
return "Perl $version"
|
||||
return $version
|
||||
}
|
||||
|
||||
function Get-PythonVersion {
|
||||
$pythonVersion = Run-Command "python --version"
|
||||
return $pythonVersion
|
||||
return ($pythonVersion -replace "^Python").Trim()
|
||||
}
|
||||
|
||||
function Get-Python3Version {
|
||||
$python3Version = Run-Command "python3 --version"
|
||||
return $python3Version
|
||||
return ($python3Version -replace "^Python").Trim()
|
||||
}
|
||||
|
||||
function Get-RubyVersion {
|
||||
$rubyVersion = Run-Command "ruby --version" | Take-Part -Part 1
|
||||
return "Ruby $rubyVersion"
|
||||
return $rubyVersion
|
||||
}
|
||||
|
||||
function Get-PHPVersion {
|
||||
$PHPVersion = Run-Command "php --version" | Select-Object -First 1 | Take-Part -Part 0,1
|
||||
return $PHPVersion
|
||||
return ($PHPVersion -replace "^PHP").Trim()
|
||||
}
|
||||
|
||||
function Get-JuliaVersion {
|
||||
$juliaVersion = Run-Command "julia --version" | Take-Part -Part 0,2
|
||||
return $juliaVersion
|
||||
return ($juliaVersion -replace "^Julia").Trim()
|
||||
}
|
||||
|
||||
function Get-BundlerVersion {
|
||||
$bundlerVersion = Run-Command "bundle --version"
|
||||
return $bundlerVersion
|
||||
return ($bundlerVersion -replace "^Bundler").Trim()
|
||||
}
|
||||
|
||||
function Get-CarthageVersion {
|
||||
$carthageVersion = Run-Command "carthage version" -SuppressStderr
|
||||
return "Carthage $carthageVersion"
|
||||
return $carthageVersion
|
||||
}
|
||||
|
||||
function Get-CocoaPodsVersion {
|
||||
$cocoaPodsVersion = Run-Command "pod --version"
|
||||
return "CocoaPods $cocoaPodsVersion"
|
||||
return $cocoaPodsVersion
|
||||
}
|
||||
|
||||
function Get-HomebrewVersion {
|
||||
$homebrewVersion = Run-Command "brew --version" | Select-Object -First 1
|
||||
return $homebrewVersion
|
||||
return ($homebrewVersion -replace "^Homebrew").Trim()
|
||||
}
|
||||
|
||||
function Get-NPMVersion {
|
||||
$NPMVersion = Run-Command "npm --version"
|
||||
return "NPM $NPMVersion"
|
||||
return $NPMVersion
|
||||
}
|
||||
|
||||
function Get-YarnVersion {
|
||||
$yarmVersion = Run-Command "yarn --version"
|
||||
return "Yarn $yarmVersion"
|
||||
return $yarmVersion
|
||||
}
|
||||
|
||||
function Get-NuGetVersion {
|
||||
$nugetVersion = Run-Command "nuget help" | Select-Object -First 1 | Take-Part -Part 2
|
||||
return "NuGet $nugetVersion"
|
||||
return $nugetVersion
|
||||
}
|
||||
|
||||
function Get-CondaVersion {
|
||||
$condaVersion = Invoke-Expression "conda --version"
|
||||
return "Mini$condaVersion"
|
||||
return ($condaVersion -replace "^conda").Trim()
|
||||
}
|
||||
|
||||
function Get-RubyGemsVersion {
|
||||
$rubyGemsVersion = Run-Command "gem --version"
|
||||
return "RubyGems $rubyGemsVersion"
|
||||
return $rubyGemsVersion
|
||||
}
|
||||
|
||||
function Get-ComposerVersion {
|
||||
$composerVersion = Run-Command "composer --version" | Take-Part -Part 2
|
||||
return "Composer $composerVersion"
|
||||
return $composerVersion
|
||||
}
|
||||
|
||||
function Get-MavenVersion {
|
||||
$mavenVersion = Run-Command "mvn -version" | Select-Object -First 1 | Take-Part -Part 2
|
||||
return "Apache Maven $mavenVersion"
|
||||
return $mavenVersion
|
||||
}
|
||||
|
||||
#gradle output differs on the first launch – a welcome message, that we don't need is rendered. The solution is to take the last "Gradle" occurrence from the output
|
||||
function Get-GradleVersion {
|
||||
$gradleVersion = (Run-Command "gradle --version" | Select-String "Gradle")[-1]
|
||||
return $gradleVersion
|
||||
return ($gradleVersion.Line -replace "^Gradle").Trim()
|
||||
}
|
||||
|
||||
function Get-ApacheAntVersion {
|
||||
$apacheAntVersion = Run-Command "ant -version" | Take-Part -Part 0,1,3
|
||||
return $apacheAntVersion
|
||||
return ($apacheAntVersion -replace "^Apache Ant\(TM\)").Trim()
|
||||
}
|
||||
|
||||
function Get-CurlVersion {
|
||||
$curlVersion = Run-Command "curl --version" | Select-Object -First 1 | Take-Part -Part 1
|
||||
return "Curl $curlVersion"
|
||||
return $curlVersion
|
||||
}
|
||||
|
||||
function Get-GitVersion {
|
||||
$gitVersion = Run-Command "git --version" | Take-Part -Part -1
|
||||
return "Git $gitVersion"
|
||||
return $gitVersion
|
||||
}
|
||||
|
||||
function Get-GitLFSVersion {
|
||||
$gitLFSVersion = Run-Command "git-lfs version" | Take-Part -Part 0 | Take-Part -Part 1 -Delimiter "/"
|
||||
return "Git LFS: $gitLFSVersion"
|
||||
return $gitLFSVersion
|
||||
}
|
||||
|
||||
function Get-GitHubCLIVersion {
|
||||
$ghVersion = Run-Command "gh --version" | Select-String "gh version" | Select-Object -First 1 | Take-Part -Part 2
|
||||
return "GitHub CLI: $ghVersion"
|
||||
return $ghVersion
|
||||
}
|
||||
|
||||
function Get-HubVersion {
|
||||
$hubVersion = Run-Command "brew list --versions hub" | Take-Part -Part 1
|
||||
return "Hub CLI: $hubVersion"
|
||||
return $hubVersion
|
||||
}
|
||||
|
||||
function Get-WgetVersion {
|
||||
$wgetVersion = Run-Command "wget --version" | Select-String "GNU Wget" | Take-Part -Part 2
|
||||
return "GNU Wget $wgetVersion"
|
||||
return $wgetVersion
|
||||
}
|
||||
|
||||
function Get-SVNVersion {
|
||||
$svnVersion = Run-Command "svn --version --quiet"
|
||||
return "Subversion (SVN) $svnVersion"
|
||||
return $svnVersion
|
||||
}
|
||||
|
||||
function Get-PackerVersion {
|
||||
# Packer 1.7.1 has a bug and outputs version to stderr instead of stdout https://github.com/hashicorp/packer/issues/10855
|
||||
$result = Run-Command -Command "packer --version"
|
||||
$packerVersion = [regex]::matches($result, "(\d+.){2}\d+").Value
|
||||
return "Packer $packerVersion"
|
||||
return $packerVersion
|
||||
}
|
||||
|
||||
function Get-OpenSSLVersion {
|
||||
$opensslVersion = Get-Item /usr/local/opt/openssl@1.1 | ForEach-Object {"{0} ``({1} -> {2})``" -f (Run-Command "openssl version"), $_.FullName, $_.Target}
|
||||
return $opensslVersion
|
||||
return ($opensslVersion -replace "^OpenSSL").Trim()
|
||||
}
|
||||
|
||||
function Get-JqVersion {
|
||||
$jqVersion = Run-Command "jq --version" | Take-Part -Part 1 -Delimiter "-"
|
||||
return "jq $jqVersion"
|
||||
return $jqVersion
|
||||
}
|
||||
|
||||
function Get-GPGVersion {
|
||||
$gpgVersion = Run-Command "gpg --version" | Select-String 'gpg (GnuPG)' -SimpleMatch
|
||||
return $gpgVersion
|
||||
return ($gpgVersion.Line -replace "^gpg \(GnuPG\)").Trim()
|
||||
}
|
||||
|
||||
function Get-PostgresClientVersion {
|
||||
$postgresClientVersion = Run-Command "psql --version"
|
||||
return $postgresClientVersion
|
||||
return ($postgresClientVersion -replace "^psql \(PostgreSQL\)").Trim()
|
||||
}
|
||||
|
||||
function Get-PostgresServerVersion {
|
||||
$postgresServerVersion = Run-Command "pg_config --version"
|
||||
return $postgresServerVersion
|
||||
return ($postgresServerVersion -replace "^PostgreSQL").Trim()
|
||||
}
|
||||
|
||||
function Get-Aria2Version {
|
||||
$aria2Version = Run-Command "aria2c --version" | Select-Object -First 1 | Take-Part -Part 2
|
||||
return "aria2 $aria2Version"
|
||||
return $aria2Version
|
||||
}
|
||||
|
||||
function Get-AzcopyVersion {
|
||||
$azcopyVersion = Run-Command "azcopy --version" | Take-Part -Part 2
|
||||
return "azcopy $azcopyVersion"
|
||||
return $azcopyVersion
|
||||
}
|
||||
|
||||
function Get-ZstdVersion {
|
||||
$zstdVersion = Run-Command "zstd --version" | Take-Part -Part 1 -Delimiter "v" | Take-Part -Part 0 -Delimiter ","
|
||||
return "zstd $zstdVersion"
|
||||
return $zstdVersion
|
||||
}
|
||||
|
||||
function Get-BazelVersion {
|
||||
$bazelVersion = Run-Command "bazel --version" | Take-Part -Part 0 -Delimiter "-"
|
||||
return $bazelVersion
|
||||
return ($bazelVersion -replace "^bazel").Trim()
|
||||
}
|
||||
|
||||
function Get-BazeliskVersion {
|
||||
$bazeliskVersion = Run-Command "brew list bazelisk --versions"
|
||||
return $bazeliskVersion
|
||||
return ($bazeliskVersion -replace "^bazelisk").Trim()
|
||||
}
|
||||
|
||||
function Get-HelmVersion {
|
||||
$helmVersion = Run-Command "helm version --short"
|
||||
return "helm $helmVersion"
|
||||
return $helmVersion
|
||||
}
|
||||
|
||||
function Get-MongoVersion {
|
||||
$mongo = Run-Command "mongo --version" | Select-String "MongoDB shell version" | Take-Part -Part 3
|
||||
return "mongo $mongo"
|
||||
return $mongo
|
||||
}
|
||||
|
||||
function Get-MongodVersion {
|
||||
$mongod = Run-Command "mongod --version" | Select-String "db version " | Take-Part -Part 2
|
||||
return "mongod $mongod"
|
||||
return $mongod
|
||||
}
|
||||
|
||||
function Get-7zipVersion {
|
||||
$7zip = Run-Command "7z i" | Select-String "7-Zip" | Take-Part -Part 0,2
|
||||
return $7zip
|
||||
return ($7zip -replace "^7-Zip").Trim()
|
||||
}
|
||||
|
||||
function Get-GnuTarVersion {
|
||||
$gnuTar = Run-Command "gtar --version" | Select-String "tar" | Take-Part -Part 3
|
||||
return "GNU Tar $gnuTar - available by 'gtar' alias"
|
||||
return "$gnuTar - available by 'gtar' alias"
|
||||
}
|
||||
|
||||
function Get-BsdtarVersion {
|
||||
$bsdtar = Run-Command "tar --version" | Take-Part -Part 1
|
||||
return "bsdtar $bsdtar - available by 'tar' alias"
|
||||
return "$bsdtar - available by 'tar' alias"
|
||||
}
|
||||
|
||||
function Get-NewmanVersion {
|
||||
$newmanVersion = Run-Command "newman --version"
|
||||
return "Newman $newmanVersion"
|
||||
return $newmanVersion
|
||||
}
|
||||
|
||||
function Get-VirtualBoxVersion {
|
||||
$virtualBox = Run-Command "vboxmanage -v"
|
||||
return "VirtualBox $virtualBox"
|
||||
return $virtualBox
|
||||
}
|
||||
|
||||
function Get-VagrantVersion {
|
||||
$vagrant = Run-Command "vagrant -v"
|
||||
return $vagrant
|
||||
return ($vagrant -replace "^Vagrant").Trim()
|
||||
}
|
||||
|
||||
function Get-ParallelVersion {
|
||||
$parallelVersion = Run-Command "parallel --version" | Select-String "GNU parallel" | Select-Object -First 1
|
||||
return $parallelVersion
|
||||
return ($parallelVersion -replace "^GNU parallel").Trim()
|
||||
}
|
||||
|
||||
function Get-FastlaneVersion {
|
||||
$fastlaneVersion = Run-Command "fastlane --version" | Select-String "^fastlane [0-9]" | Take-Part -Part 1
|
||||
return "Fastlane $fastlaneVersion"
|
||||
return $fastlaneVersion
|
||||
}
|
||||
|
||||
function Get-CmakeVersion {
|
||||
$cmakeVersion = Run-Command "cmake --version" | Select-Object -First 1 | Take-Part -Part 2
|
||||
return "Cmake $cmakeVersion"
|
||||
return $cmakeVersion
|
||||
}
|
||||
|
||||
function Get-AppCenterCLIVersion {
|
||||
$appcenterCLIVersion = Run-Command "appcenter --version" | Take-Part -Part 2
|
||||
return "App Center CLI $appcenterCLIVersion"
|
||||
return $appcenterCLIVersion
|
||||
}
|
||||
|
||||
function Get-AzureCLIVersion {
|
||||
$azureCLIVersion = (az version | ConvertFrom-Json).'azure-cli'
|
||||
return "Azure CLI $azureCLIVersion"
|
||||
return $azureCLIVersion
|
||||
}
|
||||
|
||||
function Get-AzureDevopsVersion {
|
||||
$azdevopsVersion = (az version | ConvertFrom-Json).extensions.'azure-devops'
|
||||
return "Azure CLI (azure-devops) $azdevopsVersion"
|
||||
return $azdevopsVersion
|
||||
}
|
||||
|
||||
function Get-AWSCLIVersion {
|
||||
$awsVersion = Run-Command "aws --version" | Take-Part -Part 0 | Take-Part -Delimiter "/" -Part 1
|
||||
return "AWS CLI $awsVersion"
|
||||
return $awsVersion
|
||||
}
|
||||
|
||||
function Get-AWSSAMCLIVersion {
|
||||
$awsSamVersion = Run-Command "sam --version" | Take-Part -Part 3
|
||||
return "AWS SAM CLI $awsSamVersion"
|
||||
return $awsSamVersion
|
||||
}
|
||||
|
||||
function Get-AWSSessionManagerCLIVersion {
|
||||
$awsSessionManagerVersion = Run-Command "session-manager-plugin --version"
|
||||
return "AWS Session Manager CLI $awsSessionManagerVersion"
|
||||
return $awsSessionManagerVersion
|
||||
}
|
||||
|
||||
function Get-AliyunCLIVersion {
|
||||
$aliyunVersion = Run-Command "aliyun --version" | Select-String "Alibaba Cloud Command Line Interface Version " | Take-Part -Part 6
|
||||
return "Aliyun CLI $aliyunVersion"
|
||||
return $aliyunVersion
|
||||
}
|
||||
|
||||
function Get-GHCupVersion {
|
||||
$ghcUpVersion = (Run-Command "ghcup --version" | Take-Part -Part 5).Replace('v','')
|
||||
return "GHCup $ghcUpVersion"
|
||||
return $ghcUpVersion
|
||||
}
|
||||
|
||||
function Get-GHCVersion {
|
||||
$ghcVersion = Run-Command "ghc --version" | Take-Part -Part 7
|
||||
return "GHC $ghcVersion"
|
||||
return $ghcVersion
|
||||
}
|
||||
|
||||
function Get-CabalVersion {
|
||||
$cabalVersion = Run-Command "cabal --version" | Take-Part -Part 3
|
||||
return "Cabal $cabalVersion"
|
||||
return $cabalVersion
|
||||
}
|
||||
|
||||
function Get-SwitchAudioOsxVersion {
|
||||
$switchAudioVersion = Get-BrewPackageVersion -CommandName "SwitchAudioSource"
|
||||
return "Switchaudio-osx $switchAudioVersion"
|
||||
return $switchAudioVersion
|
||||
}
|
||||
|
||||
function Get-SoxVersion {
|
||||
$soxVersion = Get-BrewPackageVersion -CommandName "sox"
|
||||
return "Sox $soxVersion"
|
||||
return $soxVersion
|
||||
}
|
||||
|
||||
function Get-StackVersion {
|
||||
$stackVersion = Run-Command "stack --version" | Take-Part -Part 1 | ForEach-Object {$_.replace(",","")}
|
||||
return "Stack $stackVersion"
|
||||
return $stackVersion
|
||||
}
|
||||
|
||||
function Get-SwiftFormatVersion {
|
||||
$swiftFormatVersion = Run-Command "swiftformat --version"
|
||||
return "SwiftFormat $swiftFormatVersion"
|
||||
return $swiftFormatVersion
|
||||
}
|
||||
|
||||
function Get-YamllintVersion {
|
||||
$yamllintVersion = Run-Command "yamllint --version"
|
||||
return $yamllintVersion
|
||||
return ($yamllintVersion -replace "^Yamllint").Trim()
|
||||
}
|
||||
|
||||
function Get-SwiftLintVersion {
|
||||
$swiftlintVersion = Run-Command "swiftlint version"
|
||||
return "SwiftLint $swiftlintVersion"
|
||||
return $swiftlintVersion
|
||||
}
|
||||
|
||||
function Get-PowershellVersion {
|
||||
$powershellVersion = Run-Command "powershell --version"
|
||||
return $powershellVersion
|
||||
return ($powershellVersion -replace "^PowerShell").Trim()
|
||||
}
|
||||
|
||||
function Get-SwigVersion {
|
||||
$swigVersion = Run-Command "swig -version" | Select-Object -First 2 | Take-Part -Part 2
|
||||
return "Swig $swigVersion"
|
||||
return $swigVersion
|
||||
}
|
||||
|
||||
function Get-BicepVersion {
|
||||
$bicepVersion = Run-Command "bicep --version" | Take-Part -Part 3
|
||||
return "Bicep CLI $bicepVersion"
|
||||
return $bicepVersion
|
||||
}
|
||||
|
||||
function Get-KotlinVersion {
|
||||
$kotlinVersion = Run-Command "kotlin -version" | Take-Part -Part 2
|
||||
return "Kotlin $kotlinVersion"
|
||||
return $kotlinVersion
|
||||
}
|
||||
|
||||
function Get-SbtVersion {
|
||||
$sbtVersion = Run-Command "sbt -version" | Take-Part -Part 3
|
||||
return "Sbt $sbtVersion"
|
||||
return $sbtVersion
|
||||
}
|
||||
|
||||
function Get-JazzyVersion {
|
||||
$jazzyVersion = Run-Command "jazzy --version" | Take-Part -Part 2
|
||||
return "Jazzy $jazzyVersion"
|
||||
return $jazzyVersion
|
||||
}
|
||||
|
||||
function Get-ZlibVersion {
|
||||
$zlibVersion = brew info --json zlib | jq -r '.[].installed[].version'
|
||||
return "Zlib $zlibVersion"
|
||||
return $zlibVersion
|
||||
}
|
||||
|
||||
function Get-LibXftVersion {
|
||||
$libXftVersion = brew info --json libxft | jq -r '.[].installed[].version'
|
||||
return "libXft $libXftVersion"
|
||||
return $libXftVersion
|
||||
}
|
||||
|
||||
function Get-LibXextVersion {
|
||||
$libXextVersion = brew info --json libxext | jq -r '.[].installed[].version'
|
||||
return "libXext $libXextVersion"
|
||||
return $libXextVersion
|
||||
}
|
||||
|
||||
function Get-TclTkVersion {
|
||||
$tcltkVersion = brew info --json tcl-tk | jq -r '.[].installed[].version'
|
||||
return "Tcl/Tk $tcltkVersion"
|
||||
return $tcltkVersion
|
||||
}
|
||||
|
||||
function Get-YqVersion {
|
||||
$yqVersion = Run-Command "yq --version"
|
||||
return "$yqVersion"
|
||||
$yqVersion -match "\d{1,2}\.\d{1,2}\.\d{1,2}" | Out-Null
|
||||
return ($Matches[0])
|
||||
}
|
||||
|
||||
function Get-ImageMagickVersion {
|
||||
$imagemagickVersion = Run-Command "magick --version" | Select-Object -First 1 | Take-Part -Part 1,2
|
||||
return "$imagemagickVersion"
|
||||
return ($imagemagickVersion -replace "^ImageMagick").Trim()
|
||||
}
|
||||
|
||||
function Build-PackageManagementEnvironmentTable {
|
||||
return @(
|
||||
$node = [HeaderNode]::new("Environment variables")
|
||||
|
||||
$table = @(
|
||||
@{
|
||||
"Name" = "CONDA"
|
||||
"Value" = $env:CONDA
|
||||
@@ -569,6 +588,10 @@ function Build-PackageManagementEnvironmentTable {
|
||||
"Value" = $_.Value
|
||||
}
|
||||
}
|
||||
|
||||
$node.AddTableNode($table)
|
||||
|
||||
return $node
|
||||
}
|
||||
|
||||
function Build-MiscellaneousEnvironmentTable {
|
||||
@@ -605,10 +628,10 @@ function Get-CodeQLBundleVersion {
|
||||
$CodeQLVersionPath = Get-ChildItem $CodeQLVersionWildcard | Select-Object -First 1 -Expand FullName
|
||||
$CodeQLPath = Join-Path $CodeQLVersionPath -ChildPath "x64" | Join-Path -ChildPath "codeql" | Join-Path -ChildPath "codeql"
|
||||
$CodeQLVersion = & $CodeQLPath version --quiet
|
||||
return "CodeQL Action Bundle $CodeQLVersion"
|
||||
return $CodeQLVersion
|
||||
}
|
||||
|
||||
function Get-ColimaVersion {
|
||||
$colimaVersion = Run-Command "colima version" | Select-String "colima version" | Take-Part -Part 2
|
||||
return "Colima $colimaVersion"
|
||||
return $colimaVersion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user