зеркало из https://github.com/dotnet/pinvoke.git
Acquire procdump via nuget
Just using nuget instead of choco makes it take less than 1 second instead of nearly a minute. It also removes the requirement for chocolatey to be installed on AzP agents, which helps compatibility with custom/private agents. Also move it to init.ps1 so it doesn't require a special AzP or GitHub Actions task and it canl run on local dev boxes.
This commit is contained in:
Родитель
f45370dbf3
Коммит
e9dcc410b3
|
@ -35,10 +35,6 @@ jobs:
|
|||
run: |
|
||||
./init.ps1 -UpgradePrerequisites
|
||||
dotnet --info
|
||||
if ($env:RUNNER_OS -eq "Windows") {
|
||||
choco install procdump -y
|
||||
Write-Host "##[set-env name=PROCDUMP_PATH;]$env:PROGRAMDATA\chocolatey\bin\"
|
||||
}
|
||||
shell: pwsh
|
||||
- name: Set pipeline variables based on source
|
||||
run: azure-pipelines/variables/_pipelines.ps1
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Downloads 32-bit and 64-bit procdump executables and returns the path to where they were installed.
|
||||
#>
|
||||
$version = '0.0.1'
|
||||
$baseDir = "$PSScriptRoot\..\obj\tools"
|
||||
$procDumpToolPath = "$baseDir\procdump.$version\bin"
|
||||
if (-not (Test-Path $procDumpToolPath)) {
|
||||
if (-not (Test-Path $baseDir)) { New-Item -Type Directory -Path $baseDir | Out-Null }
|
||||
$baseDir = (Resolve-Path $baseDir).Path # Normalize it
|
||||
& (& $PSScriptRoot\Get-NuGetTool.ps1) install procdump -version $version -PackageSaveMode nuspec -OutputDirectory $baseDir -Source https://api.nuget.org/v3/index.json | Out-Null
|
||||
}
|
||||
|
||||
(Resolve-Path $procDumpToolPath).Path
|
|
@ -8,13 +8,6 @@ steps:
|
|||
dotnet --info
|
||||
displayName: Install prerequisites
|
||||
|
||||
# The procdump tool and env var is required for dotnet test to collect hang/crash dumps of tests.
|
||||
- powershell: |
|
||||
choco install procdump -y
|
||||
Write-Host "##vso[task.setvariable variable=PROCDUMP_PATH;]$env:ProgramData\chocolatey\bin\"
|
||||
displayName: Install procdump
|
||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
||||
|
||||
- powershell: azure-pipelines/variables/_pipelines.ps1
|
||||
failOnStderr: true
|
||||
displayName: Set pipeline variables based on source
|
||||
|
|
10
init.ps1
10
init.ps1
|
@ -39,9 +39,17 @@ Param (
|
|||
[string]$AccessToken
|
||||
)
|
||||
|
||||
$EnvVars = @{}
|
||||
|
||||
if (!$NoPrerequisites) {
|
||||
& "$PSScriptRoot\tools\Install-NuGetCredProvider.ps1" -AccessToken $AccessToken -Force:$UpgradePrerequisites
|
||||
& "$PSScriptRoot\tools\Install-DotNetSdk.ps1" -InstallLocality $InstallLocality
|
||||
|
||||
# The procdump tool and env var is required for dotnet test to collect hang/crash dumps of tests.
|
||||
# But it only works on Windows.
|
||||
if ($env:OS -eq 'Windows_NT') {
|
||||
$EnvVars['PROCDUMP_PATH'] = & "$PSScriptRoot\azure-pipelines\Get-ProcDump.ps1"
|
||||
}
|
||||
}
|
||||
|
||||
# Workaround nuget credential provider bug that causes very unreliable package restores on Azure Pipelines
|
||||
|
@ -59,6 +67,8 @@ try {
|
|||
throw "Failure while restoring packages."
|
||||
}
|
||||
}
|
||||
|
||||
& "$PSScriptRoot\azure-pipelines\Set-EnvVars.ps1" -Variables $EnvVars | Out-Null
|
||||
}
|
||||
catch {
|
||||
Write-Error $error[0]
|
||||
|
|
Загрузка…
Ссылка в новой задаче