Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net - pullrequest #47957

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 38 additions & 17 deletions eng/pipelines/templates/jobs/ci.tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ jobs:
# Add a default so the job doesn't fail when the matrix is empty
container: $[ variables['Container'] ]

variables:
${{ if eq(parameters.ServiceDirectory, 'auto') }}:
ServiceDirectory: '*'
${{ else }}:
ServiceDirectory: ${{ parameters.ServiceDirectory }}

templateContext:
outputs:
- output: pipelineArtifact
Expand All @@ -72,7 +78,7 @@ jobs:
- ${{ if not(contains(variables['Build.DefinitionName'], '-pr - ')) }}:
- template: /eng/common/pipelines/templates/steps/sparse-checkout.yml
parameters:
${{ if eq(parameters.ProjectListOverrideFilePropertyName, '') }}:
${{ if ne(parameters.ServiceDirectory, 'auto') }}:
Paths:
- "/*"
- "!SessionRecords"
Expand All @@ -82,12 +88,11 @@ jobs:
- "/*"
- "!SessionRecords"
- "/sdk/*/**/SessionRecords/*"
- ${{ if ne(parameters.ProjectListOverrideFilePropertyName, '') }}:
- ${{ if and(eq(variables['Build.Reason'], 'PullRequest'), eq(parameters.ServiceDirectory, 'auto')) }}:
- task: DownloadPipelineArtifact@2
inputs:
artifact: DependencyTestProjectReferences
patterns: "**/$(${{ parameters.ProjectListOverrideFilePropertyName }})"
path: $(Build.SourcesDirectory)
artifact: TestPackagesArtifact
path: $(Build.SourcesDirectory)/PackageInfo
- pwsh: |
$(Build.SourcesDirectory)/eng/common/scripts/trust-proxy-certificate.ps1
displayName: 'Language Specific Certificate Trust'
Expand All @@ -98,43 +103,59 @@ jobs:
- template: /eng/common/pipelines/templates/steps/verify-agent-os.yml
parameters:
AgentImage: ${{ parameters.OSName }}

- ${{ each step in parameters.TestSetupSteps }}:
- ${{ each pair in step }}:
${{ pair.key }}: ${{ pair.value }}

- pwsh: |
Get-ChildItem -Path $(Build.SourcesDirectory) | ForEach-Object { Write-Host $_.FullName }
displayName: Dump Visible Files

- ${{ if and(eq(variables['Build.Reason'], 'PullRequest'), eq(parameters.ServiceDirectory, 'auto')) }}:
# this template will set ProjectListOverrideFile variable, otherwise the build and test command will apply
# to the targeted service directory only
- template: /eng/pipelines/templates/steps/set-artifact-packages.yml
parameters:
PackageInfo: '$(Build.SourcesDirectory)/PackageInfo'

- pwsh: |
if ("$(ProjectNames)" -like "*storage*") {
&"$(Build.SourcesDirectory)/eng/scripts/install_azurite.ps1" -AzuriteLocation "$(AzuriteLocation)" -AzuriteVersion "$(AzuriteVersion)"
}
displayName: Install Azurite If Necessary
condition: ne(variables['ProjectNames'], '')

- template: /eng/pipelines/templates/steps/install-dotnet.yml
parameters:
NuGetCacheKey: Test

- pwsh: |
if ("${{ parameters.ProjectListOverrideFilePropertyName }}" -ne '') {
Write-Host "##vso[task.setvariable variable=ProjectListOverrideFileName]$(${{ parameters.ProjectListOverrideFilePropertyName }})"
Write-Host "##vso[task.setvariable variable=CodeCoverageFilePattern]$(Build.SourcesDirectory)\sdk\**\coverage.cobertura.xml"
}
else
{
Write-Host "##vso[task.setvariable variable=ProjectListOverrideFileName]"
Write-Host "##vso[task.setvariable variable=CodeCoverageFilePattern]$(Build.SourcesDirectory)\sdk\${{parameters.ServiceDirectory}}\**\coverage.cobertura.xml"
}
Write-Host "##vso[task.setvariable variable=CodeCoverageFilePattern]$(Build.SourcesDirectory)\sdk\$(ServiceDirectory)\**\coverage.cobertura.xml"
scbedd marked this conversation as resolved.
Show resolved Hide resolved
displayName: Set variable for the project list file and coverage directory

- template: /eng/pipelines/templates/steps/dotnet-diagnostics.yml
parameters:
LogFilePath: $(Build.ArtifactStagingDirectory)/test.binlog

- script: >-
dotnet test eng/service.proj
--filter "(TestCategory!=Manually) & (TestCategory!=Live) & ($(AdditionalTestFilters))"
--framework $(TestTargetFramework)
--logger "trx;LogFileName=$(TestTargetFramework).trx" --logger:"console;verbosity=normal"
--blame-crash-dump-type full --blame-hang-dump-type full --blame-hang-timeout ${{parameters.TestTimeoutInMinutes}}minutes
/p:SDKType=${{ parameters.SDKType }}
/p:ServiceDirectory=${{ parameters.ServiceDirectory }}
/p:ServiceDirectory=$(ServiceDirectory)
/p:IncludeSrc=false /p:IncludeSamples=false /p:IncludePerf=false /p:IncludeStress=false
/p:RunApiCompat=false /p:InheritDocEnabled=false
/p:Configuration=$(BuildConfiguration)
/p:CollectCoverage=$(CollectCoverage)
/p:EnableSourceLink=false
/p:ProjectListOverrideFile=$(ProjectListOverrideFileName)
/p:ProjectListOverrideFile=$(ProjectListOverrideFile)
$(AdditionalTestArguments)
$(DiagnosticArguments)
displayName: "Build & Test ($(TestTargetFramework))"

- task: PublishTestResults@2
condition: always()
displayName: "Publish Results ($(TestTargetFramework))"
Expand All @@ -151,7 +172,7 @@ jobs:
reports: $(CodeCoverageFilePattern)
targetdir: $(Build.ArtifactStagingDirectory)\coverage
reporttypes: Cobertura
filefilters: +$(Build.SourcesDirectory)\sdk\${{parameters.ServiceDirectory}}\**
filefilters: +$(Build.SourcesDirectory)\sdk\$(ServiceDirectory)\**
scbedd marked this conversation as resolved.
Show resolved Hide resolved
verbosity: Verbose
- task: PublishCodeCoverageResults@2
condition: and(succeededOrFailed(), eq(variables['CollectCoverage'], 'true'), eq(variables['coverage.collected'], 'true'))
Expand Down
Loading
Loading