summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGua Guo <gua.guo@intel.com>2023-01-05 09:50:20 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-01-06 04:41:43 +0000
commit8c2357809e2c352c8ba7c35ab50f49deefd3d39e (patch)
treea9acacb348d7efa3d287c2f857e7da2f21729957
parentc32e7331513bfdb625986e4570c304dced4ea109 (diff)
downloadedk2-8c2357809e2c352c8ba7c35ab50f49deefd3d39e.tar.gz
edk2-8c2357809e2c352c8ba7c35ab50f49deefd3d39e.tar.bz2
edk2-8c2357809e2c352c8ba7c35ab50f49deefd3d39e.zip
.azurepipelines: Skip CodeCoverage if coverage.xml not found
Skip CodeCoverage if coverage.xml not found Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Gua Guo <gua.guo@intel.com> Reviewed-by: Sean Brogan <sean.brogan@microsoft.com> Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
-rw-r--r--.azurepipelines/templates/pr-gate-build-job.yml8
1 files changed, 8 insertions, 0 deletions
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)