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
|
parameters:
archType: ''
buildConfig: ''
# compilerName specifies the compiler to use to do the builds. This can either be 'gcc' or left
# unset to use the default (clang on Linux/Mac, Visual C++ on Windows).
compilerName: ''
condition: true
container: ''
crossBuild: false
crossrootfsDir: ''
dependOnEvaluatePaths: false
disableClrTest: false
isOfficialBuild: false
osGroup: ''
osSubgroup: ''
platform: ''
pool: ''
runtimeVariant: ''
signBinaries: false
stagedBuild: false
testGroup: ''
timeoutInMinutes: ''
variables: {}
pgoType: ''
### Product build
jobs:
- template: xplat-pipeline-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
stagedBuild: ${{ parameters.stagedBuild }}
pool: ${{ parameters.pool }}
condition: ${{ parameters.condition }}
dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths }}
disableClrTest: ${{ parameters.disableClrTest }}
pgoType: ${{ parameters.pgoType }}
# Compute job name from template parameters
${{ if and(ne(parameters.testGroup, 'clrTools'), eq(parameters.compilerName, 'gcc')) }}:
name: ${{ format('coreclr_{0}_product_build_{1}{1}_{3}_{4}', parameters.compilerName, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
displayName: ${{ format('GCC Product Build {0}{1} {2} {3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
${{ if and(ne(parameters.testGroup, 'clrTools'), ne(parameters.compilerName, 'gcc')) }}:
name: ${{ format('coreclr_{0}_product_build_{1}{2}_{3}_{4}{5}',
parameters.runtimeVariant,
parameters.osGroup,
parameters.osSubgroup,
parameters.archType,
parameters.buildConfig,
parameters.pgoType) }}
displayName: ${{ format('CoreCLR {0} Product Build {1}{2} {3} {4} {5}',
parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup,
parameters.archType,
parameters.buildConfig,
parameters.pgoType) }}
${{ if eq(parameters.testGroup, 'clrTools') }}:
name: ${{ format('coreclr_{0}_tools_unittests_{1}{2}_{3}_{4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
displayName: ${{ format('CoreCLR {0} Tools Unit Tests {1}{2} {3} {4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, 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 }}
crossrootfsDir: ${{ parameters.crossrootfsDir }}
gatherAssetManifests: true
variables:
- name: osGroup
value: ${{ parameters.osGroup }}
- name: osSubgroup
value: ${{ parameters.osSubgroup }}
- name: compilerArg
value: ''
- name: publishLogsArtifactPrefix
value: 'BuildLogs_CoreCLR'
- ${{ if eq(parameters.testGroup, 'clrTools') }}:
- name: publishLogsArtifactPrefix
value: 'BuildLogs_CoreCLR_ToolsUnitTests'
- ${{ if eq(parameters.compilerName, 'gcc') }}:
- name: compilerArg
value: '-gcc'
- name: publishLogsArtifactPrefix
value: 'BuildLogs_CoreCLR_GCC'
- ${{ if and(ne(parameters.osGroup, 'windows'), ne(parameters.compilerName, 'gcc')) }}:
- name: compilerArg
value: '-clang9'
# Building for x64 MUSL happens on Alpine Linux and we need to use the stable version available there
- ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubgroup, '_musl'), eq(parameters.archType, 'x64')) }}:
- name: compilerArg
value: ''
# AppleClang has different version scheme, so we let compiler introspection pick up the available clang from PATH
- ${{ if eq(parameters.osGroup, 'OSX') }}:
- name: compilerArg
value: ''
- ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
# Variables used to publish packages to blob feed
- name: dotnetfeedUrl
value: https://dotnetfeed.blob.core.windows.net/dotnet-coreclr/index.json
- name: dotnetfeedPAT
value: $(dotnetfeed-storage-access-key-1)
# Variables used by arcade to gather asset manifests
- name: _DotNetPublishToBlobFeed
value: true
- name: officialBuildIdArg
value: ''
- ${{ if eq(parameters.isOfficialBuild, true) }}:
- name: officialBuildIdArg
value: '/p:OfficialBuildId=$(Build.BuildNumber)'
- name: enforcePgoArg
value: ''
# The EnforcePGO script is only supported on Windows and is not supported on arm or arm64.
- ${{ if and(eq(parameters.buildConfig, 'Release'), and(eq(parameters.osGroup, 'windows'), not(or(eq(parameters.archType, 'arm64'), eq(parameters.archType, 'arm')))), ne(parameters.pgoType, 'pgo')) }}:
- name: enforcePgoArg
value: '-enforcepgo'
- name: clrInterpreterBuildArg
value: ''
- ${{ if eq(parameters.testGroup, 'clrinterpreter') }}:
- name: clrInterpreterBuildArg
value: '-cmakeargs "-DFEATURE_INTERPRETER=1"'
- name: clrRuntimeComponentsBuildArg
value: ''
- ${{ if ne(parameters.testGroup, 'innerloop') }}:
- name: clrRuntimeComponentsBuildArg
value: '-component runtime -component alljits -component paltests -component nativeaot -component spmi '
- ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.archType, 'x86')) }}:
- name: clrRuntimeComponentsBuildArg
value: '-component runtime -component jit -component iltools -component spmi '
- name: pgoInstrumentArg
value: ''
- ${{ if eq(parameters.pgoType, 'PGO' )}}:
- name: pgoInstrumentArg
value: '-pgoinstrument '
- name: SignType
value: $[ coalesce(variables.OfficialSignType, 'real') ]
- name: clrRuntimePortableBuildArg
value: ''
- ${{ if eq(parameters.osGroup, 'Tizen') }}:
- name: clrRuntimePortableBuildArg
value: '-portablebuild=false'
- ${{ parameters.variables }}
steps:
# Install native dependencies
# Linux builds use docker images with dependencies preinstalled,
# and FreeBSD builds use a build agent with dependencies
# preinstalled, so we only need this step for OSX and Windows.
- ${{ if eq(parameters.osGroup, 'OSX') }}:
- script: $(Build.SourcesDirectory)/eng/install-native-dependencies.sh $(osGroup) ${{ parameters.archType }} azDO
displayName: Install native dependencies
# Install internal tools on official builds
# Since our internal tools are behind an authenticated feed,
# we need to use the DotNetCli AzDO task to restore from the feed using a service connection.
# We can't do this from within the build, so we need to do this as a separate step.
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- template: /eng/pipelines/common/restore-internal-tools.yml
# Install MicroBuild for signing the DAC and DBI
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), eq(parameters.signBinaries, true), eq(parameters.osGroup, 'windows')) }}:
- task: MicroBuildSigningPlugin@2
displayName: Install MicroBuild plugin for Signing
inputs:
signType: $(SignType)
zipSources: false
feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json
continueOnError: false
condition: and(succeeded(), in(variables['SignType'], 'real', 'test'))
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
displayName: Disk Usage before Build
# Build/Generate native prerequisites
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.nativeprereqs $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(officialBuildIdArg) -ci /bl:$(Build.SourcesDirectory)artifacts/log/$(buildConfig)/CoreCLRNativePrereqs.binlog
displayName: Build and generate native prerequisites
# Build CoreCLR Runtime
- ${{ if ne(parameters.osGroup, 'windows') }}:
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) $(osArg) -ci $(compilerArg) $(clrRuntimeComponentsBuildArg) $(pgoInstrumentArg) $(officialBuildIdArg) $(clrInterpreterBuildArg) $(clrRuntimePortableBuildArg) $(CoreClrPgoDataArg)
displayName: Build CoreCLR Runtime
- ${{ if eq(parameters.osGroup, 'windows') }}:
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci $(enforcePgoArg) $(pgoInstrumentArg) $(officialBuildIdArg) $(clrInterpreterBuildArg) $(CoreClrPgoDataArg)
displayName: Build CoreCLR Runtime
- ${{ if ne(parameters.archType, 'x64') }}:
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -hostarch x64 $(osArg) -ci $(compilerArg) -component crosscomponents -cmakeargs "-DCLR_CROSS_COMPONENTS_BUILD=1" $(officialBuildIdArg) $(clrRuntimePortableBuildArg)
displayName: Build CoreCLR Cross-Arch Tools (Tools that run on x64 targeting x86)
- ${{ if and(eq(parameters.osGroup, 'windows'), eq(parameters.archType, 'arm')) }}:
- script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -hostarch x86 $(osArg) -ci $(compilerArg) -component crosscomponents -cmakeargs "-DCLR_CROSS_COMPONENTS_BUILD=1" $(officialBuildIdArg) $(clrRuntimePortableBuildArg)
displayName: Build CoreCLR Cross-Arch Tools (Tools that run on x86 targeting arm)
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
displayName: Disk Usage after Build
# Build CoreCLR Managed Components
- ${{ if or(ne(parameters.osGroup, 'Linux'), ne(parameters.archType, 'x86')) }}:
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib+clr.nativecorelib+clr.nativeaotlibs+clr.tools+clr.packages+clr.paltestlist $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(pgoInstrumentArg) $(officialBuildIdArg) -ci
displayName: Build managed product components and packages
- ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.archType, 'x86')) }}:
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.corelib $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(pgoInstrumentArg) $(officialBuildIdArg) -ci
displayName: Build managed product components and packages
# Run CoreCLR Tools unit tests
- ${{ if eq(parameters.testGroup, 'clrTools') }}:
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset libs $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(officialBuildIdArg) -ci
displayName: Build libs
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset clr.toolstests $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(officialBuildIdArg) -ci -test
displayName: Run CoreCLR Tools unit tests
# Build native test components
- ${{ if and(ne(parameters.isOfficialBuild, true), ne(parameters.disableClrTest, true)) }}:
- script: $(Build.SourcesDirectory)/src/tests/build$(scriptExt) skipmanaged skipgeneratelayout $(buildConfig) $(archType) $(crossArg) $(osArg) $(priorityArg) $(compilerArg)
displayName: Build native test components
# Build libs.native, host.native and mono with gcc
- ${{ if eq(parameters.compilerName, 'gcc') }}:
- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) libs.native+host.native+mono $(compilerArg) $(crossArg) -arch $(archType) $(osArg) -c $(buildConfig) $(pgoInstrumentArg) $(officialBuildIdArg) -ci
displayName: Build libs.native+host.native+mono
# Sign and add entitlements to these MacOS binaries
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- ${{ if eq(parameters.osGroup, 'OSX') }}:
- template: /eng/pipelines/common/macos-sign-with-entitlements.yml
parameters:
filesToSign:
- name: createdump
path: $(buildProductRootFolderPath)
entitlementsFile: $(Build.SourcesDirectory)/eng/pipelines/common/createdump-entitlements.plist
- name: corerun
path: $(buildProductRootFolderPath)
entitlementsFile: $(Build.SourcesDirectory)/eng/pipelines/common/entitlements.plist
- task: CopyFiles@2
displayName: 'Copy signed createdump to sharedFramework'
inputs:
contents: createdump
sourceFolder: $(buildProductRootFolderPath)
targetFolder: $(buildProductRootFolderPath)/sharedFramework
overWrite: true
- ${{ if and(eq(parameters.osGroup, 'windows'), eq(parameters.signBinaries, true)) }}:
- template: /eng/pipelines/coreclr/templates/sign-diagnostic-files.yml
parameters:
basePath: $(buildProductRootFolderPath)
isOfficialBuild: ${{ parameters.signBinaries }}
timeoutInMinutes: 30
# Builds using gcc are not tested, and clrTools unitests do not publish the build artifacts
- ${{ if and(ne(parameters.compilerName, 'gcc'), ne(parameters.testGroup, 'clrTools'), ne(parameters.disableClrTest, true)) }}:
# Publish product output directory for consumption by tests.
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(buildProductRootFolderPath)
includeRootFolder: false
archiveType: $(archiveType)
tarCompression: $(tarCompression)
archiveExtension: $(archiveExtension)
artifactName: $(buildProductArtifactName)
displayName: 'product build'
- ${{ if and(in(parameters.osGroup, 'windows', 'Linux'), ne(parameters.archType, 'x86'), ne(parameters.compilerName, 'gcc'), ne(parameters.testGroup, 'clrTools'), eq(parameters.pgoType, '')) }}:
- template: /eng/pipelines/coreclr/templates/crossdac-build.yml
parameters:
archType: ${{ parameters.archType }}
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
isOfficialBuild: ${{ parameters.signBinaries }}
${{ if eq(parameters.archType, 'arm') }}:
hostArchType: x86
${{ else }}:
hostArchType: x64
- ${{ if and(ne(parameters.compilerName, 'gcc'), ne(parameters.testGroup, ''), ne(parameters.testGroup, 'clrTools'), ne(parameters.disableClrTest, true)) }}:
# Publish test native components for consumption by test execution.
- ${{ if and(ne(parameters.isOfficialBuild, true), eq(parameters.pgoType, '')) }}:
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(nativeTestArtifactRootFolderPath)
includeRootFolder: false
archiveType: $(archiveType)
tarCompression: $(tarCompression)
archiveExtension: $(archiveExtension)
artifactName: $(nativeTestArtifactName)
displayName: 'native test components'
# Get key vault secrets for publishing
- ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- task: AzureKeyVault@1
inputs:
azureSubscription: 'DotNet-Engineering-Services_KeyVault'
KeyVaultName: EngKeyVault
SecretsFilter: 'dotnetfeed-storage-access-key-1,microsoft-symbol-server-pat,symweb-symbol-server-pat'
# Save packages using the prepare-signed-artifacts format.
- ${{ if and(eq(parameters.isOfficialBuild, true), ne(parameters.testGroup, 'clrTools'), eq(parameters.pgoType, '')) }}:
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
parameters:
name: ${{ parameters.platform }}
# Publish unit tests results if executing unit tests
- ${{ if eq(parameters.testGroup, 'clrTools') }}:
- task: PublishTestResults@2
inputs:
testResultsFormat: 'xUnit'
testResultsFiles: '*.xml'
testRunTitle: CoreCLR-Tools-Unittests-$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
continueOnError: true
condition: always()
# Publish Logs
- task: PublishPipelineArtifact@1
displayName: Publish Logs
inputs:
targetPath: $(Build.SourcesDirectory)/artifacts/log
artifactName: '$(publishLogsArtifactPrefix)${{ parameters.pgoType }}_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
continueOnError: true
condition: always()
|