Merge remote-tracking branch 'upstream/main' into main

This commit is contained in:
Aleksandr Chebotov
2020-09-28 13:52:54 +03:00
39 changed files with 1246 additions and 1444 deletions

View File

@@ -0,0 +1,10 @@
################################################################################
## File: Install-AzureDevSpacesCLI.ps1
## Desc: Install Azure Dev Spaces CLI
################################################################################
# Install Azure Dev Spaces CLI
Install-Binary -Url "https://aka.ms/get-azds-windows" -Name "Azure Dev Spaces CLI.exe" -ArgumentList ("/quiet")
Add-MachinePathItem -PathItem "C:\Program Files\Microsoft SDKs\Azure\Azure Dev Spaces CLI"
Invoke-PesterTests -TestFile "CLI.Tools" -TestName "Azure Dev Spaces CLI"

View File

@@ -0,0 +1,28 @@
################################################################################
## File: Install-CodeQLBundle.ps1
## Desc: Install the CodeQL CLI Bundle to the toolcache.
################################################################################
# Retrieve the name of the CodeQL bundle preferred by the Action (in the format codeql-bundle-YYYYMMDD).
$CodeQLBundleName = (Invoke-RestMethod "https://raw.githubusercontent.com/github/codeql-action/main/src/defaults.json").bundleVersion
# Convert the bundle name to a version number (0.0.0-YYYYMMDD).
$CodeQLBundleVersion = "0.0.0-" + $CodeQLBundleName.split("-")[-1]
$ExtractionDirectory = Join-Path $Env:AGENT_TOOLSDIRECTORY -ChildPath "CodeQL" | Join-Path -ChildPath $CodeQLBundleVersion | Join-Path -ChildPath "x64"
New-Item -Path $ExtractionDirectory -ItemType Directory -Force | Out-Null
Write-Host "Downloading CodeQL bundle $CodeQLBundleVersion..."
$CodeQLBundlePath = Start-DownloadWithRetry -Url "https://github.com/github/codeql-action/releases/download/$CodeQLBundleName/codeql-bundle.tar.gz" -Name "codeql-bundle.tar.gz"
$DownloadDirectoryPath = (Get-Item $CodeQLBundlePath).Directory.FullName
Extract-7Zip -Path $CodeQLBundlePath -DestinationPath $DownloadDirectoryPath
$UnGzipedCodeQLBundlePath = Join-Path $DownloadDirectoryPath "codeql-bundle.tar"
Extract-7Zip -Path $UnGzipedCodeQLBundlePath -DestinationPath $ExtractionDirectory
# Touch a special file that indicates to the CodeQL Action that this bundle was baked-in to the hosted runner images.
New-Item -ItemType file (Join-Path $ExtractionDirectory -ChildPath "pinned-version")
# Touch a file to indicate to the toolcache that setting up CodeQL is complete.
New-Item -ItemType file "$ExtractionDirectory.complete"
# Test that the tool has been extracted successfully.
Invoke-PesterTests -TestFile "Tools" -TestName "CodeQLBundle"

View File

@@ -71,6 +71,7 @@ $ndkRoot = "C:\Program Files (x86)\Android\android-sdk\ndk-bundle"
if (Test-Path $ndkRoot) {
setx ANDROID_HOME $sdkRoot /M
setx ANDROID_SDK_ROOT $sdkRoot /M
setx ANDROID_NDK_HOME $ndkRoot /M
setx ANDROID_NDK_PATH $ndkRoot /M
} else {

View File

@@ -1,3 +1,5 @@
$ErrorActionPreference = "Stop"
Import-Module MarkdownPS
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Android.psm1") -DisableNameChecking
Import-Module (Join-Path $PSScriptRoot "SoftwareReport.Browsers.psm1") -DisableNameChecking
@@ -77,6 +79,7 @@ $markdown += New-MDList -Style Unordered -Lines @(
(Get-BazelVersion),
(Get-BazeliskVersion),
(Get-CMakeVersion),
(Get-CodeQLBundleVersion),
(Get-RVersion),
(Get-DockerVersion),
(Get-DockerComposeVersion),
@@ -112,6 +115,7 @@ $markdown += New-MDHeader "CLI Tools" -Level 3
$markdown += New-MDList -Style Unordered -Lines @(
(Get-AzureCLIVersion),
(Get-AzureDevopsExtVersion),
(Get-AZDSVersion),
(Get-AWSCLIVersion),
(Get-AWSSAMVersion),
(Get-AWSSessionManagerVersion),

View File

@@ -30,6 +30,14 @@ function Get-CMakeVersion {
return "CMake $cmakeVersion"
}
function Get-CodeQLBundleVersion {
$CodeQLVersionsWildcard = Join-Path $Env:AGENT_TOOLSDIRECTORY -ChildPath "codeql" | Join-Path -ChildPath "*"
$CodeQLVersionPath = Get-ChildItem $CodeQLVersionsWildcard | Select-Object -First 1 -Expand FullName
$CodeQLPath = Join-Path $CodeQLVersionPath -ChildPath "x64" | Join-Path -ChildPath "codeql" | Join-Path -ChildPath "codeql.exe"
$CodeQLVersion = & $CodeQLPath version --quiet
return "CodeQL Action Bundle $CodeQLVersion"
}
function Get-DockerVersion {
$dockerVersion = $(docker version --format "{{.Server.Version}}")
return "Docker $dockerVersion"
@@ -246,4 +254,9 @@ function Get-VisualCPPComponents {
}
}
}
}
}
function Get-AZDSVersion {
$azdsVersion = $(azds --version) | Select-String "(\d+\.\d+\.\d+.\d+)"
return "Azure Dev Spaces CLI $azdsVersion"
}

View File

@@ -53,4 +53,10 @@ Describe "Hub CLI" {
It "hub is installed" {
"hub --version" | Should -ReturnZeroExitCode
}
}
Describe "Azure Dev Spaces CLI" {
It "Azure Dev Spaces CLI" {
"azds --version" | Should -ReturnZeroExitCode
}
}

View File

@@ -41,6 +41,15 @@ Describe "CMake" {
}
}
Describe "CodeQLBundle" {
It "CodeQLBundle" {
$CodeQLVersionsWildcard = Join-Path $Env:AGENT_TOOLSDIRECTORY -ChildPath "codeql" | Join-Path -ChildPath "*"
$CodeQLVersionPath = Get-ChildItem $CodeQLVersionsWildcard | Select-Object -First 1 -Expand FullName
$CodeQLPath = Join-Path $CodeQLVersionPath -ChildPath "x64" | Join-Path -ChildPath "codeql" | Join-Path -ChildPath "codeql.exe"
"$CodeQLPath version" | Should -ReturnZeroExitCode
}
}
Describe "R" {
It "Rscript" {
"Rscript --version" | Should -ReturnZeroExitCode