@@ -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
@@ -87,12 +94,13 @@ stages:
8794 echo "##vso[task.setvariable variable=RepositoryOwner;isOutput=true]$repositoryOwner"
8895 echo "##vso[task.setvariable variable=RepositoryName;isOutput=true]$repositoryName"
8996 name: dscBuildVariable
90- - task : DownloadBuildArtifacts@0
97+
98+ - task : DownloadPipelineArtifact@2
99+ displayName : ' Download Pipeline Artifact'
91100 inputs :
92101 buildType : ' current'
93- downloadType : ' single'
94- artifactName : ' output'
95- downloadPath : ' $(Build.SourcesDirectory)'
102+ artifactName : $(buildArtifactName)
103+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
96104
97105 - task : PowerShell@2
98106 name : test
@@ -106,31 +114,61 @@ stages:
106114 displayName : ' Publish Test Results'
107115 inputs :
108116 testResultsFormat : ' NUnit'
109- testResultsFiles : ' output/testResults /NUnit*.xml'
117+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
110118 testRunTitle : ' Unit (Windows Server 2016)'
111119 condition : succeededOrFailed()
112120
121+ - task : PublishPipelineArtifact@1
122+ displayName : ' Publish Test Artifact'
123+ inputs :
124+ targetPath : ' $(buildFolderName)/$(testResultFolderName)/'
125+ artifactName : $(testArtifactName)
126+ parallel : true
127+
128+ - job : Code_Coverage
129+ displayName : ' Publish Code Coverage'
130+ dependsOn : Test_Unit_2016
131+ pool :
132+ vmImage : ' ubuntu 16.04'
133+ timeoutInMinutes : 0
134+ steps :
135+ - task : DownloadPipelineArtifact@2
136+ displayName : ' Download Pipeline Artifact'
137+ inputs :
138+ buildType : ' current'
139+ artifactName : $(buildArtifactName)
140+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
141+
142+ - task : DownloadPipelineArtifact@2
143+ displayName : ' Download Test Artifact'
144+ inputs :
145+ buildType : ' current'
146+ artifactName : $(testArtifactName)
147+ targetPath : ' $(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)'
148+
113149 - task : PublishCodeCoverageResults@1
114- displayName : ' Publish Code Coverage'
115- condition : succeededOrFailed()
150+ displayName : ' Publish Code Coverage to Azure DevOps'
116151 inputs :
117152 codeCoverageTool : ' JaCoCo'
118- summaryFileLocation : ' output/testResults/CodeCov*.xml'
119- pathToSources : ' $(Build.SourcesDirectory)/output/$(dscBuildVariable.RepositoryName)'
153+ summaryFileLocation : ' $(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml'
154+ pathToSources : ' $(Build.SourcesDirectory)/$(sourceFolderName)/'
155+
156+ - script : |
157+ bash <(curl -s https://codecov.io/bash) -f "./$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml"
158+ displayName: 'Publish Code Coverage to Codecov.io'
120159
121160 - job : Test_Integration_2016
122161 displayName : ' Integration (Windows Server 2016)'
123162 pool :
124163 vmImage : ' vs2017-win2016'
125164 timeoutInMinutes : 0
126165 steps :
127- - task : DownloadBuildArtifacts@0
128- displayName : ' Download Build Artifact'
166+ - task : DownloadPipelineArtifact@2
167+ displayName : ' Download Pipeline Artifact'
129168 inputs :
130169 buildType : ' current'
131- downloadType : ' single'
132- artifactName : ' output'
133- downloadPath : ' $(Build.SourcesDirectory)'
170+ artifactName : $(buildArtifactName)
171+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
134172
135173 - task : PowerShell@2
136174 name : configureWinRM
@@ -152,7 +190,7 @@ stages:
152190 displayName : ' Publish Test Results'
153191 inputs :
154192 testResultsFormat : ' NUnit'
155- testResultsFiles : ' output/testResults /NUnit*.xml'
193+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
156194 testRunTitle : ' Integration (Windows Server 2016)'
157195 condition : succeededOrFailed()
158196
@@ -167,12 +205,13 @@ stages:
167205 echo "##vso[task.setvariable variable=RepositoryOwner;isOutput=true]$repositoryOwner"
168206 echo "##vso[task.setvariable variable=RepositoryName;isOutput=true]$repositoryName"
169207 name: dscBuildVariable
170- - task : DownloadBuildArtifacts@0
208+
209+ - task : DownloadPipelineArtifact@2
210+ displayName : ' Download Pipeline Artifact'
171211 inputs :
172212 buildType : ' current'
173- downloadType : ' single'
174- artifactName : ' output'
175- downloadPath : ' $(Build.SourcesDirectory)'
213+ artifactName : $(buildArtifactName)
214+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
176215
177216 - task : PowerShell@2
178217 name : test
@@ -186,31 +225,22 @@ stages:
186225 displayName : ' Publish Test Results'
187226 inputs :
188227 testResultsFormat : ' NUnit'
189- testResultsFiles : ' output/testResults /NUnit*.xml'
228+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
190229 testRunTitle : ' Unit (Windows Server 2019)'
191230 condition : succeededOrFailed()
192231
193- - task : PublishCodeCoverageResults@1
194- displayName : ' Publish Code Coverage'
195- condition : succeededOrFailed()
196- inputs :
197- codeCoverageTool : ' JaCoCo'
198- summaryFileLocation : ' output/testResults/CodeCov*.xml'
199- pathToSources : ' $(Build.SourcesDirectory)/output/$(dscBuildVariable.RepositoryName)'
200-
201232 - job : Test_Integration_2019
202233 displayName : ' Integration (Windows Server 2019)'
203234 pool :
204235 vmImage : ' windows-2019'
205236 timeoutInMinutes : 0
206237 steps :
207- - task : DownloadBuildArtifacts@0
208- displayName : ' Download Build Artifact'
238+ - task : DownloadPipelineArtifact@2
239+ displayName : ' Download Pipeline Artifact'
209240 inputs :
210241 buildType : ' current'
211- downloadType : ' single'
212- artifactName : ' output'
213- downloadPath : ' $(Build.SourcesDirectory)'
242+ artifactName : $(buildArtifactName)
243+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
214244
215245 - task : PowerShell@2
216246 name : configureWinRM
@@ -232,7 +262,7 @@ stages:
232262 displayName : ' Publish Test Results'
233263 inputs :
234264 testResultsFormat : ' NUnit'
235- testResultsFiles : ' output/testResults /NUnit*.xml'
265+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
236266 testRunTitle : ' Integration (Windows Server 2019)'
237267 condition : succeededOrFailed()
238268
@@ -253,13 +283,12 @@ stages:
253283 pool :
254284 vmImage : ' ubuntu 16.04'
255285 steps :
256- - task : DownloadBuildArtifacts@0
257- displayName : ' Download Build Artifact'
286+ - task : DownloadPipelineArtifact@2
287+ displayName : ' Download Pipeline Artifact'
258288 inputs :
259289 buildType : ' current'
260- downloadType : ' single'
261- artifactName : ' output'
262- downloadPath : ' $(Build.SourcesDirectory)'
290+ artifactName : $(buildArtifactName)
291+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
263292
264293 - task : PowerShell@2
265294 name : publishRelease
0 commit comments