Skip to content

Commit

Permalink
Fix coverage report for template and core pipelines (#1002)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vhvb1989 authored Nov 19, 2020
1 parent e2bfa85 commit ac09ee6
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion eng/pipelines/templates/jobs/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ parameters:
Coverage: ''
CtestRegex: .*
BuildReleaseArtifacts: true
CoverageReportPath: 'sdk/*/*/*cov_xml.xml'

jobs:
- job: Validate
Expand Down Expand Up @@ -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'], ''))
Expand Down
5 changes: 4 additions & 1 deletion eng/pipelines/templates/jobs/archetype-sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ parameters:
- name: Coverage
type: string
default: 'enabled'
- name: CoverageReportPath
type: string
default: sdk/*/*/*cov_xml.xml

jobs:
- job: Validate
Expand Down Expand Up @@ -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'], ''))
Expand Down
5 changes: 5 additions & 0 deletions eng/pipelines/templates/stages/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion sdk/core/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ stages:
parameters:
ServiceDirectory: core
CtestRegex: azure-core.
LiveTestCtestRegex: azure-core.
Artifacts:
- Name: azure-core
Path: azure-core
1 change: 1 addition & 0 deletions sdk/storage/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion sdk/template/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ stages:
parameters:
ServiceDirectory: template
CtestRegex: azure-template
LiveTestCtestRegex: azure-template
Artifacts:
- Name: azure-template
Path: azure-template

0 comments on commit ac09ee6

Please sign in to comment.