From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.3667.1672969250936177488 for ; Thu, 05 Jan 2023 17:40:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=n0MOPpgA; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from [192.168.4.22] (unknown [47.201.8.94]) by linux.microsoft.com (Postfix) with ESMTPSA id BA37820B8762; Thu, 5 Jan 2023 17:40:49 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com BA37820B8762 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1672969250; bh=z/ZmIuLpFJxPF4fO26DnCqNRsNiFKB/u7e8O0B4MtlM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=n0MOPpgAel33RDMeNBRjfeyoRHhVYVQC7jOmhOudFTrD8f87JA2YwgQzRlDjiCAcP pApTCpvCEldEiqEM24/oX46TNMuB2RsEi2eeMVA8zIok4UswQsJ2fe5MFXYxL4wXhX xVhIom/Z+xLf6pUq8hsf6LV2qG4Z8FcQmB5JUuW4= Message-ID: <42e79b2d-e5ee-3092-cf0b-165a198eb9e0@linux.microsoft.com> Date: Thu, 5 Jan 2023 20:40:48 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [edk2-devel] [PATCH] .azurepipelines: Skip CodeCoverage if coverage.xml not found To: devel@edk2.groups.io, gua.guo@intel.com Cc: Sean Brogan , Michael D Kinney , Liming Gao References: <4f8e95f65b608131ac7645cc3824624e913954fd.1672965793.git.gua.guo@intel.com> From: "Michael Kubacki" In-Reply-To: <4f8e95f65b608131ac7645cc3824624e913954fd.1672965793.git.gua.guo@intel.com> Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reviewed-by: Michael Kubacki On 1/5/2023 7:44 PM, Guo, Gua wrote: > From: Gua Guo > > Skip CodeCoverage if coverage.xml not found > > Cc: Sean Brogan > Cc: Michael Kubacki > Cc: Michael D Kinney > Cc: Liming Gao > Signed-off-by: Gua Guo > --- > .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) > > >