[edk2-devel] [PATCH] .azurepipelines: Skip CodeCoverage if coverage.xml not found

Guo, Gua posted 1 patch 1 year, 3 months ago
Failed in applying to current master (apply log)
.azurepipelines/templates/pr-gate-build-job.yml | 8 ++++++++
1 file changed, 8 insertions(+)
[edk2-devel] [PATCH] .azurepipelines: Skip CodeCoverage if coverage.xml not found
Posted by Guo, Gua 1 year, 3 months ago
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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98041): https://edk2.groups.io/g/devel/message/98041
Mute This Topic: https://groups.io/mt/96085111/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] .azurepipelines: Skip CodeCoverage if coverage.xml not found
Posted by Michael Kubacki 1 year, 3 months ago
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>

On 1/5/2023 7:44 PM, Guo, Gua wrote:
> 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)
> 
>   
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98046): https://edk2.groups.io/g/devel/message/98046
Mute This Topic: https://groups.io/mt/96085111/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] .azurepipelines: Skip CodeCoverage if coverage.xml not found
Posted by Michael D Kinney 1 year, 3 months ago
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>


> -----Original Message-----
> From: Guo, Gua <gua.guo@intel.com>
> Sent: Thursday, January 5, 2023 4:44 PM
> To: devel@edk2.groups.io
> Cc: Guo, Gua <gua.guo@intel.com>; Sean Brogan <sean.brogan@microsoft.com>; Michael Kubacki <mikuback@linux.microsoft.com>; Kinney,
> Michael D <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>
> Subject: [PATCH] .azurepipelines: Skip CodeCoverage if coverage.xml not found
> 
> 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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98045): https://edk2.groups.io/g/devel/message/98045
Mute This Topic: https://groups.io/mt/96085111/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] .azurepipelines: Skip CodeCoverage if coverage.xml not found
Posted by Sean 1 year, 3 months ago
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>


On 1/5/2023 4:44 PM, Guo, Gua wrote:
> 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)
>
>   
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98044): https://edk2.groups.io/g/devel/message/98044
Mute This Topic: https://groups.io/mt/96085111/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-