-
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathMailozaurr.AzurePipelines.yml
More file actions
310 lines (269 loc) · 9.76 KB
/
Mailozaurr.AzurePipelines.yml
File metadata and controls
310 lines (269 loc) · 9.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
trigger: none
pr: none
variables:
buildConfiguration: 'Debug'
dotNetVersion: '8.x'
stages:
# .NET Testing Stage - Core functionality testing
- stage: DotNetTests
displayName: '.NET Build & Test'
jobs:
- job: DotNet_Windows
displayName: '.NET Tests - Windows'
pool:
vmImage: 'windows-latest'
steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: $(dotNetVersion)
- task: DotNetCoreCLI@2
displayName: 'Restore .NET Dependencies'
inputs:
command: 'restore'
projects: 'Sources/Mailozaurr.sln'
- task: DotNetCoreCLI@2
displayName: 'Build .NET Solution'
inputs:
command: 'build'
projects: 'Sources/Mailozaurr.sln'
arguments: '--configuration $(buildConfiguration) --no-restore'
- task: DotNetCoreCLI@2
displayName: 'Run .NET Tests'
inputs:
command: 'test'
projects: 'Sources/Mailozaurr.sln'
arguments: '--configuration $(buildConfiguration) --no-build --logger trx --collect:"XPlat Code Coverage"'
- task: PublishTestResults@2
displayName: 'Publish .NET Test Results'
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '**/*.trx'
mergeTestResults: true
condition: succeededOrFailed()
- job: DotNet_Ubuntu
displayName: '.NET Tests - Ubuntu'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: $(dotNetVersion)
- script: |
sudo apt-get update
sudo apt-get install -y mono-complete
displayName: 'Install Mono for .NET Framework tests'
- task: DotNetCoreCLI@2
displayName: 'Restore .NET Dependencies'
inputs:
command: 'restore'
projects: 'Sources/Mailozaurr.sln'
- task: DotNetCoreCLI@2
displayName: 'Build .NET Solution'
inputs:
command: 'build'
projects: 'Sources/Mailozaurr.sln'
arguments: '--configuration $(buildConfiguration) --no-restore'
- task: DotNetCoreCLI@2
displayName: 'Run .NET Tests'
inputs:
command: 'test'
projects: 'Sources/Mailozaurr.sln'
arguments: '--configuration $(buildConfiguration) --no-build --logger trx'
- job: DotNet_MacOS
displayName: '.NET Tests - macOS'
pool:
vmImage: 'macos-latest'
steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: $(dotNetVersion)
- script: |
brew update
brew install mono
displayName: 'Install Mono for .NET Framework tests'
- task: DotNetCoreCLI@2
displayName: 'Restore .NET Dependencies'
inputs:
command: 'restore'
projects: 'Sources/Mailozaurr.sln'
- task: DotNetCoreCLI@2
displayName: 'Build .NET Solution'
inputs:
command: 'build'
projects: 'Sources/Mailozaurr.sln'
arguments: '--configuration $(buildConfiguration) --no-restore'
- task: DotNetCoreCLI@2
displayName: 'Run .NET Tests'
inputs:
command: 'test'
projects: 'Sources/Mailozaurr.sln'
arguments: '--configuration $(buildConfiguration) --no-build --logger trx'
# PowerShell Testing Stage - Module integration testing (independent of .NET stage)
- stage: PowerShellTests
displayName: 'PowerShell Module Tests'
condition: always()
jobs:
- job: PowerShell_Windows_PS5
displayName: 'PowerShell 5.1 - Windows'
pool:
vmImage: 'windows-latest'
steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: $(dotNetVersion)
- task: DotNetCoreCLI@2
displayName: 'Build .NET Solution'
inputs:
command: 'build'
projects: 'Sources/Mailozaurr.sln'
arguments: '--configuration $(buildConfiguration)'
- powershell: |
Write-Host "PowerShell Version: $($PSVersionTable.PSVersion)"
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSWriteColor -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
displayName: "Install Required PowerShell Modules"
- powershell: |
.\Mailozaurr.Tests.ps1
displayName: "Run PowerShell Tests (PS 5.1)"
- job: PowerShell_Windows_PS7
displayName: 'PowerShell 7 - Windows'
pool:
vmImage: 'windows-latest'
steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: $(dotNetVersion)
- task: DotNetCoreCLI@2
displayName: 'Build .NET Solution'
inputs:
command: 'build'
projects: 'Sources/Mailozaurr.sln'
arguments: '--configuration $(buildConfiguration)'
- pwsh: |
Write-Host "PowerShell Version: $($PSVersionTable.PSVersion)"
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSWriteColor -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
displayName: "Install Required PowerShell Modules"
- pwsh: |
.\Mailozaurr.Tests.ps1
displayName: "Run PowerShell Tests (PS 7)"
- job: PowerShell_Ubuntu
displayName: 'PowerShell 7 - Ubuntu'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: $(dotNetVersion)
- script: |
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list
sudo apt-get update
sudo apt-get install -y powershell
displayName: "Install PowerShell Core"
- script: sudo apt-get install -y mono-complete
displayName: 'Install Mono for .NET Framework tests'
- task: DotNetCoreCLI@2
displayName: 'Build .NET Solution'
inputs:
command: 'build'
projects: 'Sources/Mailozaurr.sln'
arguments: '--configuration $(buildConfiguration)'
- task: PowerShell@2
displayName: 'Install Required PowerShell Modules'
inputs:
targetType: 'inline'
script: |
Write-Host "PowerShell Version: $($PSVersionTable.PSVersion)"
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSWriteColor -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
- task: PowerShell@2
displayName: 'Run PowerShell Tests'
inputs:
targetType: 'filePath'
filePath: './Mailozaurr.Tests.ps1'
- job: PowerShell_MacOS
displayName: 'PowerShell 7 - macOS'
pool:
vmImage: 'macos-latest'
steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: $(dotNetVersion)
- bash: |
brew install --cask powershell
displayName: "Install PowerShell 7"
- bash: brew install mono
displayName: 'Install Mono for .NET Framework tests'
- task: DotNetCoreCLI@2
displayName: 'Build .NET Solution'
inputs:
command: 'build'
projects: 'Sources/Mailozaurr.sln'
arguments: '--configuration $(buildConfiguration)'
- task: PowerShell@2
displayName: 'Install Required PowerShell Modules'
inputs:
targetType: 'inline'
script: |
Write-Host "PowerShell Version: $($PSVersionTable.PSVersion)"
Install-Module -Name Pester -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
Install-Module -Name PSWriteColor -Repository PSGallery -Force -SkipPublisherCheck -AllowClobber
- task: PowerShell@2
displayName: 'Run PowerShell Tests'
inputs:
targetType: 'filePath'
filePath: './Mailozaurr.Tests.ps1'
# Packaging Stage - Only runs if .NET tests pass (PowerShell tests can fail)
- stage: Package
displayName: 'Package Libraries'
dependsOn: DotNetTests
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/v2-speedygonzales'))
jobs:
- job: Package
displayName: 'Create Library Package'
pool:
vmImage: 'windows-latest'
steps:
- task: UseDotNet@2
displayName: 'Install .NET SDK'
inputs:
packageType: 'sdk'
version: $(dotNetVersion)
- task: DotNetCoreCLI@2
displayName: 'Build Release'
inputs:
command: 'build'
projects: 'Sources/Mailozaurr.sln'
arguments: '--configuration $(buildConfiguration)'
- powershell: |
if (-not (Test-Path "Libraries")) {
New-Item -Path "Libraries" -ItemType Directory -Force
}
$SourcePath = "Sources\Mailozaurr\bin\Release"
if (Test-Path $SourcePath) {
Copy-Item -Path "$SourcePath\*" -Destination "Libraries" -Recurse -Force
Write-Host "Copied .NET assemblies to Libraries directory"
}
Write-Host "PowerShell module packaging should be done via Build/Manage-Mailozaurr.ps1"
displayName: "Copy .NET Libraries"
- task: PublishBuildArtifacts@1
displayName: 'Publish .NET Libraries'
inputs:
PathtoPublish: 'Libraries'
ArtifactName: 'Mailozaurr-Libraries'
publishLocation: 'Container'