public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Guo, Gua" <gua.guo@intel.com>
To: devel@edk2.groups.io
Cc: Gua Guo <gua.guo@intel.com>,
	Sean Brogan <sean.brogan@microsoft.com>,
	Michael Kubacki <mikuback@linux.microsoft.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>
Subject: [PATCH] .azurepipelines: Skip CodeCoverage if coverage.xml not found
Date: Fri,  6 Jan 2023 08:44:24 +0800	[thread overview]
Message-ID: <4f8e95f65b608131ac7645cc3824624e913954fd.1672965793.git.gua.guo@intel.com> (raw)

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


             reply	other threads:[~2023-01-06  0:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06  0:44 Guo, Gua [this message]
2023-01-06  1:04 ` [edk2-devel] [PATCH] .azurepipelines: Skip CodeCoverage if coverage.xml not found Sean
2023-01-06  1:16 ` Michael D Kinney
2023-01-06  1:40 ` [edk2-devel] " Michael Kubacki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4f8e95f65b608131ac7645cc3824624e913954fd.1672965793.git.gua.guo@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox