Skip to content

Commit d34e800

Browse files
authored
Use matrix strategy and add 2025 image (#535)
1 parent 3cacd0c commit d34e800

File tree

4 files changed

+71
-92
lines changed

4 files changed

+71
-92
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
- Updated pipeline files to match current DSC Community patterns - fixes [Issue #528](https://github.com/dsccommunity/NetworkingDsc/issues/528).
1818
- Updated HQRM and build steps to use windows-latest image.
1919
- Update build pipeline to pin GitVersion v5.
20+
- Added Server 2025 into Unit and Integration tests.
21+
- Remove duplicated pipeline steps and use matrix of VM images.
22+
- Use ModuleFast
23+
- Merge Unit test CodeCoverage
2024
- Tests
2125
- Update to use Pester 5.
2226
- `New-InvalidArgumentException` change to `New-ArgumentException` for HQRM.
@@ -31,7 +35,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3135
- Remove `DisplayGroup` property when creating new firewall rule.
3236
- `Test-RuleProperties`
3337
- Fixed `Convert-CIDRToSubnetMask` function call typo.
34-
-
3538

3639
### Removed
3740

Resolve-Dependency.psd1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
@{
2-
Gallery = 'PSGallery'
3-
AllowPrerelease = $false
4-
WithYAML = $true
2+
Gallery = 'PSGallery'
3+
AllowPrerelease = $false
4+
WithYAML = $true
55

6-
#UseModuleFast = $true
6+
UseModuleFast = $true
77
#ModuleFastVersion = '0.1.2'
88
#ModuleFastBleedingEdge = $true
99

10-
UsePSResourceGet = $true
10+
UsePSResourceGet = $true
1111
#PSResourceGetVersion = '1.0.1'
1212

13-
UsePowerShellGetCompatibilityModule = $true
13+
UsePowerShellGetCompatibilityModule = $true
1414
UsePowerShellGetCompatibilityModuleVersion = '3.0.23-beta23'
1515
}

azure-pipelines.yml

Lines changed: 47 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,15 @@ stages:
5454
publishLocation: 'pipeline'
5555
parallel: true
5656

57-
- stage: Test
57+
- stage: Quality_Test_and_Unit_Test
58+
displayName: 'Quality Test and Unit Test'
5859
dependsOn: Build
5960
jobs:
6061
- job: Test_HQRM
6162
displayName: 'HQRM'
6263
pool:
6364
vmImage: 'windows-latest'
64-
timeoutInMinutes: 0
65+
timeoutInMinutes: '0'
6566
steps:
6667
- task: DownloadPipelineArtifact@2
6768
displayName: 'Download Pipeline Artifact'
@@ -86,11 +87,19 @@ stages:
8687
testRunTitle: 'HQRM'
8788
condition: succeededOrFailed()
8889

89-
- job: Test_Unit_2019
90-
displayName: 'Unit (Windows Server 2019)'
90+
- job: Test_Unit
91+
displayName: 'Unit'
92+
strategy:
93+
matrix:
94+
Windows Server 2019:
95+
vmImage: 'windows-2019'
96+
Windows Server 2022:
97+
vmImage: 'windows-2022'
98+
Windows Server 2025:
99+
vmImage: 'windows-2025'
91100
pool:
92-
vmImage: 'windows-2019'
93-
timeoutInMinutes: 0
101+
vmImage: $(vmImage)
102+
timeoutInMinutes: '0'
94103
steps:
95104
- task: DownloadPipelineArtifact@2
96105
displayName: 'Download Pipeline Artifact'
@@ -112,22 +121,21 @@ stages:
112121
inputs:
113122
testResultsFormat: 'NUnit'
114123
testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'
115-
testRunTitle: 'Unit (Windows Server 2019)'
124+
testRunTitle: 'Unit $(vmImage)'
116125
condition: succeededOrFailed()
117126

118127
- task: PublishPipelineArtifact@1
119128
displayName: 'Publish Test Artifact'
120129
inputs:
121130
targetPath: '$(buildFolderName)/$(testResultFolderName)/'
122-
artifactName: $(testArtifactName)
123-
parallel: true
131+
artifactName: '$(testArtifactName)_$(vmImage)'
124132

125133
- job: Code_Coverage
126134
displayName: 'Publish Code Coverage'
127-
dependsOn: Test_Unit_2019
135+
dependsOn: Test_Unit
128136
pool:
129137
vmImage: 'ubuntu-latest'
130-
timeoutInMinutes: 0
138+
timeoutInMinutes: '0'
131139
steps:
132140
- task: DownloadPipelineArtifact@2
133141
displayName: 'Download Pipeline Artifact'
@@ -140,9 +148,16 @@ stages:
140148
displayName: 'Download Test Artifact'
141149
inputs:
142150
buildType: 'current'
143-
artifactName: $(testArtifactName)
144151
targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)'
145152

153+
- task: PowerShell@2
154+
name: merge
155+
displayName: 'Merge Code Coverage files'
156+
inputs:
157+
filePath: './build.ps1'
158+
arguments: '-tasks merge'
159+
pwsh: true
160+
146161
- task: PublishCodeCoverageResults@1
147162
displayName: 'Publish Code Coverage to Azure DevOps'
148163
inputs:
@@ -154,77 +169,23 @@ stages:
154169
bash <(curl -s https://codecov.io/bash) -f "./$(buildFolderName)/$(testResultFolderName)/JaCoCo_coverage.xml"
155170
displayName: 'Publish Code Coverage to Codecov.io'
156171
157-
- job: Test_Integration_2019
158-
displayName: 'Integration (Windows Server 2019)'
159-
pool:
160-
vmImage: 'windows-2019'
161-
timeoutInMinutes: 0
162-
steps:
163-
- task: DownloadPipelineArtifact@2
164-
displayName: 'Download Pipeline Artifact'
165-
inputs:
166-
buildType: 'current'
167-
artifactName: $(buildArtifactName)
168-
targetPath: '$(Build.SourcesDirectory)/$(buildArtifactName)'
169-
170-
- task: PowerShell@2
171-
name: configureWinRM
172-
displayName: 'Configure WinRM'
173-
inputs:
174-
targetType: 'inline'
175-
script: 'winrm quickconfig -quiet'
176-
pwsh: false
177-
178-
- task: PowerShell@2
179-
name: test
180-
displayName: 'Run Integration Test'
181-
inputs:
182-
filePath: './build.ps1'
183-
arguments: "-Tasks test -PesterScript 'tests/Integration' -CodeCoverageThreshold 0"
184-
pwsh: false
185-
186-
- task: PublishTestResults@2
187-
displayName: 'Publish Test Results'
188-
inputs:
189-
testResultsFormat: 'NUnit'
190-
testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'
191-
testRunTitle: 'Integration (Windows Server 2019)'
192-
condition: succeededOrFailed()
193-
194-
- job: Test_Unit_2022
195-
displayName: 'Unit (Windows Server 2022)'
196-
pool:
197-
vmImage: 'windows-2022'
198-
timeoutInMinutes: 0
199-
steps:
200-
- task: DownloadPipelineArtifact@2
201-
displayName: 'Download Pipeline Artifact'
202-
inputs:
203-
buildType: 'current'
204-
artifactName: $(buildArtifactName)
205-
targetPath: '$(Build.SourcesDirectory)/$(buildArtifactName)'
206-
207-
- task: PowerShell@2
208-
name: test
209-
displayName: 'Run Unit Test'
210-
inputs:
211-
filePath: './build.ps1'
212-
arguments: "-Tasks test -PesterScript 'tests/Unit'"
213-
pwsh: true
214-
215-
- task: PublishTestResults@2
216-
displayName: 'Publish Test Results'
217-
inputs:
218-
testResultsFormat: 'NUnit'
219-
testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'
220-
testRunTitle: 'Unit (Windows Server 2022)'
221-
condition: succeededOrFailed()
222-
223-
- job: Test_Integration_2022
224-
displayName: 'Integration (Windows Server 2022)'
172+
- stage: Integration_Test
173+
displayName: 'Integration Test'
174+
dependsOn: Quality_Test_and_Unit_Test
175+
jobs:
176+
- job: Test_Integration
177+
displayName: 'Integration'
178+
strategy:
179+
matrix:
180+
Windows Server 2019:
181+
vmImage: 'windows-2019'
182+
Windows Server 2022:
183+
vmImage: 'windows-2022'
184+
Windows Server 2025:
185+
vmImage: 'windows-2025'
225186
pool:
226-
vmImage: 'windows-2022'
227-
timeoutInMinutes: 0
187+
vmImage: $(vmImage)
188+
timeoutInMinutes: '0'
228189
steps:
229190
- task: DownloadPipelineArtifact@2
230191
displayName: 'Download Pipeline Artifact'
@@ -254,11 +215,13 @@ stages:
254215
inputs:
255216
testResultsFormat: 'NUnit'
256217
testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'
257-
testRunTitle: 'Integration (Windows Server 2022)'
218+
testRunTitle: 'Integration $(testRunTitle)'
258219
condition: succeededOrFailed()
259220

260221
- stage: Deploy
261-
dependsOn: Test
222+
dependsOn:
223+
- Quality_Test_and_Unit_Test
224+
- Integration_Test
262225
condition: |
263226
and(
264227
succeeded(),

build.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ BuildWorkflow:
3333
- Convert_Pester_Coverage
3434
- Pester_If_Code_Coverage_Under_Threshold
3535

36+
merge:
37+
- Merge_CodeCoverage_Files
38+
3639
publish:
3740
- publish_module_to_gallery
3841
- Publish_Release_To_GitHub
@@ -101,7 +104,6 @@ Pester:
101104
CIFormat: Auto
102105
CodeCoverage:
103106
CoveragePercentTarget: 80
104-
OutputPath: JaCoCo_coverage.xml
105107
OutputEncoding: ascii
106108
UseBreakpoints: false
107109
TestResult:
@@ -110,6 +112,17 @@ Pester:
110112
ExcludeFromCodeCoverage:
111113
- Modules/DscResource.Common
112114

115+
####################################################
116+
# Code Coverage Configuration #
117+
####################################################
118+
119+
CodeCoverage:
120+
# Filename of the file that will be outputted by the task Merge_CodeCoverage_Files.
121+
CodeCoverageMergedOutputFile: JaCoCo_coverage.xml
122+
# File pattern used to search for files under the ./output/testResults folder
123+
# by task Merge_CodeCoverage_Files.
124+
CodeCoverageFilePattern: Codecov*.xml
125+
113126
####################################################
114127
# Pester Configuration (DscResource.Test) #
115128
####################################################

0 commit comments

Comments
 (0)