RunHelix.ps1 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <#
  2. .SYNOPSIS
  3. Runs the specified test project on a Helix machine.
  4. .DESCRIPTION
  5. This script runs the Helix msbuild task on the given project and publishes then uploads the output and runs tests on the Helix machine(s) passed in.
  6. .PARAMETER Project
  7. The test project to publish and send to Helix.
  8. .PARAMETER HelixQueues
  9. Set the Helix queues to use. The list is '+' or ';'-separated.
  10. Some supported queues:
  11. Debian.11.Amd64.Open
  12. Mariner
  13. AlmaLinux.8.Amd64.Open
  14. Ubuntu.2004.Amd64.Open
  15. OSX.1100.Amd64.Open
  16. Windows.10.Amd64.Server20H2.Open
  17. Windows.11.Amd64.Client.Open
  18. Windows.Amd64.Server2022.Open
  19. .PARAMETER RunQuarantinedTests
  20. By default quarantined tests are not run. Set this to $true to run only the quarantined tests.
  21. .PARAMETER TargetArchitecture
  22. The CPU architecture to build for (x64, x86, arm). Default=x64
  23. .PARAMETER MSBuildArguments
  24. Additional MSBuild arguments to be passed through.
  25. #>
  26. [CmdletBinding(PositionalBinding = $false)]
  27. param(
  28. [Parameter(Mandatory=$true)]
  29. [string]$Project,
  30. [string]$HelixQueues = "Windows.10.Amd64.Server20H2.Open",
  31. [switch]$RunQuarantinedTests,
  32. [ValidateSet('x64', 'x86', 'arm', 'arm64')]
  33. [string]$TargetArchitecture = "x64",
  34. # Capture the rest
  35. [Parameter(ValueFromRemainingArguments = $true)]
  36. [string[]]$MSBuildArguments
  37. )
  38. $ErrorActionPreference = 'Stop'
  39. $ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
  40. $NUGET_PACKAGES = $env:NUGET_PACKAGES
  41. if ($NUGET_PACKAGES -eq $null) {
  42. $NUGET_PACKAGES = "$env:HOMEPATH/.nuget/packages/"
  43. }
  44. Set-StrictMode -Version 1
  45. $env:BUILD_REASON="PullRequest"
  46. $env:BUILD_SOURCEBRANCH="local"
  47. $env:BUILD_REPOSITORY_NAME="aspnetcore"
  48. $env:SYSTEM_TEAMPROJECT="aspnetcore"
  49. Write-Host -ForegroundColor Yellow "If running tests that need the shared Fx, run './build -pack -all' before this."
  50. Write-Host -ForegroundColor Yellow "If everything is up-to-date, add '/p:NoBuild=true' to this command."
  51. Write-Host -ForegroundColor Yellow "Or, if only the test project is out-of-date, add '/p:BuildProjectReferences=false'."
  52. $HelixQueues = $HelixQueues -replace ";", "%3B"
  53. dotnet msbuild $Project /t:Helix /p:TargetArchitecture="$TargetArchitecture" `
  54. /p:HelixTargetQueues=$HelixQueues /p:RunQuarantinedTests=$RunQuarantinedTests `
  55. /p:_UseHelixOpenQueues=true /p:CrossgenOutput=false /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log `
  56. /p:DoNotRequireSharedFxHelix=true /p:NUGET_PACKAGES=$NUGET_PACKAGES @MSBuildArguments