X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=.azurepipelines%2Ftemplates%2Fpr-gate-build-job.yml;fp=.azurepipelines%2Ftemplates%2Fpr-gate-build-job.yml;h=fff61a3193b0e082e3209ca1d3adf0e27600e924;hb=8c2357809e2c352c8ba7c35ab50f49deefd3d39e;hp=840852b606746ad894cc7edb73303868efd33dcb;hpb=c32e7331513bfdb625986e4570c304dced4ea109;p=mirror_edk2.git diff --git a/.azurepipelines/templates/pr-gate-build-job.yml b/.azurepipelines/templates/pr-gate-build-job.yml index 840852b606..fff61a3193 100644 --- a/.azurepipelines/templates/pr-gate-build-job.yml +++ b/.azurepipelines/templates/pr-gate-build-job.yml @@ -100,16 +100,24 @@ jobs: buildType: 'current' targetPath: '$(Build.ArtifactStagingDirectory)' + - powershell: Write-Host "##vso[task.setvariable variable=is_code_coverage]0" + displayName: Give default value for whether CodeCoverage or not + + - powershell: if (Test-Path -Path $(Build.ArtifactStagingDirectory)/**/coverage.xml) {Write-Host "##vso[task.setvariable variable=is_code_coverage]1"} + displayName: Check coverage.xml exist or not + - task: CmdLine@2 displayName: Create code coverage report inputs: script: | dotnet tool install -g dotnet-reportgenerator-globaltool reportgenerator -reports:$(Build.ArtifactStagingDirectory)/**/coverage.xml -targetdir:$(Build.ArtifactStagingDirectory)/Coverage -reporttypes:Cobertura -filefilters:-*Build*;-*UnitTest*;-*Mock*;-*usr* + condition: eq(variables.is_code_coverage, 1) - task: PublishCodeCoverageResults@1 displayName: 'Publish code coverage' inputs: codeCoverageTool: Cobertura summaryFileLocation: '$(Build.ArtifactStagingDirectory)/Coverage/Cobertura.xml' + condition: eq(variables.is_code_coverage, 1)