Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .pipelines/cosmos-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,18 @@ steps:
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Agent.TempDirectory)/**/*cobertura.xml'

# Publish the RAW cobertura as a named pipeline artifact so the unit pipeline's
# 'Total Code Coverage' job can download and union it. (PublishCodeCoverageResults@1
# only exposes an HTML report artifact, not the raw XML, so aggregation needs this.)
- task: CopyFiles@2
displayName: 'Stage raw coverage for aggregation'
inputs:
sourceFolder: '$(Agent.TempDirectory)'
contents: '**/*.cobertura.xml'
targetFolder: '$(Build.ArtifactStagingDirectory)/coverage'
- task: PublishPipelineArtifact@1
displayName: 'Publish coverage artifact for aggregation'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/coverage'
artifact: 'coverage-cosmos'
29 changes: 29 additions & 0 deletions .pipelines/dwsql-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,21 @@ jobs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Agent.TempDirectory)/**/*cobertura.xml'

# Publish the RAW cobertura as a named pipeline artifact so the unit pipeline's
# 'Total Code Coverage' job can download and union it. (PublishCodeCoverageResults@1
# only exposes an HTML report artifact, not the raw XML, so aggregation needs this.)
- task: CopyFiles@2
displayName: 'Stage raw coverage for aggregation'
inputs:
sourceFolder: '$(Agent.TempDirectory)'
contents: '**/*.cobertura.xml'
targetFolder: '$(Build.ArtifactStagingDirectory)/coverage'
- task: PublishPipelineArtifact@1
displayName: 'Publish coverage artifact for aggregation'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/coverage'
artifact: 'coverage-dwsql'


- job: windows
pool:
Expand Down Expand Up @@ -251,6 +266,20 @@ jobs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Agent.TempDirectory)/**/*cobertura.xml'

# Publish the RAW cobertura as a uniquely-named pipeline artifact so the unit
# pipeline's 'Total Code Coverage' job can union the Windows job's coverage too.
- task: CopyFiles@2
displayName: 'Stage raw coverage for aggregation'
inputs:
sourceFolder: '$(Agent.TempDirectory)'
contents: '**/*.cobertura.xml'
targetFolder: '$(Build.ArtifactStagingDirectory)/coverage'
- task: PublishPipelineArtifact@1
displayName: 'Publish coverage artifact for aggregation'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/coverage'
artifact: 'coverage-dwsql-windows'

- task: CopyFiles@2
condition: eq(variables['publishverify'], 'Yes')
displayName: 'Copy received files to Artifact Staging'
Expand Down
16 changes: 14 additions & 2 deletions .pipelines/mssql-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,20 @@ jobs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Agent.TempDirectory)/**/*cobertura.xml'


# MsSql Integration Testing is split into two parallel jobs (~20 min each):
# Publish the RAW cobertura as a named pipeline artifact so the unit pipeline's
# 'Total Code Coverage' job can download and union it. (PublishCodeCoverageResults@1
# only exposes an HTML report artifact, not the raw XML, so aggregation needs this.)
- task: CopyFiles@2
displayName: 'Stage raw coverage for aggregation'
inputs:
sourceFolder: '$(Agent.TempDirectory)'
contents: '**/*.cobertura.xml'
targetFolder: '$(Build.ArtifactStagingDirectory)/coverage'
- task: PublishPipelineArtifact@1
displayName: 'Publish coverage artifact for aggregation'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/coverage'
artifact: 'coverage-mssql'
#
# 1) windows_combined -> GraphQL, HotReload, REST, Unit, OpenApi, Auth,
# Telemetry, and Caching tests.
Expand Down
15 changes: 15 additions & 0 deletions .pipelines/mysql-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,18 @@ jobs:
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Agent.TempDirectory)/**/*cobertura.xml'

# Publish the RAW cobertura as a named pipeline artifact so the unit pipeline's
# 'Total Code Coverage' job can download and union it. (PublishCodeCoverageResults@1
# only exposes an HTML report artifact, not the raw XML, so aggregation needs this.)
- task: CopyFiles@2
displayName: 'Stage raw coverage for aggregation'
inputs:
sourceFolder: '$(Agent.TempDirectory)'
contents: '**/*.cobertura.xml'
targetFolder: '$(Build.ArtifactStagingDirectory)/coverage'
- task: PublishPipelineArtifact@1
displayName: 'Publish coverage artifact for aggregation'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/coverage'
artifact: 'coverage-mysql'
15 changes: 15 additions & 0 deletions .pipelines/pg-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,18 @@ jobs:
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Agent.TempDirectory)/**/*cobertura.xml'

# Publish the RAW cobertura as a named pipeline artifact so the unit pipeline's
# 'Total Code Coverage' job can download and union it. (PublishCodeCoverageResults@1
# only exposes an HTML report artifact, not the raw XML, so aggregation needs this.)
- task: CopyFiles@2
displayName: 'Stage raw coverage for aggregation'
inputs:
sourceFolder: '$(Agent.TempDirectory)'
contents: '**/*.cobertura.xml'
targetFolder: '$(Build.ArtifactStagingDirectory)/coverage'
- task: PublishPipelineArtifact@1
displayName: 'Publish coverage artifact for aggregation'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/coverage'
artifact: 'coverage-pg'
15 changes: 15 additions & 0 deletions .pipelines/templates/build-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,18 @@ steps:
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Agent.TempDirectory)/**/*cobertura.xml'

