From ac09ee6f448032b0e51469afe7bac3b4df3b118c Mon Sep 17 00:00:00 2001 From: Victor Vazquez Date: Thu, 19 Nov 2020 12:19:57 -0800 Subject: [PATCH] Fix coverage report for template and core pipelines (#1002) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root Cause: Storage project generates coverage files in a different location (sdk/*/*cov_xml.xml) from where Core and Template (sdk/*/*/*cov_xml.xml). Basically one level up. When I added the coverage for Storage, I didn’t know we were also running live tests for Core and Template pipelines. It failed on them because the xml files were not found. In the PR, I add a new parameter to pipelines to change the default path, and also I am disabling LiveTests from Core and Template, since it only runs the same thing that we run on CI pipelines (We can enable it if we ever have some live tests) fix: #1001 --- eng/pipelines/templates/jobs/archetype-sdk-client.yml | 3 ++- eng/pipelines/templates/jobs/archetype-sdk-tests.yml | 5 ++++- eng/pipelines/templates/stages/archetype-sdk-client.yml | 5 +++++ sdk/core/ci.yml | 1 - sdk/storage/ci.yml | 1 + sdk/template/ci.yml | 1 - 6 files changed, 12 insertions(+), 4 deletions(-) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index 011f3efd2..047108796 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -4,6 +4,7 @@ parameters: Coverage: '' CtestRegex: .* BuildReleaseArtifacts: true + CoverageReportPath: 'sdk/*/*/*cov_xml.xml' jobs: - job: Validate @@ -119,7 +120,7 @@ jobs: # coverage report - bash: | make `cat ${{ parameters.ServiceDirectory }}-targets-coverage.txt` - ../tools/reportgenerator "-reports:sdk/*/*/*cov_xml.xml" "-targetdir:." "-reporttypes:Cobertura" + ../tools/reportgenerator "-reports:${{ parameters.CoverageReportPath }}" "-targetdir:." "-reporttypes:Cobertura" workingDirectory: build displayName: Generate Code Coverage Data condition: and(succeededOrFailed(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index e6e46fac3..7e1ecb5bd 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -14,6 +14,9 @@ parameters: - name: Coverage type: string default: 'enabled' +- name: CoverageReportPath + type: string + default: sdk/*/*/*cov_xml.xml jobs: - job: Validate @@ -93,7 +96,7 @@ jobs: # coverage report - bash: | make `cat ${{ parameters.ServiceDirectory }}-targets-coverage.txt` - ../tools/reportgenerator "-reports:sdk/*/*cov_xml.xml" "-targetdir:." "-reporttypes:Cobertura" + ../tools/reportgenerator "-reports:${{ parameters.CoverageReportPath }}" "-targetdir:." "-reporttypes:Cobertura" workingDirectory: build displayName: Generate Code Coverage Data condition: and(succeededOrFailed(), ne(variables['CODE_COVERAGE'], 'disabled'), ne(variables['CODE_COVERAGE'], '')) diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml index 4b5e33ab4..88da34094 100644 --- a/eng/pipelines/templates/stages/archetype-sdk-client.yml +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -20,6 +20,9 @@ parameters: - name: SubscriptionConfiguration type: string default: $(sub-config-azure-cloud-test-resources) +- name: CoverageReportPath + type: string + default: 'sdk/*/*/*cov_xml.xml' stages: - stage: Build @@ -30,6 +33,7 @@ stages: Artifacts: ${{ parameters.Artifacts }} CtestRegex: ${{ parameters.CtestRegex }} Coverage: ${{ parameters.Coverage }} + CoverageReportPath: ${{ parameters.CoverageReportPath }} - ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(parameters.LiveTestCtestRegex, '')) }}: - stage: LiveTest @@ -42,6 +46,7 @@ stages: CtestRegex: ${{ parameters.LiveTestCtestRegex }} Location: ${{ parameters.Location }} SubscriptionConfiguration: ${{ parameters.SubscriptionConfiguration }} + CoverageReportPath: ${{ parameters.CoverageReportPath }} - ${{ if and(eq(variables['Build.Reason'], 'Manual'), eq(variables['System.TeamProject'], 'internal'), not(endsWith(variables['Build.DefinitionName'], ' - tests'))) }}: - template: archetype-cpp-release.yml diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index 0a6da03f1..23bf082c0 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -32,7 +32,6 @@ stages: parameters: ServiceDirectory: core CtestRegex: azure-core. - LiveTestCtestRegex: azure-core. Artifacts: - Name: azure-core Path: azure-core diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 30683250b..0d47d1997 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -39,6 +39,7 @@ stages: CtestRegex: no-run Coverage: disabled LiveTestCtestRegex: azure-storage + CoverageReportPath: sdk/*/*cov_xml.xml SubscriptionConfiguration: $(sub-config-azure-cloud-test-resources-preview) Artifacts: - Name: azure-storage-common diff --git a/sdk/template/ci.yml b/sdk/template/ci.yml index 45dbd1ee4..09aa05410 100644 --- a/sdk/template/ci.yml +++ b/sdk/template/ci.yml @@ -34,7 +34,6 @@ stages: parameters: ServiceDirectory: template CtestRegex: azure-template - LiveTestCtestRegex: azure-template Artifacts: - Name: azure-template Path: azure-template