forked from CoreWCF/CoreWCF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
266 lines (259 loc) · 8.73 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
trigger:
- master
variables:
_solution: 'src/CoreWCF.sln'
_libraryProjects: 'src/CoreWCF.*/src/CoreWCF.*.csproj'
_testProjects: '**/*.Tests.csproj'
disable.coverage.autogenerate: 'true'
stages:
- stage: Build
displayName: Build
jobs:
- job: Build
strategy:
matrix:
Release:
_buildConfig: 'Release'
Debug:
_buildConfig: 'Debug'
pool:
vmImage: 'windows-latest'
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 3.1.x
installationPath: $(Agent.ToolsDirectory)/dotnet
# GitVersion task broken as of 2019-12-10. See https://github.com/GitTools/GitVersion/issues/1855
# Installing the GitVersion tool and running it directly as a workaround
- task: DotNetCoreCLI@2
displayName: 'Install gitversion'
inputs:
command: 'custom'
custom: 'tool'
arguments: 'install -g gitversion.tool --version 5.3.7'
- task: DotNetCoreCLI@2
displayName: 'Gitversion setup'
inputs:
command: 'custom'
custom: 'gitversion'
arguments: '/output buildserver'
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: 'build'
projects: $(_libraryProjects)
arguments: '--configuration $(_buildConfig) /t:restore'
- task: DotNetCoreCLI@2
displayName: Build $(_buildConfig)
inputs:
command: 'build'
projects: $(_libraryProjects)
arguments: '--no-restore --configuration $(_buildConfig)'
- publish: $(System.DefaultWorkingDirectory)/bin
artifact: $(_buildConfig)Build
- stage: Test
displayName: Run Tests
dependsOn: Build
jobs:
- job: TestRelease
strategy:
matrix:
Windows_netcore2.1:
imageName: 'windows-latest'
targetFramework: 'netcoreapp2.1'
testArgs: ''
Windows_netcore3.1:
imageName: 'windows-latest'
targetFramework: 'netcoreapp3.1'
testArgs: ''
Windows_netfx:
imageName: 'windows-latest'
targetFramework: 'net472'
testArgs: ''
Linux_netcore2.1:
imageName: 'ubuntu-latest'
targetFramework: 'netcoreapp2.1'
testArgs: '--filter Category!=WindowsOnly'
Linux_netcore3.1:
imageName: 'ubuntu-latest'
targetFramework: 'netcoreapp3.1'
testArgs: '--filter Category!=WindowsOnly'
displayName: Test Release
pool:
vmImage: $(imageName)
steps:
- task: DownloadPipelineArtifact@2
displayName: Download build artifacts
inputs:
source: current
artifact: ReleaseBuild
path: $(System.DefaultWorkingDirectory)/bin
- task: DotNetCoreCLI@2
displayName: Restore packages
inputs:
command: 'build'
projects: $(_testProjects)
arguments: '--configuration Release /t:restore'
- task: DotNetCoreCLI@2
displayName: Build test projects
inputs:
command: 'build'
projects: $(_testProjects)
arguments: '--configuration Release --framework $(targetFramework)'
- task: DotNetCoreCLI@2
displayName: Run Tests
timeoutInMinutes: 5
inputs:
command: 'test'
projects: $(_testProjects)
publishTestResults: true
arguments: '--no-restore --no-build --configuration Release --framework $(targetFramework) $(testArgs)'
- job: TestDebug
strategy:
matrix:
Windows_netcore2.1:
imageName: 'windows-latest'
targetFramework: 'netcoreapp2.1'
testArgs: ''
Windows_netcore3.1:
imageName: 'windows-latest'
targetFramework: 'netcoreapp3.1'
testArgs: ''
Windows_netfx:
imageName: 'windows-latest'
targetFramework: 'net472'
testArgs: ''
Linux_netcore2.1:
imageName: 'ubuntu-latest'
targetFramework: 'netcoreapp2.1'
testArgs: '--filter Category!=WindowsOnly'
Linux_netcore3.1:
imageName: 'ubuntu-latest'
targetFramework: 'netcoreapp3.1'
testArgs: '--filter Category!=WindowsOnly'
displayName: Test Debug
pool:
vmImage: $(imageName)
steps:
- task: DownloadPipelineArtifact@2
displayName: Download build artifacts
inputs:
source: current
artifact: DebugBuild
path: $(System.DefaultWorkingDirectory)/bin
- task: DotNetCoreCLI@2
displayName: Restore packages
inputs:
command: 'build'
projects: $(_testProjects)
arguments: '--configuration Debug /t:restore'
- task: DotNetCoreCLI@2
displayName: Build test projects
inputs:
command: 'build'
projects: $(_testProjects)
arguments: '--configuration Debug --framework $(targetFramework)'
- task: DotNetCoreCLI@2
displayName: Run Tests
timeoutInMinutes: 5
inputs:
command: 'test'
projects: $(_testProjects)
publishTestResults: true
arguments: '--no-restore --no-build --configuration Debug --framework $(targetFramework) $(testArgs)'
- job: CodeCoverage
displayName: Code Coverage
pool:
vmImage: 'windows-latest'
dependsOn:
- TestDebug
- TestRelease
steps:
- script: set PATH=%PATH%;%USERPROFILE%\.dotnet\tools
displayName: Add dotnet tools folder to path
- task: DotNetCoreCLI@2
displayName: 'Install ReportGenerator'
inputs:
command: 'custom'
custom: 'tool'
arguments: 'install -g dotnet-reportgenerator-globaltool --version 4.6.1'
- task: DownloadPipelineArtifact@2
displayName: Download build artifacts
inputs:
source: current
artifact: ReleaseBuild
path: $(System.DefaultWorkingDirectory)/bin
- task: DotNetCoreCLI@2
displayName: Restore packages
inputs:
command: 'build'
projects: $(_testProjects)
arguments: '--configuration Release /t:restore'
- task: DotNetCoreCLI@2
displayName: Build test projects
inputs:
command: 'build'
projects: $(_testProjects)
arguments: '--configuration Release --framework netcoreapp3.1'
- task: DotNetCoreCLI@2
displayName: Run Tests with Coverage
timeoutInMinutes: 10
inputs:
command: 'test'
projects: $(_testProjects)
publishTestResults: true
arguments: '--no-restore --no-build --configuration Release --framework netcoreapp3.1 /p:CollectCoverage=true /p:CoverletOutputDir=$(Build.ArtifactStagingDirectory)/Coverage'
- script: reportgenerator "-reports:$(Build.ArtifactStagingDirectory)/Coverage/*.xml" "-targetdir:$(Build.ArtifactStagingDirectory)/Coverage/Report" -reporttypes:HtmlInline_AzurePipelines;Cobertura;Badges
displayName: 'Generate Coverage Report'
- task: PublishCodeCoverageResults@1
displayName: Publish Code Coverage report
inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: $(Build.ArtifactStagingDirectory)/Coverage/Report/Cobertura.xml
# To make the task not regenerate the report an environment variable was added to the pipeline in Azure DevOps; "disable.coverage.autogenerate: 'true'"
# see: https://github.com/danielpalme/ReportGenerator/wiki/Integration#attention
reportDirectory: $(Build.ArtifactStagingDirectory)/Coverage/Report/
- stage: Pack
dependsOn: Test
displayName: Create Packages
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))
jobs:
- job: Pack
pool:
vmImage: 'windows-latest'
steps:
- task: DownloadPipelineArtifact@2
displayName: Download build artifacts
inputs:
source: current
artifact: ReleaseBuild
path: $(System.DefaultWorkingDirectory)/bin
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: 'build'
projects: $(_libraryProjects)
arguments: '--configuration Release /t:restore'
- task: DotNetCoreCLI@2
displayName: Create packages
inputs:
command: 'pack'
configurationToPack: Release
searchPatternPack: $(_libraryProjects)
outputDir: '$(Build.ArtifactStagingDirectory)/Packages'
nobuild: true
includesymbols: true
arguments: '--no-restore'
- task: NuGetAuthenticate@0
displayName: NuGet Authenticate
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: push
feedPublish: 'CoreWCF/CoreWCF'
verbosityPush: Detailed
packagesToPush: '$(Build.ArtifactStagingDirectory)/Packages/*.*'
allowPackageConflicts: true
publishPackageMetadata: true