-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Expand file tree
/
Copy pathdaily-build.yml
More file actions
229 lines (220 loc) · 7.36 KB
/
daily-build.yml
File metadata and controls
229 lines (220 loc) · 7.36 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
# Please don't use ADO UI defined scheduled triggers because it takes precedence over YAML scheduled triggers.
# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/scheduled-triggers
variables:
today: $(Get-Date -Format yyyyMMddhhmmss)
schedules:
- cron: "0 18 * * *"
displayName: 2:00 AM (UTC + 8:00) China Daily Build
branches:
include:
- main
pr: none
jobs:
- job: DailyBuild
timeoutInMinutes: 360
pool: pool-windows-2019
steps:
- task: PowerShell@2
displayName: 'Initialization'
inputs:
targetType: 'inline'
script: |
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
# Avoid issue of filename too long
git config --global core.longpaths true
# Wipe any changes from a previous branch
git clean -xdf
- task: UseDotNet@2
displayName: 'Use .NET SDK'
inputs:
packageType: sdk
version: 8.x
- task: PowerShell@2
displayName: Prepare Powershell $(PSVersion)
inputs:
filePath: 'tools/Test/SmokeTest/PrepareRequiredPowershell.ps1'
arguments: '-RequiredPsVersion $(PSVersion)'
- task: PowerShell@2
displayName: 'Install platyPS'
inputs:
targetType: 'inline'
script: |
$command = "`$PSVersionTable `
Install-Module platyPS -Force -Confirm:`$false -Scope CurrentUser `
Exit"
dotnet tool run pwsh -c $command
- task: PowerShell@2
displayName: 'Build for Bumping Version'
inputs:
targetType: inline
pwsh: true
script: |
$buildScript = Join-Path "$(Build.SourcesDirectory)" 'tools' 'BuildScripts' 'BuildModules.ps1'
& $buildScript -RepoRoot "$(Build.SourcesDirectory)" -Configuration Release -EnableTestCoverage -InvokedByPipeline
- task: PowerShell@2
displayName: 'Bump Version'
inputs:
targetType: 'inline'
script: |
$command = "`$PSVersionTable `
Get-PSRepository `
./tools/RunVersionController.ps1 -Release 'Daily Build $(today)' -ReleaseType $(ReleaseType)`
Exit"
dotnet tool run pwsh -c $command
- task: PowerShell@2
displayName: 'Clean artifacts folder'
inputs:
targetType: 'inline'
script: |
Remove-Item -Force -Recurse -Path artifacts
- task: PowerShell@2
displayName: 'Build after Version Bump up'
inputs:
targetType: inline
pwsh: true
script: |
$buildScript = Join-Path "$(Build.SourcesDirectory)" 'tools' 'BuildScripts' 'BuildModules.ps1'
& $buildScript -ModifiedModule -RepoRoot "$(Build.SourcesDirectory)" -Configuration Release -EnableTestCoverage -InvokedByPipeline
- task: EsrpCodeSigning@5
displayName: "Sign Dll [Authenticode + Strong Name]"
inputs:
ConnectedServiceName: '$(ESRPServiceConnectionName)'
AppRegistrationClientId: '$(ESRPAppClientId)'
AppRegistrationTenantId: '$(ESRPAppTenantId)'
AuthAKVName: '$(ESRPKVName)'
AuthCertName: '$(ESRPAuthCertName)'
AuthSignCertName: '$(ESRPSignCertName)'
FolderPath: 'artifacts'
Pattern: |
Release/**/Microsoft*Azure*PowerShell*.dll
Release/**/Az.*.private.dll
Release/**/Microsoft.Azure.Commands.*.AlcWrapper.dll
InstallerChecks.dll
UseMinimatch: true
signConfigType: 'inlineSignParams'
inlineOperation: |
[
{
"KeyCode": "CP-233863-SN",
"OperationCode": "StrongNameSign",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
},
{
"KeyCode": "CP-233863-SN",
"OperationCode": "StrongNameVerify",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
},
{
"KeyCode": "CP-230012",
"OperationCode": "SigntoolSign",
"Parameters": {
"OpusName": "Microsoft",
"OpusInfo": "http://www.microsoft.com",
"FileDigest": "/fd \"SHA256\"",
"PageHash": "/NPH",
"TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
},
"ToolName": "sign",
"ToolVersion": "1.0"
},
{
"KeyCode": "CP-230012",
"OperationCode": "SigntoolVerify",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
}
]
SessionTimeout: '60'
MaxConcurrency: '50'
MaxRetryAttempts: '5'
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5
displayName: "Sign Scripts [Authenticode]"
inputs:
ConnectedServiceName: '$(ESRPServiceConnectionName)'
AppRegistrationClientId: '$(ESRPAppClientId)'
AppRegistrationTenantId: '$(ESRPAppTenantId)'
AuthAKVName: '$(ESRPKVName)'
AuthCertName: '$(ESRPAuthCertName)'
AuthSignCertName: '$(ESRPSignCertName)'
FolderPath: 'artifacts'
Pattern: |
Release/**/*.ps1
Release/**/*.psm1
Release/**/*.ps1xml
Release/**/*.js
InstallModule.ps1
UseMinimatch: true
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode": "CP-230012",
"OperationCode": "SigntoolSign",
"Parameters": {
"OpusName": "Microsoft",
"OpusInfo": "http://www.microsoft.com",
"FileDigest": "/fd \"SHA256\"",
"PageHash": "/NPH",
"TimeStamp": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
},
"ToolName": "sign",
"ToolVersion": "1.0"
},
{
"KeyCode": "CP-230012",
"OperationCode": "SigntoolVerify",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
}
]
- task: EsrpCodeSigning@5
displayName: 'Sign 3rd Party [Strong Name]'
inputs:
ConnectedServiceName: '$(ESRPServiceConnectionName)'
AppRegistrationClientId: '$(ESRPAppClientId)'
AppRegistrationTenantId: '$(ESRPAppTenantId)'
AuthAKVName: '$(ESRPKVName)'
AuthCertName: '$(ESRPAuthCertName)'
AuthSignCertName: '$(ESRPSignCertName)'
FolderPath: artifacts
Pattern: 'Release/**/FuzzySharp.dll'
UseMinimatch: true
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode": "CP-233863-SN",
"OperationCode": "StrongNameSign",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
},
{
"KeyCode": "CP-233863-SN",
"OperationCode": "StrongNameVerify",
"Parameters": {},
"ToolName": "sign",
"ToolVersion": "1.0"
}
]
SessionTimeout: '60'
MaxConcurrency: '50'
MaxRetryAttempts: '5'
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: custom
custom: msbuild
arguments: 'build.proj /t:Publish /p:Configuration=Release;NuGetKey=$(NuGetKey)'
- task: PublishPipelineArtifact@0
displayName: 'Save artifacts'
inputs:
artifactName: artifacts
targetPath: artifacts
condition: succeededOrFailed()