Run E2E tests in parallel and on macOS (#1369)

This commit is contained in:
Nate McMaster 2018-08-31 14:24:32 -07:00 committed by GitHub
parent 3cbf1ea7d1
commit b2cf5028e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 123 additions and 23 deletions

View File

@ -1,19 +1,64 @@
trigger: none trigger: none
queue: phases:
name: DotNetCore-Windows - phase: Host_Windows
timeoutInMinutes: 120 queue:
steps: name: DotNetCore-Windows
- task: NodeTool@0 parallel: 4
displayName: Install Node 10.x matrix:
inputs: Portable:
versionSpec: 10.x Test.RuntimeIdentifier: none
- powershell: | SelfContainedWindows:
test/Cli.FunctionalTests/run-tests.ps1 -ci -ProdConManifestUrl $env:ProdConManifestUrl Test.RuntimeIdentifier: win-x64
condition: ne(variables['PB_SkipTests'], 'true') SelfContainedLinux:
displayName: Run E2E tests Test.RuntimeIdentifier: linux-x64
- task: PublishTestResults@2 SelfContainedMacOs:
displayName: Publish test results Test.RuntimeIdentifier: osx-x64
condition: always() steps:
inputs: - task: NodeTool@0
testRunner: vstest displayName: Install Node 10.x
testResultsFiles: 'artifacts/logs/**/*.trx' inputs:
versionSpec: 10.x
- powershell: |
test/Cli.FunctionalTests/run-tests.ps1 `
-ci `
-ProdConManifestUrl $env:ProdConManifestUrl `
-TestRuntimeIdentifier $(Test.RuntimeIdentifier)
condition: ne(variables['PB_SkipTests'], 'true')
displayName: Run E2E tests
- task: PublishTestResults@2
displayName: Publish test results
condition: always()
inputs:
testRunner: vstest
testResultsFiles: 'artifacts/logs/**/*.trx'
- phase: Host_macOS
queue:
name: Hosted macOS Preview
parallel: 4
matrix:
Portable:
Test.RuntimeIdentifier: none
SelfContainedWindows:
Test.RuntimeIdentifier: win-x64
SelfContainedLinux:
Test.RuntimeIdentifier: linux-x64
SelfContainedMacOs:
Test.RuntimeIdentifier: osx-x64
steps:
- task: NodeTool@0
displayName: Install Node 10.x
inputs:
versionSpec: 10.x
- powershell: |
test/Cli.FunctionalTests/run-tests.ps1 \
-ci \
-ProdConManifestUrl $env:ProdConManifestUrl \
-TestRuntimeIdentifier $(Test.RuntimeIdentifier)
condition: ne(variables['PB_SkipTests'], 'true')
displayName: Run E2E tests
- task: PublishTestResults@2
displayName: Publish test results
condition: always()
inputs:
testRunner: vstest
testResultsFiles: 'artifacts/logs/**/*.trx'

View File

@ -14,6 +14,16 @@ The blob feed for the .NET Core CLI. If not specified, it will determined automa
.PARAMETER RestoreSources .PARAMETER RestoreSources
A list of additional NuGet feeds. If not specified, it will determined automatically if possible. A list of additional NuGet feeds. If not specified, it will determined automatically if possible.
.PARAMETER TestRuntimeIdentifier
Filter the tests by which RID they publish for. If empty (default), tests are run for
* none (portable)
* osx-x64
* linux-x64
* win-x64
.PARAMETER HostRid
The RID of the platform running the tests. (Determined automatically if possible)
.PARAMETER ProdConManifestUrl .PARAMETER ProdConManifestUrl
The prodcon build.xml file The prodcon build.xml file
@ -26,6 +36,9 @@ param(
$AssetRootUrl = $env:PB_AccessRootUrl, $AssetRootUrl = $env:PB_AccessRootUrl,
$AccessTokenSuffix = $env:PB_AccessTokenSuffix, $AccessTokenSuffix = $env:PB_AccessTokenSuffix,
$RestoreSources = $env:PB_RestoreSources, $RestoreSources = $env:PB_RestoreSources,
[ValidateSet('none', 'osx-x64', 'linux-x64', 'win-x64')]
$TestRuntimeIdentifier,
$HostRid,
$ProdConManifestUrl, $ProdConManifestUrl,
$ProcConChannel = 'release/2.2' $ProcConChannel = 'release/2.2'
) )
@ -36,12 +49,40 @@ Set-StrictMode -Version 1
$repoRoot = Resolve-Path "$PSScriptRoot/../../" $repoRoot = Resolve-Path "$PSScriptRoot/../../"
Import-Module "$repoRoot/scripts/common.psm1" -Scope Local -Force Import-Module "$repoRoot/scripts/common.psm1" -Scope Local -Force
if (-not $HostRid) {
if (Test-Path Variable:/IsCoreCLR) {
$HostRid = if ($IsWindows) { 'win-x64' } `
elseif ($IsLinux) { 'linux-x64' } `
elseif ($IsMacOS) { 'osx-x64' }
}
else {
$HostRid = 'win-x64'
}
}
if (-not $HostRid) {
throw 'Could not determine which platform this script is running on. Add -HostRid $rid where $rid = the .NET Core SDK to install'
}
switch ($HostRid) {
'win-x64' {
$dotnetFileName = 'dotnet.exe'
$archiveExt = '.zip'
}
default {
$dotnetFileName = 'dotnet'
$archiveExt = '.tar.gz'
}
}
Push-Location $PSScriptRoot Push-Location $PSScriptRoot
try { try {
New-Item -Type Directory "$PSScriptRoot/obj/" -ErrorAction Ignore | Out-Null New-Item -Type Directory "$PSScriptRoot/obj/" -ErrorAction Ignore | Out-Null
$sdkVersion = '' $sdkVersion = ''
if (-not $ci -or $ProdConManifestUrl) { if (-not $ci -or $ProdConManifestUrl) {
# Workaround for pwsh 6 dumping progress info
$ProgressPreference = 'SilentlyContinue'
if (-not $ProdConManifestUrl) { if (-not $ProdConManifestUrl) {
Write-Host -ForegroundColor Magenta "Running tests for the latest ProdCon build" Write-Host -ForegroundColor Magenta "Running tests for the latest ProdCon build"
@ -76,14 +117,21 @@ try {
@{ sdk = @{ version = $sdkVersion } } | ConvertTo-Json | Set-Content "$PSScriptRoot/global.json" @{ sdk = @{ version = $sdkVersion } } | ConvertTo-Json | Set-Content "$PSScriptRoot/global.json"
$dotnetRoot = "$repoRoot/.dotnet" $dotnetRoot = "$repoRoot/.dotnet"
$dotnet = "$dotnetRoot/dotnet.exe" $dotnet = "$dotnetRoot/$dotnetFileName"
if (-not (Test-Path "$dotnetRoot/sdk/$sdkVersion/dotnet.dll")) { if (-not (Test-Path "$dotnetRoot/sdk/$sdkVersion/dotnet.dll")) {
Remove-Item -Recurse -Force $dotnetRoot -ErrorAction Ignore | Out-Null Remove-Item -Recurse -Force $dotnetRoot -ErrorAction Ignore | Out-Null
$cliUrl = "$AssetRootUrl/Sdk/$sdkVersion/dotnet-sdk-$sdkVersion-win-x64.zip" $cliUrl = "$AssetRootUrl/Sdk/$sdkVersion/dotnet-sdk-$sdkVersion-$HostRid$archiveExt"
$cliArchiveFile = "$PSScriptRoot/obj/dotnet$archiveExt"
Write-Host "Downloading $cliUrl" Write-Host "Downloading $cliUrl"
Invoke-WebRequest -UseBasicParsing "${cliUrl}${AccessTokenSuffix}" -OutFile "$PSScriptRoot/obj/dotnet.zip" Invoke-WebRequest -UseBasicParsing "${cliUrl}${AccessTokenSuffix}" -OutFile $cliArchiveFile
Expand-Archive "$PSScriptRoot/obj/dotnet.zip" -DestinationPath $dotnetRoot if ($archiveExt -eq '.zip') {
Expand-Archive $cliArchiveFile -DestinationPath $dotnetRoot
}
else {
New-Item -Type Directory $dotnetRoot -ErrorAction Ignore | Out-Null
Invoke-Block { & tar xzf $cliArchiveFile -C $dotnetRoot }
}
} }
# Set a clean test environment # Set a clean test environment
@ -96,11 +144,18 @@ try {
# Required by the tests. It is assumed packages on this feed will end up on nuget.org # Required by the tests. It is assumed packages on this feed will end up on nuget.org
$env:NUGET_PACKAGE_SOURCE = $RestoreSources $env:NUGET_PACKAGE_SOURCE = $RestoreSources
[string[]] $filterArgs = @()
if ($TestRuntimeIdentifier) {
$filterArgs += '--filter',"rid: $TestRuntimeIdentifier"
}
Invoke-Block { & $dotnet test ` Invoke-Block { & $dotnet test `
--logger "console;verbosity=detailed" ` --logger "console;verbosity=detailed" `
--logger "trx;LogFileName=$repoRoot/artifacts/logs/e2etests.trx" ` --logger "trx;LogFileName=$repoRoot/artifacts/logs/e2etests.trx" `
"-p:DotNetRestoreSources=$RestoreSources" ` "-p:DotNetRestoreSources=$RestoreSources" `
"-bl:$repoRoot/artifacts/logs/e2etests.binlog" } "-bl:$repoRoot/artifacts/logs/e2etests.binlog" `
@filterArgs }
} }
finally { finally {
Pop-Location Pop-Location