@@ -11,6 +11,13 @@ trigger:
1111 exclude :
1212 - " *-*"
1313
14+ variables :
15+ buildFolderName : output
16+ buildArtifactName : output
17+ testResultFolderName : testResults
18+ testArtifactName : testResults
19+ sourceFolderName : source
20+
1421stages :
1522 - stage : Build
1623 jobs :
@@ -36,12 +43,13 @@ stages:
3643 env :
3744 ModuleVersion : $(gitVersion.Informationalversion)
3845
39- - task : PublishBuildArtifacts @1
40- displayName : ' Publish Build Artifact'
46+ - task : PublishPipelineArtifact @1
47+ displayName : ' Publish Pipeline Artifact'
4148 inputs :
42- PathtoPublish : ' output/'
43- ArtifactName : ' output'
44- publishLocation : ' Container'
49+ targetPath : ' $(buildFolderName)/'
50+ artifact : $(buildArtifactName)
51+ publishLocation : ' pipeline'
52+ parallel : true
4553
4654 - stage : Test
4755 dependsOn : Build
@@ -52,13 +60,12 @@ stages:
5260 vmImage : ' windows-2019'
5361 timeoutInMinutes : 0
5462 steps :
55- - task : DownloadBuildArtifacts@0
56- displayName : ' Download Build Artifact'
63+ - task : DownloadPipelineArtifact@2
64+ displayName : ' Download Pipeline Artifact'
5765 inputs :
5866 buildType : ' current'
59- downloadType : ' single'
60- artifactName : ' output'
61- downloadPath : ' $(Build.SourcesDirectory)'
67+ artifactName : $(buildArtifactName)
68+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
6269
6370 - task : PowerShell@2
6471 name : test
@@ -72,7 +79,7 @@ stages:
7279 displayName : ' Publish Test Results'
7380 inputs :
7481 testResultsFormat : ' NUnit'
75- testResultsFiles : ' output/testResults /NUnit*.xml'
82+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
7683 testRunTitle : ' HQRM'
7784 condition : succeededOrFailed()
7885
@@ -82,20 +89,12 @@ stages:
8289 vmImage : ' vs2017-win2016'
8390 timeoutInMinutes : 0
8491 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'
9494 inputs :
9595 buildType : ' current'
96- downloadType : ' single'
97- artifactName : ' output'
98- downloadPath : ' $(Build.SourcesDirectory)'
96+ artifactName : $(buildArtifactName)
97+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
9998
10099 - task : PowerShell@2
101100 name : test
@@ -109,31 +108,61 @@ stages:
109108 displayName : ' Publish Test Results'
110109 inputs :
111110 testResultsFormat : ' NUnit'
112- testResultsFiles : ' output/testResults /NUnit*.xml'
111+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
113112 testRunTitle : ' Unit (Windows Server 2016)'
114113 condition : succeededOrFailed()
115114
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+
116143 - task : PublishCodeCoverageResults@1
117- displayName : ' Publish Code Coverage'
118- condition : succeededOrFailed()
144+ displayName : ' Publish Code Coverage to Azure DevOps'
119145 inputs :
120146 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'
123153
124154 - job : Test_Integration_2016
125155 displayName : ' Integration (Windows Server 2016)'
126156 pool :
127157 vmImage : ' vs2017-win2016'
128158 timeoutInMinutes : 0
129159 steps :
130- - task : DownloadBuildArtifacts@0
131- displayName : ' Download Build Artifact'
160+ - task : DownloadPipelineArtifact@2
161+ displayName : ' Download Pipeline Artifact'
132162 inputs :
133163 buildType : ' current'
134- downloadType : ' single'
135- artifactName : ' output'
136- downloadPath : ' $(Build.SourcesDirectory)'
164+ artifactName : $(buildArtifactName)
165+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
137166
138167 - task : PowerShell@2
139168 name : configureWinRM
@@ -163,7 +192,7 @@ stages:
163192 displayName : ' Publish Test Results'
164193 inputs :
165194 testResultsFormat : ' NUnit'
166- testResultsFiles : ' output/testResults /NUnit*.xml'
195+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
167196 testRunTitle : ' Integration (Windows Server 2016)'
168197 condition : succeededOrFailed()
169198
@@ -173,20 +202,12 @@ stages:
173202 vmImage : ' windows-2019'
174203 timeoutInMinutes : 0
175204 steps :
176- - powershell : |
177- $repositoryOwner,$repositoryName = $env:BUILD_REPOSITORY_NAME -split '/'
178- echo "##vso[task.setvariable variable=RepositoryOwner;isOutput=true]$repositoryOwner"
179- echo "##vso[task.setvariable variable=RepositoryName;isOutput=true]$repositoryName"
180- name: dscBuildVariable
181- displayName: 'Set Environment Variables'
182-
183- - task : DownloadBuildArtifacts@0
184- displayName : ' Download Build Artifact'
205+ - task : DownloadPipelineArtifact@2
206+ displayName : ' Download Pipeline Artifact'
185207 inputs :
186208 buildType : ' current'
187- downloadType : ' single'
188- artifactName : ' output'
189- downloadPath : ' $(Build.SourcesDirectory)'
209+ artifactName : $(buildArtifactName)
210+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
190211
191212 - task : PowerShell@2
192213 name : test
@@ -200,31 +221,22 @@ stages:
200221 displayName : ' Publish Test Results'
201222 inputs :
202223 testResultsFormat : ' NUnit'
203- testResultsFiles : ' output/testResults /NUnit*.xml'
224+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
204225 testRunTitle : ' Unit (Windows Server 2019)'
205226 condition : succeededOrFailed()
206227
207- - task : PublishCodeCoverageResults@1
208- displayName : ' Publish Code Coverage'
209- condition : succeededOrFailed()
210- inputs :
211- codeCoverageTool : ' JaCoCo'
212- summaryFileLocation : ' output/testResults/CodeCov*.xml'
213- pathToSources : ' $(Build.SourcesDirectory)/output/$(dscBuildVariable.RepositoryName)'
214-
215228 - job : Test_Integration_2019
216229 displayName : ' Integration (Windows Server 2019)'
217230 pool :
218231 vmImage : ' windows-2019'
219232 timeoutInMinutes : 0
220233 steps :
221- - task : DownloadBuildArtifacts@0
222- displayName : ' Download Build Artifact'
234+ - task : DownloadPipelineArtifact@2
235+ displayName : ' Download Pipeline Artifact'
223236 inputs :
224237 buildType : ' current'
225- downloadType : ' single'
226- artifactName : ' output'
227- downloadPath : ' $(Build.SourcesDirectory)'
238+ artifactName : $(buildArtifactName)
239+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
228240
229241 - task : PowerShell@2
230242 name : configureWinRM
@@ -254,7 +266,7 @@ stages:
254266 displayName : ' Publish Test Results'
255267 inputs :
256268 testResultsFormat : ' NUnit'
257- testResultsFiles : ' output/testResults /NUnit*.xml'
269+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
258270 testRunTitle : ' Integration (Windows Server 2019)'
259271 condition : succeededOrFailed()
260272
@@ -275,13 +287,12 @@ stages:
275287 pool :
276288 vmImage : ' ubuntu 16.04'
277289 steps :
278- - task : DownloadBuildArtifacts@0
279- displayName : ' Download Build Artifact'
290+ - task : DownloadPipelineArtifact@2
291+ displayName : ' Download Pipeline Artifact'
280292 inputs :
281293 buildType : ' current'
282- downloadType : ' single'
283- artifactName : ' output'
284- downloadPath : ' $(Build.SourcesDirectory)'
294+ artifactName : $(buildArtifactName)
295+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
285296
286297 - task : PowerShell@2
287298 name : publishRelease
0 commit comments