@@ -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
@@ -155,7 +184,7 @@ stages:
155184 displayName : ' Publish Test Results'
156185 inputs :
157186 testResultsFormat : ' NUnit'
158- testResultsFiles : ' output/testResults /NUnit*.xml'
187+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
159188 testRunTitle : ' Integration (Windows Server 2016)'
160189 condition : succeededOrFailed()
161190
@@ -165,20 +194,12 @@ stages:
165194 vmImage : ' windows-2019'
166195 timeoutInMinutes : 0
167196 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'
177199 inputs :
178200 buildType : ' current'
179- downloadType : ' single'
180- artifactName : ' output'
181- downloadPath : ' $(Build.SourcesDirectory)'
201+ artifactName : $(buildArtifactName)
202+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
182203
183204 - task : PowerShell@2
184205 name : test
@@ -192,31 +213,22 @@ stages:
192213 displayName : ' Publish Test Results'
193214 inputs :
194215 testResultsFormat : ' NUnit'
195- testResultsFiles : ' output/testResults /NUnit*.xml'
216+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
196217 testRunTitle : ' Unit (Windows Server 2019)'
197218 condition : succeededOrFailed()
198219
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-
207220 - job : Test_Integration_2019
208221 displayName : ' Integration (Windows Server 2019)'
209222 pool :
210223 vmImage : ' windows-2019'
211224 timeoutInMinutes : 0
212225 steps :
213- - task : DownloadBuildArtifacts@0
214- displayName : ' Download Build Artifact'
226+ - task : DownloadPipelineArtifact@2
227+ displayName : ' Download Pipeline Artifact'
215228 inputs :
216229 buildType : ' current'
217- downloadType : ' single'
218- artifactName : ' output'
219- downloadPath : ' $(Build.SourcesDirectory)'
230+ artifactName : $(buildArtifactName)
231+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
220232
221233 - task : PowerShell@2
222234 name : configureWinRM
@@ -238,7 +250,7 @@ stages:
238250 displayName : ' Publish Test Results'
239251 inputs :
240252 testResultsFormat : ' NUnit'
241- testResultsFiles : ' output/testResults /NUnit*.xml'
253+ testResultsFiles : ' $(buildFolderName)/$(testResultFolderName) /NUnit*.xml'
242254 testRunTitle : ' Integration (Windows Server 2019)'
243255 condition : succeededOrFailed()
244256
@@ -259,13 +271,12 @@ stages:
259271 pool :
260272 vmImage : ' ubuntu 16.04'
261273 steps :
262- - task : DownloadBuildArtifacts@0
263- displayName : ' Download Build Artifact'
274+ - task : DownloadPipelineArtifact@2
275+ displayName : ' Download Pipeline Artifact'
264276 inputs :
265277 buildType : ' current'
266- downloadType : ' single'
267- artifactName : ' output'
268- downloadPath : ' $(Build.SourcesDirectory)'
278+ artifactName : $(buildArtifactName)
279+ targetPath : ' $(Build.SourcesDirectory)/$(buildArtifactName)'
269280
270281 - task : PowerShell@2
271282 name : publishRelease
0 commit comments