2020-08-14 01:09:50 +02:00
parameters :
jobName : ""
displayName : ""
imageName : ""
jobs :
- job : ${{ parameters.jobName }}
displayName : ${{ parameters.displayName }}
pool :
vmImage : ${{ parameters.imageName }}
steps :
2020-10-23 20:42:24 +02:00
- checkout : self
clean : true
2020-11-11 21:04:54 +01:00
- task : DownloadPipelineArtifact@2
inputs :
source : specific
project : PowerShellCore
pipeline : '696'
preferTriggeringPipeline : true
runVersion : latestFromBranch
runBranch : '$(Build.SourceBranch)'
artifact : finalResults
patterns : '**/*.nupkg'
path : '$(Pipeline.Workspace)/releasePipeline/finalResults'
- task : DownloadPipelineArtifact@2
inputs :
source : specific
project : PowerShellCore
pipeline : '696'
preferTriggeringPipeline : true
runVersion : latestFromBranch
runBranch : '$(Build.SourceBranch)'
artifact : metadata
path : '$(Pipeline.Workspace)/releasePipeline/metadata'
2020-08-14 01:09:50 +02:00
- pwsh : |
$dotnetMetadataPath = "$(Build.SourcesDirectory)/DotnetRuntimeMetadata.json"
$dotnetMetadataJson = Get-Content $dotnetMetadataPath -Raw | ConvertFrom-Json
# Channel is like: $Channel = "5.0.1xx-preview2"
$Channel = $dotnetMetadataJson.sdk.channel
$sdkVersion = (Get-Content "$(Build.SourcesDirectory)/global.json" -Raw | ConvertFrom-Json).sdk.version
Import-Module "$(Build.SourcesDirectory)/build.psm1" -Force
Find-Dotnet
2021-02-11 00:38:28 +01:00
if(-not (Get-PackageSource -Name 'dotnet' -ErrorAction SilentlyContinue))
2020-08-14 01:09:50 +02:00
{
2021-02-11 00:38:28 +01:00
$nugetFeed = ([xml](Get-Content $(Build.SourcesDirectory)/nuget.config -Raw)).Configuration.packagesources.add | Where-Object { $_.Key -eq 'dotnet' } | Select-Object -ExpandProperty Value
Register-PackageSource -Name 'dotnet' -Location $nugetFeed -ProviderName NuGet
Write-Verbose -Message "Register new package source 'dotnet'" -verbose
2020-08-14 01:09:50 +02:00
}
2021-01-19 13:43:01 +01:00
## Install latest version from the channel
2020-11-06 01:34:51 +01:00
#Install-Dotnet -Channel "$Channel" -Version $sdkVersion
2021-01-19 13:43:01 +01:00
2020-11-06 01:34:51 +01:00
Start-PSBootstrap
2020-08-14 01:09:50 +02:00
Write-Verbose -Message "Installing .NET SDK completed." -Verbose
displayName : Install .NET
- pwsh : |
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
Import-Module "$(Build.SourcesDirectory)/build.psm1" -Force
Start-PSBootstrap -Force
$localLocation = "$(Pipeline.Workspace)/releasePipeline/finalResults"
$xmlElement = @"
<add key=`"local`" value=`"$localLocation`" />
2021-02-11 00:38:28 +01:00
<add key="dotnet" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v2" />
2020-08-14 01:09:50 +02:00
</packageSources>
"@
$releaseVersion = Get-Content "$(Pipeline.Workspace)/releasePipeline/metadata/release.json" | ConvertFrom-Json | Select-Object -ExpandProperty 'ReleaseVersion'
Set-Location -Path $(Build.SourcesDirectory)/test/hosting
Get-ChildItem
## register the packages download directory in the nuget file
$nugetConfigContent = Get-Content ./NuGet.Config -Raw
$updateNugetContent = $nugetConfigContent.Replace("</packageSources>", $xmlElement)
$updateNugetContent | Out-File ./NuGet.Config -Encoding ascii
Get-Content ./NuGet.Config
dotnet --info
dotnet restore
dotnet test /property:RELEASE_VERSION=$releaseVersion --test-adapter-path:. "--logger:xunit;LogFilePath=$(System.DefaultWorkingDirectory)/test-hosting.xml"
displayName : Restore and execute tests
- task : PublishTestResults@2
displayName : 'Publish Test Results **\test-hosting.xml'
inputs :
testResultsFormat : XUnit
testResultsFiles : '**\test-hosting.xml'