-
Notifications
You must be signed in to change notification settings - Fork 4.8k
/
build-job.yml
400 lines (344 loc) · 14.9 KB
/
build-job.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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
parameters:
buildConfig: ''
osGroup: ''
archType: ''
osSubgroup: ''
platform: ''
crossBuild: false
timeoutInMinutes: 120
condition: true
shouldContinueOnError: false
container: ''
buildSteps: []
dependsOn: []
dependsOnGlobalBuild: false
dependOnEvaluatePaths: false
globalBuildSuffix: ''
variables: []
name: ''
displayName: ''
runtimeVariant: ''
pool: ''
pgoType: ''
runOnlyIfDependenciesSucceeded: false
# The target names here should match container names in the resources section in our pipelines, like runtime.yml
packageDistroList:
- target: debpkg
packageType: deb
packagingArgs: /p:BuildDebPackage=true
- target: rpmpkg
packageType: rpm
packagingArgs: /p:BuildRpmPackage=true
isOfficialBuild: false
buildFullPlatformManifest: false
liveRuntimeBuildConfig: ''
liveLibrariesBuildConfig: ''
runtimeFlavor: 'coreclr'
### Product build
jobs:
- template: /eng/common/templates/job/job.yml
parameters:
buildConfig: ${{ parameters.buildConfig }}
archType: ${{ parameters.archType }}
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
runtimeVariant: ${{ parameters.runtimeVariant }}
testGroup: ${{ parameters.testGroup }}
helixType: 'build/product/'
enableMicrobuild: true
pool: ${{ parameters.pool }}
${{ if eq(parameters.runOnlyIfDependenciesSucceeded, true) }}:
condition: and(succeeded(), ${{ parameters.condition }})
${{ if ne(parameters.runOnlyIfDependenciesSucceeded, true) }}:
condition: ${{ parameters.condition }}
dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths }}
disableClrTest: ${{ parameters.disableClrTest }}
pgoType: ${{ parameters.pgoType }}
# Compute job name from template parameters
name: ${{ format('installer_{0}_{1}_{2}_{3}_{4}_', parameters.pgoType, parameters.runtimeFlavor, parameters.runtimeVariant, coalesce(parameters.name, parameters.platform), parameters.buildConfig) }}
displayName: ${{ format('{0} Installer Build and Test {1} {2} {3} {4}', parameters.pgoType, parameters.runtimeFlavor, parameters.runtimeVariant, coalesce(parameters.name, parameters.platform), parameters.buildConfig) }}
# Run all steps in the container.
# Note that the containers are defined in platform-matrix.yml
container: ${{ parameters.container }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
crossBuild: ${{ parameters.crossBuild }}
gatherAssetManifests: true
# Component governance does not work on musl machines
${{ if eq(parameters.osSubGroup, '_musl') }}:
disableComponentGovernance: true
variables:
- ${{ each variable in parameters.variables }}:
- ${{ variable }}
- name: OfficialBuildArg
value: ''
- name: SkipTests
value: ${{ or(
not(in(parameters.archType, 'x64', 'x86')),
eq(parameters.runtimeFlavor, 'mono'),
eq(parameters.isOfficialBuild, true),
eq(parameters.crossBuild, true),
eq(parameters.pgoType, 'PGO')) }}
- name: BuildAction
value: -test
- ${{ if eq(or(not(in(parameters.archType, 'x64', 'x86')), eq(parameters.runtimeFlavor, 'mono'), eq(parameters.isOfficialBuild, true), eq(parameters.crossBuild, true), eq(parameters.pgoType, 'PGO')), true) }}:
- name: BuildAction
value: ''
- name: SignType
value: test
- name: pgoInstrumentArg
value: ''
- ${{ if eq(parameters.pgoType, 'PGO' )}}:
- name: pgoInstrumentArg
value: '-pgoinstrument '
# Set up non-PR build from internal project
- ${{ if eq(parameters.isOfficialBuild, true) }}:
- name: SignType
value: $[ coalesce(variables.OfficialSignType, 'real') ]
- name: OfficialBuildArg
value: /p:OfficialBuildId=$(Build.BuildNumber)
- name: buildCommandSourcesDirectory
value: '$(Build.SourcesDirectory)/'
###
### Platform-specific variable setup
###
- ${{ if eq(parameters.osGroup, 'windows') }}:
- name: CommonMSBuildArgs
value: >-
/p:TargetArchitecture=${{ parameters.archType }}
/p:PortableBuild=true
/p:SkipTests=$(SkipTests)
/p:RuntimeFlavor=${{ parameters.runtimeFlavor }}
$(OfficialBuildArg)
- name: MsbuildSigningArguments
value: >-
/p:CertificateId=400
/p:DotNetSignType=$(SignType)
- name: TargetArchitecture
value: ${{ parameters.archType }}
- name: BaseJobBuildCommand
value: >-
build.cmd -subset host+packs -ci
$(BuildAction)
-configuration $(_BuildConfig)
$(pgoInstrumentArg)
$(LiveOverridePathArgs)
$(CommonMSBuildArgs)
$(MsbuildSigningArguments)
- ${{ if eq(parameters.osGroup, 'OSX') }}:
- name: CommonMSBuildArgs
value: >-
/p:PortableBuild=true
/p:SkipTests=$(SkipTests)
/p:RuntimeFlavor=${{ parameters.runtimeFlavor }}
/p:TargetArchitecture=${{ parameters.archType }}
/p:CrossBuild=${{ parameters.crossBuild }}
- name: BaseJobBuildCommand
value: >-
$(Build.SourcesDirectory)/build.sh -ci
$(BuildAction)
-configuration $(_BuildConfig)
-arch ${{ parameters.archType }}
$(LiveOverridePathArgs)
$(CommonMSBuildArgs)
$(OfficialBuildArg)
- ${{ if in(parameters.osGroup, 'iOS', 'tvOS', 'Android', 'Browser') }}:
- name: CommonMSBuildArgs
value: >-
/p:PortableBuild=true
/p:SkipTests=$(SkipTests)
- name: BaseJobBuildCommand
value: >-
$(Build.SourcesDirectory)/build.sh -subset packs -ci
$(BuildAction)
-configuration $(_BuildConfig)
-os ${{ parameters.osGroup }}
-arch ${{ parameters.archType }}
/p:StripSymbols=true
$(LiveOverridePathArgs)
$(CommonMSBuildArgs)
$(OfficialBuildArg)
- ${{ if in(parameters.osGroup, 'Linux', 'FreeBSD') }}:
- name: CommonMSBuildArgs
value: >-
/p:Configuration=$(_BuildConfig)
/p:TargetOS=${{ parameters.osGroup }}
/p:TargetArchitecture=${{ parameters.archType }}
/p:RuntimeFlavor=${{ parameters.runtimeFlavor }}
$(OfficialBuildArg)
- name: _PortableBuild
value: ${{ eq(parameters.osSubgroup, '') }}
- ${{ if and(eq(parameters.osSubgroup, '_musl'), eq(parameters.osGroup, 'Linux')) }}:
- name: _PortableBuild
value: true
- ${{ if eq(parameters.crossBuild, true) }}:
- name: ArchArg
value: -arch ${{ parameters.archType }}
- name: BaseJobBuildCommand
value: >-
$(Build.SourcesDirectory)/build.sh -subset host+packs -ci
$(BuildAction)
$(ArchArg)
/p:CrossBuild=${{ parameters.crossBuild }}
/p:PortableBuild=$(_PortableBuild)
/p:SkipTests=$(SkipTests)
$(pgoInstrumentArg)
$(LiveOverridePathArgs)
$(CommonMSBuildArgs)
- name: installersSubsetArg
value: --subset packs.installers
###
### Common Live build override variable setup
###
- name: LiveOverridePathArgs
value: >-
$(RuntimeArtifactsArgs)
$(LibrariesConfigurationArg)
- name: RuntimeArtifactsArgs
value: ''
- name: LibrariesConfigurationArg
value: ''
- name: RuntimeDownloadPath
value: ''
- name: LibrariesDownloadPath
value: ''
- ${{ if ne(parameters.liveRuntimeBuildConfig, '') }}:
- name: liveRuntimeLegName
value: ${{ format('{0}{1}_{2}_{3}',
parameters.osGroup,
parameters.osSubgroup,
parameters.archType,
parameters.liveRuntimeBuildConfig) }}
- name: RuntimeDownloadPath
value: 'artifacts/transport/${{ parameters.runtimeFlavor }}'
- name: RuntimeArtifactsArgs
value: >-
/p:RuntimeArtifactsPath=$(buildCommandSourcesDirectory)$(RuntimeDownloadPath)
/p:RuntimeConfiguration=${{ parameters.liveRuntimeBuildConfig }}
- name: RuntimeArtifactName
value: $(runtimeFlavorName)Product_${{ parameters.pgoType }}_${{ parameters.runtimeVariant }}_$(liveRuntimeLegName)
- ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
- name: liveLibrariesLegName
value: ${{ format('{0}{1}_{2}_{3}',
parameters.osGroup,
parameters.osSubgroup,
parameters.archType,
parameters.liveLibrariesBuildConfig) }}
- name: LibrariesDownloadPath
value: 'artifacts'
- name: LibrariesArtifactName
value: libraries_bin_$(liveLibrariesLegName)
- name: LibrariesConfigurationArg
value: ' /p:LibrariesConfiguration=${{ parameters.liveLibrariesBuildConfig }}'
dependsOn:
- ${{ if eq(parameters.dependOnEvaluatePaths, true) }}:
- evaluate_paths
- ${{ parameters.dependsOn }}
- ${{ if ne(parameters.liveRuntimeBuildConfig, '') }}:
- ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}{6}',
parameters.runtimeFlavor,
parameters.runtimeVariant,
parameters.osGroup,
parameters.osSubgroup,
parameters.archType,
parameters.liveRuntimeBuildConfig,
parameters.pgoType) }}
- ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
- libraries_build_${{ format('{0}{1}_{2}_{3}',
parameters.osGroup,
parameters.osSubgroup,
parameters.archType,
parameters.liveLibrariesBuildConfig) }}
steps:
- checkout: self
clean: true
fetchDepth: $(checkoutFetchDepth)
- ${{ if ne(parameters.liveRuntimeBuildConfig, '') }}:
- template: /eng/pipelines/common/download-artifact-step.yml
parameters:
unpackFolder: $(Build.SourcesDirectory)/$(RuntimeDownloadPath)
artifactFileName: '$(RuntimeArtifactName)$(archiveExtension)'
artifactName: '$(RuntimeArtifactName)'
displayName: '$(runtimeFlavorName) artifacts'
- ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
- template: /eng/pipelines/common/download-artifact-step.yml
parameters:
unpackFolder: $(Build.SourcesDirectory)/$(LibrariesDownloadPath)
artifactFileName: '$(LibrariesArtifactName)$(archiveExtension)'
artifactName: '$(LibrariesArtifactName)'
displayName: 'Libraries artifacts'
cleanUnpackFolder: false
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh ${{ parameters.osGroup }}
displayName: Install Build Dependencies
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
displayName: Disk Usage before Build
# Build the default subset non-MacOS platforms
- ${{ if ne(parameters.osGroup, 'OSX') }}:
- script: $(BaseJobBuildCommand)
displayName: Build
continueOnError: ${{ and(eq(variables.SkipTests, false), eq(parameters.shouldContinueOnError, true)) }}
# Build corehost, sign and add entitlements to MacOS binaries
- ${{ if eq(parameters.osGroup, 'OSX') }}:
- script: $(BaseJobBuildCommand) -subset host.native
displayName: Build CoreHost
continueOnError: ${{ and(eq(variables.SkipTests, false), eq(parameters.shouldContinueOnError, true)) }}
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: /eng/pipelines/common/macos-sign-with-entitlements.yml
parameters:
filesToSign:
- name: dotnet
path: $(Build.SourcesDirectory)/artifacts/bin/osx-${{ parameters.archType }}.$(_BuildConfig)/corehost
entitlementsFile: $(Build.SourcesDirectory)/eng/pipelines/common/entitlements.plist
- name: apphost
path: $(Build.SourcesDirectory)/artifacts/bin/osx-${{ parameters.archType }}.$(_BuildConfig)/corehost
entitlementsFile: $(Build.SourcesDirectory)/eng/pipelines/common/entitlements.plist
- script: $(BaseJobBuildCommand) -subset host.pkg+host.tools+host.tests+packs
displayName: Build and Package
continueOnError: ${{ and(eq(variables.SkipTests, false), eq(parameters.shouldContinueOnError, true)) }}
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
displayName: Disk Usage after Build
# Only in glibc leg, we produce RPMs and Debs
- ${{ if and(eq(parameters.runtimeFlavor, 'coreclr'), or(eq(parameters.platform, 'Linux_x64'), eq(parameters.platform, 'Linux_arm64')), eq(parameters.osSubgroup, ''), eq(parameters.pgoType, ''))}}:
- ${{ each packageBuild in parameters.packageDistroList }}:
# This leg's RID matches the build image. Build its distro-dependent packages, as well as
# the distro-independent installers. (There's no particular reason to build the distro-
# independent installers on this leg, but we need to do it somewhere.)
# Currently, Linux_arm64 supports 'rpm' type only.
- ${{ if or(not(eq(parameters.platform, 'Linux_arm64')), eq(packageBuild.packageType, 'rpm')) }}:
- template: /eng/pipelines/installer/jobs/steps/build-linux-package.yml
parameters:
packageType: ${{ packageBuild.packageType }}
target: ${{ packageBuild.target }}
packageStepDescription: Runtime Deps, Runtime, Framework Packs installers
subsetArg: $(installersSubsetArg)
packagingArgs: ${{ packageBuild.packagingArgs }}
- ${{ if and(eq(parameters.osGroup, 'windows'), eq(parameters.isOfficialBuild, true)) }}:
- task: NuGetCommand@2
displayName: Push Visual Studio NuPkgs
inputs:
command: push
packagesToPush: '$(Build.SourcesDirectory)/artifacts/packages/$(_BuildConfig)/*/VS.Redist.Common.*.nupkg'
nuGetFeedType: external
publishFeedCredentials: 'DevDiv - VS package feed'
condition: and(
succeeded(),
eq(variables['_BuildConfig'], 'Release'),
ne(variables['DisableVSPublish'], 'true'),
ne(variables['PostBuildSign'], 'true'))
- template: /eng/pipelines/installer/jobs/steps/upload-job-artifacts.yml
parameters:
name: ${{ coalesce(parameters.name, parameters.platform) }}
runtimeFlavor: ${{ parameters.runtimeFlavor }}
runtimeVariant: ${{ parameters.runtimeVariant }}
isOfficialBuild: ${{ eq(parameters.isOfficialBuild, true) }}
pgoType: ${{ parameters.pgoType }}
- ${{ if ne(parameters.osGroup, 'windows') }}:
- script: set -x && df -h
displayName: Check remaining storage space
condition: always()
continueOnError: true