forked from microsoft/winget-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
314 lines (275 loc) · 12.3 KB
/
azure-pipelines.yml
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
310
311
312
313
314
# Commit triggers
trigger:
- master
# PR triggers
pr:
branches:
include:
- master
paths:
include:
- azure-pipelines.yml
- src/*
pool:
vmImage: 'windows-latest'
variables:
solution: 'src/AppInstallerCLI.sln'
buildPlatform: 'x86|x64|ARM'
buildConfiguration: 'Release'
appxPackageDir: '$(build.artifactStagingDirectory)\AppxPackages\\'
# Do not set the build version for a PR build.
jobs:
- job: 'GetReleaseTag'
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
variables:
runCodesignValidationInjection: ${{ false }}
skipComponentGovernanceDetection: ${{ true }}
steps:
- task: PowerShell@2
name: 'GetTag'
displayName: Get Release Tag
inputs:
filePath: 'src\binver\Update-BinVer.ps1'
arguments: '-OutVar'
workingDirectory: 'src'
- job: 'Build'
dependsOn: 'GetReleaseTag'
condition: always()
variables:
BuildVer: $[counter(dependencies.GetReleaseTag.outputs['GetTag.tag'], 1)]
steps:
- task: NuGetToolInstaller@1
displayName: Install Nuget
- task: NuGetCommand@2
displayName: Restore Packages
inputs:
restoreSolution: '$(solution)'
- task: DotNetCoreCLI@2
displayName: DotNet Restore
inputs:
command: 'restore'
projects: '**/*.csproj'
- task: PowerShell@2
displayName: Update Binary Version
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
inputs:
filePath: 'src\binver\Update-BinVer.ps1'
arguments: '-TargetFile binver\binver\version.h -BuildVersion $(BuildVer)'
workingDirectory: 'src'
- task: VSBuild@1
displayName: Build Solution
inputs:
platform: 'x86'
solution: '$(solution)'
configuration: '$(buildConfiguration)'
msbuildArgs: '/p:AppxBundlePlatforms="$(buildPlatform)"
/p:AppxPackageDir="$(appxPackageDir)"
/p:AppxBundle=Always
/p:UapAppxPackageBuildMode=StoreUpload'
- task: PowerShell@2
displayName: Install Tests Dependencies
inputs:
targetType: 'inline'
script: |
Add-AppxPackage AppInstallerCLIPackage_0.0.2.0_Test\Dependencies\x86\Microsoft.VCLibs.x86.14.00.Desktop.appx
Add-AppxPackage AppInstallerCLIPackage_0.0.2.0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.Desktop.appx
workingDirectory: $(appxPackageDir)
- task: VisualStudioTestPlatformInstaller@1
displayName: Prepare VSTest for E2E Tests
inputs:
packageFeedSelector: 'nugetOrg'
# TODO: Convert tests to run based on the whether things have worked up to this point
# - task: CmdLine@2
# displayName: Run Unit Tests Unpackaged x64
# inputs:
# script: |
# AppInstallerCLITests.exe -logto AICLI-Unpackaged-x64.log -s -r junit -o TEST-AppInstallerCLI-Unpackaged-x64.xml
# workingDirectory: 'src\x64\Release\AppInstallerCLITests\'
# condition: succeededOrFailed()
# - task: PublishBuildArtifacts@1
# displayName: Publish Unit Tests Unpackaged Log x64
# inputs:
# PathtoPublish: 'src\x64\Release\AppInstallerCLITests\AICLI-Unpackaged-x64.log'
# ArtifactName: 'TestPassUnpackagedLog'
# publishLocation: 'Container'
# condition: succeededOrFailed()
# - task: PublishBuildArtifacts@1
# displayName: Publish Unit Tests Unpackaged Output x64
# inputs:
# PathtoPublish: 'src\x64\Release\AppInstallerCLITests\TEST-AppInstallerCLI-Unpackaged-x64.xml'
# ArtifactName: 'TestPassUnpackagedOutput'
# publishLocation: 'Container'
# condition: succeededOrFailed()
- task: PowerShell@2
displayName: Run Unit Tests Packaged x64
inputs:
filePath: 'src\AppInstallerCLITests\Run-TestsInPackage.ps1'
arguments: '-Args "~[pips]" -BuildRoot x64\Release -PackageRoot AppInstallerCLIPackage\bin\x64\Release -LogTarget x64\Release\AICLI-Packaged-x64.log -TestResultsTarget x64\Release\TEST-AppInstallerCLI-Packaged-x64.xml -ScriptWait'
workingDirectory: 'src'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: Publish Unit Tests Packaged Log x64
inputs:
PathtoPublish: 'src\x64\Release\AICLI-Packaged-x64.log'
ArtifactName: 'TestPassPackagedLog'
publishLocation: 'Container'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: Publish Unit Tests Packaged Output x64
inputs:
PathtoPublish: 'src\x64\Release\TEST-AppInstallerCLI-Packaged-x64.xml'
ArtifactName: 'TestPassPackagedOutput'
publishLocation: 'Container'
condition: succeededOrFailed()
# - task: CmdLine@2
# displayName: Run Unit Tests Unpackaged x86
# inputs:
# script: |
# AppInstallerCLITests.exe -logto AICLI-Unpackaged-x86.log -s -r junit -o TEST-AppInstallerCLI-Unpackaged-x86.xml
# workingDirectory: 'src\x86\Release\AppInstallerCLITests\'
# condition: succeededOrFailed()
# - task: PublishBuildArtifacts@1
# displayName: Publish Unit Tests Unpackaged Log x86
# inputs:
# PathtoPublish: 'src\x86\Release\AppInstallerCLITests\AICLI-Unpackaged-x86.log'
# ArtifactName: 'TestPassUnpackagedLog'
# publishLocation: 'Container'
# condition: succeededOrFailed()
# - task: PublishBuildArtifacts@1
# displayName: Publish Unit Tests Unpackaged Output x86
# inputs:
# PathtoPublish: 'src\x86\Release\AppInstallerCLITests\TEST-AppInstallerCLI-Unpackaged-x86.xml'
# ArtifactName: 'TestPassUnpackagedOutput'
# publishLocation: 'Container'
# condition: succeededOrFailed()
- task: PowerShell@2
displayName: Run Unit Tests Packaged x86
inputs:
filePath: 'src\AppInstallerCLITests\Run-TestsInPackage.ps1'
arguments: '-Args "~[pips]" -BuildRoot x86\Release -PackageRoot AppInstallerCLIPackage\bin\x86\Release -LogTarget x86\Release\AICLI-Packaged-x86.log -TestResultsTarget x86\Release\TEST-AppInstallerCLI-Packaged-x86.xml -ScriptWait'
workingDirectory: 'src'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: Publish Unit Tests Packaged Log x86
inputs:
PathtoPublish: 'src\x86\Release\AICLI-Packaged-x86.log'
ArtifactName: 'TestPassPackagedLog'
publishLocation: 'Container'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: Publish Unit Tests Packaged Output x86
inputs:
PathtoPublish: 'src\x86\Release\TEST-AppInstallerCLI-Packaged-x86.xml'
ArtifactName: 'TestPassPackagedOutput'
publishLocation: 'Container'
condition: succeededOrFailed()
- task: PublishTestResults@2
displayName: Publish Unit Test Results
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/TEST-*.xml'
failTaskOnFailedTests: true
condition: succeededOrFailed()
- task: DownloadSecureFile@1
name: AppInstallerTest
displayName: 'Download Source Package Certificate'
inputs:
secureFile: 'AppInstallerTest.pfx'
- task: DownloadSecureFile@1
name: HTTPSDevCert
displayName: 'Download Kestrel Certificate'
inputs:
secureFile: 'HTTPSDevCert.pfx'
- task: MSBuild@1
displayName: Build MSIX Test Installer File
inputs:
platform: 'x86'
solution: 'src/AppInstallerTestMsixInstaller/AppInstallerTestMsixInstaller.wapproj'
configuration: '$(buildConfiguration)'
msbuildArguments: '/p:AppxPackageOutput="$(Build.ArtifactStagingDirectory)\AppInstallerTestMsixInstaller.msix"
/p:AppxBundle=Never
/p:UapAppxPackageBuildMode=SideLoadOnly
/p:AppxPackageSigningEnabled=false'
condition: succeededOrFailed()
- task: PowerShell@2
displayName: Install Root Certificate
inputs:
filePath: 'src\LocalhostWebServer\InstallDevCert.ps1'
arguments: '-pfxpath $(HTTPSDevCert.secureFilePath) -password microsoft'
condition: succeededOrFailed()
- task: PowerShell@2
displayName: Launch LocalhostWebServer
inputs:
filePath: 'src\LocalhostWebServer\Run-LocalhostWebServer.ps1'
arguments: '-BuildRoot $(system.defaultWorkingDirectory)\src\x86\Release\LocalhostWebServer -StaticFileRoot $(Agent.TempDirectory)\TestLocalIndex -CertPath $(HTTPSDevCert.secureFilePath) -CertPassword microsoft'
condition: succeededOrFailed()
- task: VSTest@2
displayName: Run E2E Tests Packaged x64
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: 'src\x64\Release\AppInstallerCLIE2ETests\AppInstallerCLIE2ETests.dll'
runSettingsFile: 'src\x64\Release\AppInstallerCLIE2ETests\Test.runsettings'
overrideTestrunParameters: '-PackagedContext true
-AICLIPackagePath $(system.defaultWorkingDirectory)\src\AppInstallerCLIPackage\bin\x64\Release
-AICLIPath AppInstallerCLI\AppInstallerCLI.exe
-LooseFileRegistration true
-InvokeCommandInDesktopPackage true
-StaticFileRootPath $(Agent.TempDirectory)\TestLocalIndex
-MsixTestInstallerPath $(Build.ArtifactStagingDirectory)\AppInstallerTestMsixInstaller.msix
-ExeTestInstallerPath $(system.defaultWorkingDirectory)\src\x64\Release\AppInstallerTestExeInstaller\AppInstallerTestExeInstaller.exe
-PackageCertificatePath $(AppInstallerTest.secureFilePath)'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: Publish E2E Tests Packaged x64 Log
inputs:
PathtoPublish: 'C:\Users\VssAdministrator\AppData\Local\Temp\E2ETestLogs'
ArtifactName: 'E2ETestPackagedx64Log'
publishLocation: 'Container'
condition: succeededOrFailed()
- task: VSTest@2
displayName: Run E2E Tests Packaged x86
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: 'src\x86\Release\AppInstallerCLIE2ETests\AppInstallerCLIE2ETests.dll'
runSettingsFile: 'src\x86\Release\AppInstallerCLIE2ETests\Test.runsettings'
overrideTestrunParameters: '-PackagedContext true
-AICLIPackagePath $(system.defaultWorkingDirectory)\src\AppInstallerCLIPackage\bin\x86\Release
-AICLIPath AppInstallerCLI\AppInstallerCLI.exe
-LooseFileRegistration true
-InvokeCommandInDesktopPackage true
-StaticFileRootPath $(Agent.TempDirectory)\TestLocalIndex
-MsixTestInstallerPath $(Build.ArtifactStagingDirectory)\AppInstallerTestMsixInstaller.msix
-ExeTestInstallerPath $(system.defaultWorkingDirectory)\src\x86\Release\AppInstallerTestExeInstaller\AppInstallerTestExeInstaller.exe
-PackageCertificatePath $(AppInstallerTest.secureFilePath)'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: Publish E2E Tests Packaged x86 Log
inputs:
PathtoPublish: 'C:\Users\VssAdministrator\AppData\Local\Packages\WinGetDevCLI_8wekyb3d8bbwe\LocalState\DiagOutputDir'
ArtifactName: 'E2ETestPackagedx86Log'
publishLocation: 'Container'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
displayName: Publish CLI Binary
inputs:
PathtoPublish: 'src\x64\Release\AppInstallerCLI\AppInstallerCLI.exe'
ArtifactName: 'AppInstallerCLI.exe'
publishLocation: 'Container'
- task: PublishBuildArtifacts@1
displayName: Publish Util Binary
inputs:
PathtoPublish: 'src\x64\Release\WinGetUtil\WinGetUtil.dll'
ArtifactName: 'WinGetUtil.dll'
publishLocation: 'Container'
- task: PublishBuildArtifacts@1
displayName: Publish Util Symbols
inputs:
PathtoPublish: 'src\x64\Release\WinGetUtil\WinGetUtil.pdb'
ArtifactName: 'WinGetUtil.pdb'
publishLocation: 'Container'
- task: ComponentGovernanceComponentDetection@0
displayName: Component Governance
inputs:
scanType: 'Register'
verbosity: 'Verbose'
alertWarningLevel: 'High'