|
| 1 | +parameters: |
| 2 | +- name: BuildConfiguration |
| 3 | + displayName: Build Configuration |
| 4 | + type: string |
| 5 | + default: Debug |
| 6 | + values: [ 'Debug', 'Release' ] |
| 7 | +- name: BuildSolution |
| 8 | + displayName: Solution |
| 9 | + type: string |
| 10 | + default: StyleCopAnalyzers.sln |
| 11 | +- name: BuildPlatform |
| 12 | + displayName: Platform |
| 13 | + type: string |
| 14 | + default: Any CPU |
| 15 | + |
| 16 | +stages: |
| 17 | +- stage: Build_${{ parameters.BuildConfiguration }} |
| 18 | + displayName: Build ${{ parameters.BuildConfiguration }} |
| 19 | + dependsOn: [] |
| 20 | + jobs: |
| 21 | + - job: Build |
| 22 | + steps: |
| 23 | + - powershell: .\init.ps1 -NoRestore |
| 24 | + displayName: Install .NET Core SDK |
| 25 | + |
| 26 | + - task: NuGetToolInstaller@0 |
| 27 | + displayName: 'Use NuGet 5.3.1' |
| 28 | + inputs: |
| 29 | + versionSpec: 5.3.1 |
| 30 | + |
| 31 | + - task: NuGetCommand@2 |
| 32 | + displayName: 'NuGet restore' |
| 33 | + inputs: |
| 34 | + restoreSolution: '${{ parameters.BuildSolution }}' |
| 35 | + feedsToUse: 'config' |
| 36 | + nugetConfigPath: 'NuGet.config' |
| 37 | + |
| 38 | + - task: VSBuild@1 |
| 39 | + displayName: 'Build solution ${{ parameters.BuildSolution }}' |
| 40 | + inputs: |
| 41 | + solution: '${{ parameters.BuildSolution }}' |
| 42 | + platform: '${{ parameters.BuildPlatform }}' |
| 43 | + configuration: '${{ parameters.BuildConfiguration }}' |
| 44 | + maximumCpuCount: false # AnnotatorBuildTask doesn't support parallel builds yet |
| 45 | + msbuildArgs: '/v:minimal /bl:$(Build.SourcesDirectory)/msbuild.binlog' |
| 46 | + |
| 47 | +# - task: PowerShell@2 |
| 48 | +# displayName: Upload coverage reports to codecov.io |
| 49 | +# condition: eq(variables['BuildConfiguration'], 'Debug') |
| 50 | +# inputs: |
| 51 | +# workingDirectory: '$(Build.SourcesDirectory)/build' |
| 52 | +# targetType: inline |
| 53 | +# script: | |
| 54 | +# $packageConfig = [xml](Get-Content ..\.nuget\packages.config) |
| 55 | +# $codecov_version = $packageConfig.SelectSingleNode('/packages/package[@id="Codecov"]').version |
| 56 | +# $codecov = "..\packages\Codecov.$codecov_version\tools\codecov.exe" |
| 57 | +# &$codecov -f '..\build\OpenCover.Reports\OpenCover.StyleCopAnalyzers.xml' --required |
| 58 | + |
| 59 | + - task: PublishPipelineArtifact@1 |
| 60 | + displayName: Publish build logs |
| 61 | + inputs: |
| 62 | + targetPath: msbuild.binlog |
| 63 | + artifact: Build logs ${{ parameters.BuildConfiguration }} |
| 64 | + condition: failed() |
| 65 | + |
| 66 | + - task: PublishPipelineArtifact@1 |
| 67 | + displayName: Publish solution packages |
| 68 | + inputs: |
| 69 | + targetPath: $(Build.SourcesDirectory)/packages |
| 70 | + artifact: slnPackages-${{ parameters.BuildConfiguration }} |
| 71 | + |
| 72 | + - task: PublishPipelineArtifact@1 |
| 73 | + displayName: Publish build output (Test C# 6) |
| 74 | + inputs: |
| 75 | + targetPath: $(Build.SourcesDirectory)/StyleCop.Analyzers/StyleCop.Analyzers.Test/bin |
| 76 | + artifact: buildTest-cs6-${{ parameters.BuildConfiguration }} |
| 77 | + |
| 78 | + - task: PublishPipelineArtifact@1 |
| 79 | + displayName: Publish build output (Test C# 7) |
| 80 | + inputs: |
| 81 | + targetPath: $(Build.SourcesDirectory)/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp7/bin |
| 82 | + artifact: buildTest-cs7-${{ parameters.BuildConfiguration }} |
| 83 | + |
| 84 | + - task: PublishPipelineArtifact@1 |
| 85 | + displayName: Publish build output (Test C# 8) |
| 86 | + inputs: |
| 87 | + targetPath: $(Build.SourcesDirectory)/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp8/bin |
| 88 | + artifact: buildTest-cs8-${{ parameters.BuildConfiguration }} |
| 89 | + |
| 90 | + - task: PublishPipelineArtifact@1 |
| 91 | + displayName: Publish build output (Test C# 9) |
| 92 | + inputs: |
| 93 | + targetPath: $(Build.SourcesDirectory)/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp9/bin |
| 94 | + artifact: buildTest-cs9-${{ parameters.BuildConfiguration }} |
| 95 | + |
| 96 | + - task: PublishPipelineArtifact@1 |
| 97 | + displayName: Publish build output (Test C# 10) |
| 98 | + inputs: |
| 99 | + targetPath: $(Build.SourcesDirectory)/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp10/bin |
| 100 | + artifact: buildTest-cs10-${{ parameters.BuildConfiguration }} |
| 101 | + |
| 102 | + - task: PublishPipelineArtifact@1 |
| 103 | + displayName: Publish build output (Test C# 11) |
| 104 | + inputs: |
| 105 | + targetPath: $(Build.SourcesDirectory)/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp11/bin |
| 106 | + artifact: buildTest-cs11-${{ parameters.BuildConfiguration }} |
| 107 | + |
| 108 | + - task: PublishPipelineArtifact@1 |
| 109 | + displayName: Publish build output (Test C# 12) |
| 110 | + inputs: |
| 111 | + targetPath: $(Build.SourcesDirectory)/StyleCop.Analyzers/StyleCop.Analyzers.Test.CSharp12/bin |
| 112 | + artifact: buildTest-cs12-${{ parameters.BuildConfiguration }} |
| 113 | + |
| 114 | +- stage: Test_CSharp_6_${{ parameters.BuildConfiguration }} |
| 115 | + displayName: Test C# 6 ${{ parameters.BuildConfiguration }} |
| 116 | + dependsOn: [ 'Build_${{ parameters.BuildConfiguration }}' ] |
| 117 | + jobs: |
| 118 | + - template: test.yml |
| 119 | + parameters: |
| 120 | + BuildConfiguration: ${{ parameters.BuildConfiguration }} |
| 121 | + BuildSolution: ${{ parameters.BuildSolution }} |
| 122 | + BuildPlatform: ${{ parameters.BuildPlatform }} |
| 123 | + LangVersion: '6' |
| 124 | + FrameworkVersion: 'net452' |
| 125 | + |
| 126 | +- stage: Test_CSharp_7_${{ parameters.BuildConfiguration }} |
| 127 | + displayName: Test C# 7 ${{ parameters.BuildConfiguration }} |
| 128 | + dependsOn: [ 'Build_${{ parameters.BuildConfiguration }}' ] |
| 129 | + jobs: |
| 130 | + - template: test.yml |
| 131 | + parameters: |
| 132 | + BuildConfiguration: ${{ parameters.BuildConfiguration }} |
| 133 | + BuildSolution: ${{ parameters.BuildSolution }} |
| 134 | + BuildPlatform: ${{ parameters.BuildPlatform }} |
| 135 | + LangVersion: '7' |
| 136 | + FrameworkVersion: 'net46' |
| 137 | + |
| 138 | +- stage: Test_CSharp_8_${{ parameters.BuildConfiguration }} |
| 139 | + displayName: Test C# 8 ${{ parameters.BuildConfiguration }} |
| 140 | + dependsOn: [ 'Build_${{ parameters.BuildConfiguration }}' ] |
| 141 | + jobs: |
| 142 | + - template: test.yml |
| 143 | + parameters: |
| 144 | + BuildConfiguration: ${{ parameters.BuildConfiguration }} |
| 145 | + BuildSolution: ${{ parameters.BuildSolution }} |
| 146 | + BuildPlatform: ${{ parameters.BuildPlatform }} |
| 147 | + LangVersion: '8' |
| 148 | + FrameworkVersion: 'net472' |
| 149 | + |
| 150 | +- stage: Test_CSharp_9_${{ parameters.BuildConfiguration }} |
| 151 | + displayName: Test C# 9 ${{ parameters.BuildConfiguration }} |
| 152 | + dependsOn: [ 'Build_${{ parameters.BuildConfiguration }}' ] |
| 153 | + jobs: |
| 154 | + - template: test.yml |
| 155 | + parameters: |
| 156 | + BuildConfiguration: ${{ parameters.BuildConfiguration }} |
| 157 | + BuildSolution: ${{ parameters.BuildSolution }} |
| 158 | + BuildPlatform: ${{ parameters.BuildPlatform }} |
| 159 | + LangVersion: '9' |
| 160 | + FrameworkVersion: 'net472' |
| 161 | + |
| 162 | +- stage: Test_CSharp_10_${{ parameters.BuildConfiguration }} |
| 163 | + displayName: Test C# 10 ${{ parameters.BuildConfiguration }} |
| 164 | + dependsOn: [ 'Build_${{ parameters.BuildConfiguration }}' ] |
| 165 | + jobs: |
| 166 | + - template: test.yml |
| 167 | + parameters: |
| 168 | + BuildConfiguration: ${{ parameters.BuildConfiguration }} |
| 169 | + BuildSolution: ${{ parameters.BuildSolution }} |
| 170 | + BuildPlatform: ${{ parameters.BuildPlatform }} |
| 171 | + LangVersion: '10' |
| 172 | + FrameworkVersion: 'net472' |
| 173 | + |
| 174 | +- stage: Test_CSharp_11_${{ parameters.BuildConfiguration }} |
| 175 | + displayName: Test C# 11 ${{ parameters.BuildConfiguration }} |
| 176 | + dependsOn: [ 'Build_${{ parameters.BuildConfiguration }}' ] |
| 177 | + jobs: |
| 178 | + - template: test.yml |
| 179 | + parameters: |
| 180 | + BuildConfiguration: ${{ parameters.BuildConfiguration }} |
| 181 | + BuildSolution: ${{ parameters.BuildSolution }} |
| 182 | + BuildPlatform: ${{ parameters.BuildPlatform }} |
| 183 | + LangVersion: '11' |
| 184 | + FrameworkVersion: 'net472' |
| 185 | + |
| 186 | +- stage: Test_CSharp_12_${{ parameters.BuildConfiguration }} |
| 187 | + displayName: Test C# 12 ${{ parameters.BuildConfiguration }} |
| 188 | + dependsOn: [ 'Build_${{ parameters.BuildConfiguration }}' ] |
| 189 | + jobs: |
| 190 | + - template: test.yml |
| 191 | + parameters: |
| 192 | + BuildConfiguration: ${{ parameters.BuildConfiguration }} |
| 193 | + BuildSolution: ${{ parameters.BuildSolution }} |
| 194 | + BuildPlatform: ${{ parameters.BuildPlatform }} |
| 195 | + LangVersion: '12' |
| 196 | + FrameworkVersion: 'net472' |
| 197 | + |
| 198 | +- stage: Publish_Code_Coverage_${{ parameters.BuildConfiguration }} |
| 199 | + displayName: Publish Code Coverage |
| 200 | + condition: eq('${{ parameters.BuildConfiguration }}', 'Debug') |
| 201 | + dependsOn: |
| 202 | + - Test_CSharp_6_${{ parameters.BuildConfiguration }} |
| 203 | + - Test_CSharp_7_${{ parameters.BuildConfiguration }} |
| 204 | + - Test_CSharp_8_${{ parameters.BuildConfiguration }} |
| 205 | + - Test_CSharp_9_${{ parameters.BuildConfiguration }} |
| 206 | + - Test_CSharp_10_${{ parameters.BuildConfiguration }} |
| 207 | + - Test_CSharp_11_${{ parameters.BuildConfiguration }} |
| 208 | + - Test_CSharp_12_${{ parameters.BuildConfiguration }} |
| 209 | + jobs: |
| 210 | + - job: WrapUp |
| 211 | + steps: |
| 212 | + - checkout: self |
| 213 | + fetchDepth: 0 # avoid shallow clone so nbgv can do its work. |
| 214 | + clean: true |
| 215 | + - task: DownloadPipelineArtifact@2 |
| 216 | + displayName: 🔻 Download solution packages |
| 217 | + continueOnError: true |
| 218 | + inputs: |
| 219 | + buildType: current |
| 220 | + artifactName: slnPackages-${{ parameters.BuildConfiguration }} |
| 221 | + targetPath: $(Build.SourcesDirectory)/packages |
| 222 | + - download: current |
| 223 | + artifact: coverageResults-cs6 |
| 224 | + displayName: 🔻 Download C# 6 code coverage results |
| 225 | + continueOnError: true |
| 226 | + - download: current |
| 227 | + artifact: coverageResults-cs7 |
| 228 | + displayName: 🔻 Download C# 7 code coverage results |
| 229 | + continueOnError: true |
| 230 | + - download: current |
| 231 | + artifact: coverageResults-cs8 |
| 232 | + displayName: 🔻 Download C# 8 code coverage results |
| 233 | + continueOnError: true |
| 234 | + - download: current |
| 235 | + artifact: coverageResults-cs9 |
| 236 | + displayName: 🔻 Download C# 9 code coverage results |
| 237 | + continueOnError: true |
| 238 | + - download: current |
| 239 | + artifact: coverageResults-cs10 |
| 240 | + displayName: 🔻 Download C# 10 code coverage results |
| 241 | + continueOnError: true |
| 242 | + - download: current |
| 243 | + artifact: coverageResults-cs11 |
| 244 | + displayName: 🔻 Download C# 11 code coverage results |
| 245 | + continueOnError: true |
| 246 | + - download: current |
| 247 | + artifact: coverageResults-cs12 |
| 248 | + displayName: 🔻 Download C# 12 code coverage results |
| 249 | + continueOnError: true |
| 250 | + - task: PowerShell@2 |
| 251 | + displayName: ⚙ Merge coverage |
| 252 | + timeoutInMinutes: 20 |
| 253 | + inputs: |
| 254 | + workingDirectory: $(Build.SourcesDirectory) |
| 255 | + targetType: inline |
| 256 | + script: | |
| 257 | + $packageConfig = [xml](Get-Content .\.nuget\packages.config) |
| 258 | + $packages_folder = '.\packages' |
| 259 | + $reportgenerator_version = $packageConfig.SelectSingleNode('/packages/package[@id="ReportGenerator"]').version |
| 260 | + $report_generator = "$packages_folder\ReportGenerator.$reportgenerator_version\tools\net47\ReportGenerator.exe" |
| 261 | + &$report_generator -targetdir:$(Pipeline.Workspace)/coverageResults-final -reporttypes:Cobertura "-reports:$(Pipeline.Workspace)/coverageResults-*/OpenCover.*.xml" |
| 262 | +
|
| 263 | + - task: PowerShell@2 |
| 264 | + displayName: Public code coverage to codecov.io |
| 265 | + timeoutInMinutes: 20 |
| 266 | + inputs: |
| 267 | + workingDirectory: $(Build.SourcesDirectory) |
| 268 | + targetType: inline |
| 269 | + script: | |
| 270 | + $packageConfig = [xml](Get-Content .\.nuget\packages.config) |
| 271 | + $packages_folder = '.\packages' |
| 272 | + $codecov_version = $packageConfig.SelectSingleNode('/packages/package[@id="CodecovUploader"]').version |
| 273 | + $codecov = "$packages_folder\CodecovUploader.$codecov_version\tools\codecov.exe" |
| 274 | + &$codecov -f '$(Pipeline.Workspace)/coverageResults-final/Cobertura.xml' --required |
| 275 | +
|
| 276 | + - task: PublishPipelineArtifact@1 |
| 277 | + displayName: Publish merged coverage |
| 278 | + inputs: |
| 279 | + targetPath: $(Pipeline.Workspace)/coverageResults-final |
| 280 | + artifact: coverageResults-final$(System.JobAttempt)-${{ parameters.BuildConfiguration }} |
0 commit comments