# Publish this run's unit cobertura as a pipeline artifact so the
# "Total Code Coverage" job (unittest-pipelines.yml) can merge it with the
# database integration pipelines' coverage into one combined report.
- task: CopyFiles@2
displayName: 'Stage unit coverage for aggregation'
inputs:
sourceFolder: '$(Agent.TempDirectory)'
contents: '**/*.cobertura.xml'
targetFolder: '$(Build.ArtifactStagingDirectory)/coverage'
- task: PublishPipelineArtifact@1
displayName: 'Publish unit cobertura (coverage-unit)'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/coverage'
artifact: 'coverage-unit'
14 changes: 14 additions & 0 deletions .pipelines/templates/mssql-test-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,20 @@ steps:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Agent.TempDirectory)/**/*cobertura.xml'

# Publish the RAW cobertura as a uniquely-named pipeline artifact (suffixed per job)
# so the unit pipeline's 'Total Code Coverage' job can union THIS job's coverage too.
- task: CopyFiles@2
displayName: 'Stage raw coverage for aggregation'
inputs:
sourceFolder: '$(Agent.TempDirectory)'
contents: '**/*.cobertura.xml'
targetFolder: '$(Build.ArtifactStagingDirectory)/coverage'
- task: PublishPipelineArtifact@1
displayName: 'Publish coverage artifact for aggregation'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/coverage'
artifact: 'coverage-mssql${{ parameters.artifactSuffix }}'

- task: CopyFiles@2
condition: eq(variables['publishverify'], 'Yes')
displayName: 'Copy received files to Artifact Staging'
Expand Down
112 changes: 107 additions & 5 deletions .pipelines/unittest-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,113 @@ pr:
- '*.md'
- templates/**

pool:
vmImage: 'ubuntu-latest' # examples of other options: 'macOS-10.15', 'windows-2019'

variables:
- template: templates/variables.yml

steps:
- template: templates/build-pipelines.yml
jobs:
- job: build
displayName: 'Build and Unit Tests'
pool:
vmImage: 'ubuntu-latest'
steps:
- template: templates/build-pipelines.yml

# ---------------------------------------------------------------------------
# Total Code Coverage (rolling dashboard, not a per-PR gate)
# ---------------------------------------------------------------------------
# Unions this run's unit coverage with the latest DB coverage and publishes one
# combined report. Best-effort (continueOnError) so it never blocks unit CI.
- job: total_code_coverage
displayName: 'Total Code Coverage (rolling dashboard)'
dependsOn: build
condition: succeededOrFailed()
continueOnError: true
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self

# This run's unit coverage (published by the build job above).
- task: DownloadPipelineArtifact@2
displayName: 'Download unit coverage (this run)'
continueOnError: true
inputs:
source: 'current'
artifact: 'coverage-unit'
patterns: '**/*.cobertura.xml'
path: '$(Pipeline.Workspace)/unit'

# DB coverage: each pipeline's numeric definition ID (Azure DevOps pipeline URL
# ...?definitionId=NN). Mapping: DwSql=1, MsSql=2, MySql=3, PgSql=4, Cosmos=6.
# (5 is THIS unit pipeline, so it is not downloaded here.) If a pipeline is
# recreated its ID changes and that DB silently drops from the union - the merge
# step's -ExpectedSources warning flags any source that produced no files.
# No 'artifact:' name is set so ALL of a run's coverage artifacts are pulled
# (some DBs publish one per job, e.g. MsSql linux + windows_combined +
# windows_configuration); the pattern keeps only raw cobertura for the merger.
- task: DownloadPipelineArtifact@2
displayName: 'Download MsSql coverage (latest)'
continueOnError: true
inputs:
source: 'specific'
project: '$(System.TeamProject)'
pipeline: '2'
runVersion: 'latest'
patterns: '**/*.cobertura.xml'
path: '$(Pipeline.Workspace)/db/mssql'
- task: DownloadPipelineArtifact@2
displayName: 'Download PostgreSql coverage (latest)'
continueOnError: true
inputs:
source: 'specific'
project: '$(System.TeamProject)'
pipeline: '4'
runVersion: 'latest'
patterns: '**/*.cobertura.xml'
path: '$(Pipeline.Workspace)/db/pg'
- task: DownloadPipelineArtifact@2
displayName: 'Download MySql coverage (latest)'
continueOnError: true
inputs:
source: 'specific'
project: '$(System.TeamProject)'
pipeline: '3'
runVersion: 'latest'
patterns: '**/*.cobertura.xml'
path: '$(Pipeline.Workspace)/db/mysql'
- task: DownloadPipelineArtifact@2
displayName: 'Download DwSql coverage (latest)'
continueOnError: true
inputs:
source: 'specific'
project: '$(System.TeamProject)'
pipeline: '1'
runVersion: 'latest'
patterns: '**/*.cobertura.xml'
path: '$(Pipeline.Workspace)/db/dwsql'
- task: DownloadPipelineArtifact@2
displayName: 'Download CosmosDb coverage (latest)'
continueOnError: true
inputs:
source: 'specific'
project: '$(System.TeamProject)'
pipeline: '6'
runVersion: 'latest'
patterns: '**/*.cobertura.xml'
path: '$(Pipeline.Workspace)/db/cosmos'

# Union-merge every downloaded cobertura and emit ONE combined Cobertura.xml
# (test projects excluded). Dependency-free - no ReportGenerator extension.
- task: PowerShell@2
displayName: 'Merge cobertura (union) and emit combined report'
continueOnError: true
inputs:
filePath: 'scripts/merge-coverage.ps1'
arguments: '-Path "$(Pipeline.Workspace)" -OutFile "$(Build.ArtifactStagingDirectory)/merged/Cobertura.xml" -ExpectedSources unit,mssql,pg,mysql,dwsql,cosmos'
pwsh: true

- task: PublishCodeCoverageResults@2
displayName: 'Publish combined code coverage'
continueOnError: true
inputs:
summaryFileLocation: '$(Build.ArtifactStagingDirectory)/merged/Cobertura.xml'
Comment thread
aaronburtle marked this conversation as resolved.
Loading