public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] .azurepipelines: Skip CodeCoverage if coverage.xml not found
@ 2023-01-06  0:44 Guo, Gua
  2023-01-06  1:04 ` [edk2-devel] " Sean
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Guo, Gua @ 2023-01-06  0:44 UTC (permalink / raw)
  To: devel; +Cc: Gua Guo, Sean Brogan, Michael Kubacki, Michael D Kinney,
	Liming Gao

From: Gua Guo <gua.guo@intel.com>

Skip CodeCoverage if coverage.xml not found

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Gua Guo <gua.guo@intel.com>
---
 .azurepipelines/templates/pr-gate-build-job.yml | 8 ++++++++
 1 file changed, 8 insertions(+)

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)
 
-- 
2.31.1.windows.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-06  1:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-06  0:44 [PATCH] .azurepipelines: Skip CodeCoverage if coverage.xml not found Guo, Gua
2023-01-06  1:04 ` [edk2-devel] " Sean
2023-01-06  1:16 ` Michael D Kinney
2023-01-06  1:40 ` [edk2-devel] " Michael Kubacki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox