|
21 | 21 | - '*.md' |
22 | 22 | - templates/** |
23 | 23 |
|
24 | | -pool: |
25 | | - vmImage: 'ubuntu-latest' # examples of other options: 'macOS-10.15', 'windows-2019' |
26 | | - |
27 | 24 | variables: |
28 | 25 | - template: templates/variables.yml |
29 | 26 |
|
30 | | -steps: |
31 | | -- template: templates/build-pipelines.yml |
| 27 | +jobs: |
| 28 | +- job: build |
| 29 | + displayName: 'Build and Unit Tests' |
| 30 | + pool: |
| 31 | + vmImage: 'ubuntu-latest' |
| 32 | + steps: |
| 33 | + - template: templates/build-pipelines.yml |
| 34 | + |
| 35 | +# --------------------------------------------------------------------------- |
| 36 | +# Total Code Coverage (rolling dashboard, not a per-PR gate) |
| 37 | +# --------------------------------------------------------------------------- |
| 38 | +# Unions this run's unit coverage with the latest DB coverage and publishes one |
| 39 | +# combined report. Best-effort (continueOnError) so it never blocks unit CI. |
| 40 | +- job: total_code_coverage |
| 41 | + displayName: 'Total Code Coverage (rolling dashboard)' |
| 42 | + dependsOn: build |
| 43 | + condition: succeededOrFailed() |
| 44 | + continueOnError: true |
| 45 | + pool: |
| 46 | + vmImage: 'ubuntu-latest' |
| 47 | + steps: |
| 48 | + - checkout: self |
| 49 | + |
| 50 | + # This run's unit coverage (published by the build job above). |
| 51 | + - task: DownloadPipelineArtifact@2 |
| 52 | + displayName: 'Download unit coverage (current run)' |
| 53 | + continueOnError: true |
| 54 | + inputs: |
| 55 | + source: 'current' |
| 56 | + artifact: 'coverage-unit' |
| 57 | + patterns: '**/*.cobertura.xml' |
| 58 | + path: '$(Pipeline.Workspace)/unit' |
| 59 | + |
| 60 | + # DB coverage: each pipeline's numeric definition ID (Azure DevOps pipeline URL |
| 61 | + # ...?definitionId=NN). Mapping: DwSql=1, MsSql=2, MySql=3, PgSql=4, Cosmos=6. |
| 62 | + # (5 is THIS unit pipeline, so it is not downloaded here.) If a pipeline is |
| 63 | + # recreated its ID changes and that DB silently drops from the union - the merge |
| 64 | + # step's -ExpectedSources warning flags any source that produced no files. |
| 65 | + # No 'artifact' name is set so ALL of a run's coverage artifacts are pulled |
| 66 | + # (some DBs publish one per job, e.g. MsSql linux + windows_combined + |
| 67 | + # windows_configuration); the pattern keeps only raw cobertura for the merger. |
| 68 | + - task: DownloadPipelineArtifact@2 |
| 69 | + displayName: 'Download MsSql coverage (latest)' |
| 70 | + continueOnError: true |
| 71 | + inputs: |
| 72 | + source: 'specific' |
| 73 | + project: '$(System.TeamProject)' |
| 74 | + pipeline: '2' |
| 75 | + runVersion: 'latest' |
| 76 | + patterns: 'coverage-*/**/*.cobertura.xml' |
| 77 | + path: '$(Pipeline.Workspace)/db/mssql' |
| 78 | + - task: DownloadPipelineArtifact@2 |
| 79 | + displayName: 'Download PostgreSql coverage (latest)' |
| 80 | + continueOnError: true |
| 81 | + inputs: |
| 82 | + source: 'specific' |
| 83 | + project: '$(System.TeamProject)' |
| 84 | + pipeline: '4' |
| 85 | + runVersion: 'latest' |
| 86 | + patterns: 'coverage-*/**/*.cobertura.xml' |
| 87 | + path: '$(Pipeline.Workspace)/db/pg' |
| 88 | + - task: DownloadPipelineArtifact@2 |
| 89 | + displayName: 'Download MySql coverage (latest)' |
| 90 | + continueOnError: true |
| 91 | + inputs: |
| 92 | + source: 'specific' |
| 93 | + project: '$(System.TeamProject)' |
| 94 | + pipeline: '3' |
| 95 | + runVersion: 'latest' |
| 96 | + patterns: 'coverage-*/**/*.cobertura.xml' |
| 97 | + path: '$(Pipeline.Workspace)/db/mysql' |
| 98 | + - task: DownloadPipelineArtifact@2 |
| 99 | + displayName: 'Download DwSql coverage (latest)' |
| 100 | + continueOnError: true |
| 101 | + inputs: |
| 102 | + source: 'specific' |
| 103 | + project: '$(System.TeamProject)' |
| 104 | + pipeline: '1' |
| 105 | + runVersion: 'latest' |
| 106 | + patterns: 'coverage-*/**/*.cobertura.xml' |
| 107 | + path: '$(Pipeline.Workspace)/db/dwsql' |
| 108 | + - task: DownloadPipelineArtifact@2 |
| 109 | + displayName: 'Download CosmosDb coverage (latest)' |
| 110 | + continueOnError: true |
| 111 | + inputs: |
| 112 | + source: 'specific' |
| 113 | + project: '$(System.TeamProject)' |
| 114 | + pipeline: '6' |
| 115 | + runVersion: 'latest' |
| 116 | + patterns: 'coverage-*/**/*.cobertura.xml' |
| 117 | + path: '$(Pipeline.Workspace)/db/cosmos' |
| 118 | + |
| 119 | + # Union-merge every downloaded cobertura and emit ONE combined Cobertura.xml |
| 120 | + # (test projects excluded). Dependency-free - no ReportGenerator extension. |
| 121 | + - task: PowerShell@2 |
| 122 | + displayName: 'Merge cobertura union and emit combined report' |
| 123 | + continueOnError: true |
| 124 | + inputs: |
| 125 | + filePath: 'scripts/merge-coverage.ps1' |
| 126 | + arguments: '-Path "$(Pipeline.Workspace)" -OutFile "$(Build.ArtifactStagingDirectory)/merged/Cobertura.xml" -ExpectedSources unit,mssql,pg,mysql,dwsql,cosmos' |
| 127 | + pwsh: true |
| 128 | + |
| 129 | + - task: PublishCodeCoverageResults@2 |
| 130 | + displayName: 'Publish combined code coverage' |
| 131 | + continueOnError: true |
| 132 | + inputs: |
| 133 | + summaryFileLocation: '$(Build.ArtifactStagingDirectory)/merged/Cobertura.xml' |
0 commit comments