@@ -11,6 +11,13 @@ trigger:
11
11
exclude :
12
12
- " *-*"
13
13
14
+ variables :
15
+ buildFolderName : output
16
+ buildArtifactName : output
17
+ testResultFolderName : testResults
18
+ testArtifactName : testResults
19
+ sourceFolderName : source
20
+
14
21
stages :
15
22
- stage : Build
16
23
jobs :
@@ -36,12 +43,13 @@ stages:
36
43
env :
37
44
ModuleVersion : $(gitVersion.Informationalversion)
38
45
39
- - task : PublishBuildArtifacts @1
40
- displayName : ' Publish Build Artifact'
46
+ - task : PublishPipelineArtifact @1
47
+ displayName : ' Publish Pipeline Artifact'
41
48
inputs :
42
- PathtoPublish : ' output/'
43
- ArtifactName : ' output'
44
- publishLocation : ' Container'
49
+ targetPath : ' $(buildFolderName)/'
50
+ artifact : $(buildArtifactName)
51
+ publishLocation : ' pipeline'
52
+ parallel : true
45
53
46
54
- stage : Test
47
55
dependsOn : Build
@@ -52,13 +60,12 @@ stages:
52
60
vmImage : ' windows-2019'
53
61
timeoutInMinutes : 0
54
62
steps :
55
- - task : DownloadBuildArtifacts@0
56
- displayName : ' Download Build Artifact'
63
+ - task : DownloadPipelineArtifact@2
64
+ displayName : ' Download Pipeline Artifact'
57
65
inputs :
58
66
buildType : ' current'
59
- downloadType : ' single'
60
- artifactName : ' output'
61
- downloadPath : ' $(Build.SourcesDirectory)'
67
+ artifactName : $(buildArtifactName)
68
+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
62
69
63
70
- task : PowerShell@2
64
71
name : test
@@ -72,7 +79,7 @@ stages:
72
79
displayName : ' Publish Test Results'
73
80
inputs :
74
81
testResultsFormat : ' NUnit'
75
- testResultsFiles : ' output/testResults /NUnit*.xml'
82
+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
76
83
testRunTitle : ' HQRM'
77
84
condition : succeededOrFailed()
78
85
@@ -82,20 +89,12 @@ stages:
82
89
vmImage : ' vs2017-win2016'
83
90
timeoutInMinutes : 0
84
91
steps :
85
- - powershell : |
86
- $repositoryOwner,$repositoryName = $env:BUILD_REPOSITORY_NAME -split '/'
87
- echo "##vso[task.setvariable variable=RepositoryOwner;isOutput=true]$repositoryOwner"
88
- echo "##vso[task.setvariable variable=RepositoryName;isOutput=true]$repositoryName"
89
- name: dscBuildVariable
90
- displayName: 'Set Environment Variables'
91
-
92
- - task : DownloadBuildArtifacts@0
93
- displayName : ' Download Build Artifact'
92
+ - task : DownloadPipelineArtifact@2
93
+ displayName : ' Download Pipeline Artifact'
94
94
inputs :
95
95
buildType : ' current'
96
- downloadType : ' single'
97
- artifactName : ' output'
98
- downloadPath : ' $(Build.SourcesDirectory)'
96
+ artifactName : $(buildArtifactName)
97
+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
99
98
100
99
- task : PowerShell@2
101
100
name : test
@@ -109,31 +108,61 @@ stages:
109
108
displayName : ' Publish Test Results'
110
109
inputs :
111
110
testResultsFormat : ' NUnit'
112
- testResultsFiles : ' output/testResults /NUnit*.xml'
111
+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
113
112
testRunTitle : ' Unit (Windows Server 2016)'
114
113
condition : succeededOrFailed()
115
114
115
+ - task : PublishPipelineArtifact@1
116
+ displayName : ' Publish Test Artifact'
117
+ inputs :
118
+ targetPath : ' $(buildFolderName)/$(testResultFolderName)/'
119
+ artifactName : $(testArtifactName)
120
+ parallel : true
121
+
122
+ - job : Code_Coverage
123
+ displayName : ' Publish Code Coverage'
124
+ dependsOn : Test_Unit_2016
125
+ pool :
126
+ vmImage : ' ubuntu 16.04'
127
+ timeoutInMinutes : 0
128
+ steps :
129
+ - task : DownloadPipelineArtifact@2
130
+ displayName : ' Download Pipeline Artifact'
131
+ inputs :
132
+ buildType : ' current'
133
+ artifactName : $(buildArtifactName)
134
+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
135
+
136
+ - task : DownloadPipelineArtifact@2
137
+ displayName : ' Download Test Artifact'
138
+ inputs :
139
+ buildType : ' current'
140
+ artifactName : $(testArtifactName)
141
+ targetPath : ' $(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)'
142
+
116
143
- task : PublishCodeCoverageResults@1
117
- displayName : ' Publish Code Coverage'
118
- condition : succeededOrFailed()
144
+ displayName : ' Publish Code Coverage to Azure DevOps'
119
145
inputs :
120
146
codeCoverageTool : ' JaCoCo'
121
- summaryFileLocation : ' output/testResults/CodeCov*.xml'
122
- pathToSources : ' $(Build.SourcesDirectory)/output/$(DscBuildVariable.RepositoryName)'
147
+ summaryFileLocation : ' $(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml'
148
+ pathToSources : ' $(Build.SourcesDirectory)/$(sourceFolderName)/'
149
+
150
+ - script : |
151
+ bash <(curl -s https://codecov.io/bash) -f "./$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml"
152
+ displayName: 'Publish Code Coverage to Codecov.io'
123
153
124
154
- job : Test_Integration_2016
125
155
displayName : ' Integration (Windows Server 2016)'
126
156
pool :
127
157
vmImage : ' vs2017-win2016'
128
158
timeoutInMinutes : 0
129
159
steps :
130
- - task : DownloadBuildArtifacts@0
131
- displayName : ' Download Build Artifact'
160
+ - task : DownloadPipelineArtifact@2
161
+ displayName : ' Download Pipeline Artifact'
132
162
inputs :
133
163
buildType : ' current'
134
- downloadType : ' single'
135
- artifactName : ' output'
136
- downloadPath : ' $(Build.SourcesDirectory)'
164
+ artifactName : $(buildArtifactName)
165
+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
137
166
138
167
- task : PowerShell@2
139
168
name : configureWinRM
@@ -155,7 +184,7 @@ stages:
155
184
displayName : ' Publish Test Results'
156
185
inputs :
157
186
testResultsFormat : ' NUnit'
158
- testResultsFiles : ' output/testResults /NUnit*.xml'
187
+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
159
188
testRunTitle : ' Integration (Windows Server 2016)'
160
189
condition : succeededOrFailed()
161
190
@@ -165,20 +194,12 @@ stages:
165
194
vmImage : ' windows-2019'
166
195
timeoutInMinutes : 0
167
196
steps :
168
- - powershell : |
169
- $repositoryOwner,$repositoryName = $env:BUILD_REPOSITORY_NAME -split '/'
170
- echo "##vso[task.setvariable variable=RepositoryOwner;isOutput=true]$repositoryOwner"
171
- echo "##vso[task.setvariable variable=RepositoryName;isOutput=true]$repositoryName"
172
- name: dscBuildVariable
173
- displayName: 'Set Environment Variables'
174
-
175
- - task : DownloadBuildArtifacts@0
176
- displayName : ' Download Build Artifact'
197
+ - task : DownloadPipelineArtifact@2
198
+ displayName : ' Download Pipeline Artifact'
177
199
inputs :
178
200
buildType : ' current'
179
- downloadType : ' single'
180
- artifactName : ' output'
181
- downloadPath : ' $(Build.SourcesDirectory)'
201
+ artifactName : $(buildArtifactName)
202
+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
182
203
183
204
- task : PowerShell@2
184
205
name : test
@@ -192,31 +213,22 @@ stages:
192
213
displayName : ' Publish Test Results'
193
214
inputs :
194
215
testResultsFormat : ' NUnit'
195
- testResultsFiles : ' output/testResults /NUnit*.xml'
216
+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
196
217
testRunTitle : ' Unit (Windows Server 2019)'
197
218
condition : succeededOrFailed()
198
219
199
- - task : PublishCodeCoverageResults@1
200
- displayName : ' Publish Code Coverage'
201
- condition : succeededOrFailed()
202
- inputs :
203
- codeCoverageTool : ' JaCoCo'
204
- summaryFileLocation : ' output/testResults/CodeCov*.xml'
205
- pathToSources : ' $(Build.SourcesDirectory)/output/$(dscBuildVariable.RepositoryName)'
206
-
207
220
- job : Test_Integration_2019
208
221
displayName : ' Integration (Windows Server 2019)'
209
222
pool :
210
223
vmImage : ' windows-2019'
211
224
timeoutInMinutes : 0
212
225
steps :
213
- - task : DownloadBuildArtifacts@0
214
- displayName : ' Download Build Artifact'
226
+ - task : DownloadPipelineArtifact@2
227
+ displayName : ' Download Pipeline Artifact'
215
228
inputs :
216
229
buildType : ' current'
217
- downloadType : ' single'
218
- artifactName : ' output'
219
- downloadPath : ' $(Build.SourcesDirectory)'
230
+ artifactName : $(buildArtifactName)
231
+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
220
232
221
233
- task : PowerShell@2
222
234
name : configureWinRM
@@ -238,7 +250,7 @@ stages:
238
250
displayName : ' Publish Test Results'
239
251
inputs :
240
252
testResultsFormat : ' NUnit'
241
- testResultsFiles : ' output/testResults /NUnit*.xml'
253
+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
242
254
testRunTitle : ' Integration (Windows Server 2019)'
243
255
condition : succeededOrFailed()
244
256
@@ -259,13 +271,12 @@ stages:
259
271
pool :
260
272
vmImage : ' ubuntu 16.04'
261
273
steps :
262
- - task : DownloadBuildArtifacts@0
263
- displayName : ' Download Build Artifact'
274
+ - task : DownloadPipelineArtifact@2
275
+ displayName : ' Download Pipeline Artifact'
264
276
inputs :
265
277
buildType : ' current'
266
- downloadType : ' single'
267
- artifactName : ' output'
268
- downloadPath : ' $(Build.SourcesDirectory)'
278
+ artifactName : $(buildArtifactName)
279
+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
269
280
270
281
- task : PowerShell@2
271
282
name : publishRelease
0 commit comments