-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
build-job.yml
164 lines (147 loc) · 7.2 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
parameters:
buildConfig: ''
osGroup: ''
osSubgroup: ''
archType: ''
targetRid: ''
crossBuild: false
framework: 'net8.0'
isOfficialBuild: false
isOfficialAllConfigurations: false
runtimeVariant: ''
platform: ''
# When set to a non-empty value (Debug / Release), it determines the runtime's
# build configuration to use for building libraries and tests. Setting this
# property implies a dependency of this job on the appropriate runtime build
# and is used to construct the name of the Azure artifact representing
# runtime build to use for building the libraries and library tests.
liveRuntimeBuildConfig: ''
runtimeFlavor: 'coreclr'
timeoutInMinutes: 150
preBuildSteps: []
container: ''
condition: true
dependOnEvaluatePaths: false
disableComponentGovernance: false
shouldContinueOnError: false
variables: {}
pool: ''
# Run tests as part of the build job (instead of running them in a separate job)
runTests: false
# Package up the test builds so they can be sent to Helix
useHelix: true
testScope: ''
jobs:
- template: /eng/pipelines/libraries/base-job.yml
parameters:
buildConfig: ${{ parameters.buildConfig }}
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
archType: ${{ parameters.archType }}
crossBuild: ${{ parameters.crossBuild }}
framework: ${{ parameters.framework }}
isOfficialBuild: ${{ parameters.isOfficialBuild }}
isOfficialAllConfigurations: ${{ parameters.isOfficialAllConfigurations }}
liveRuntimeBuildConfig: ${{ parameters.liveRuntimeBuildConfig }}
runtimeFlavor: ${{ parameters.runtimeFlavor }}
runTests: ${{ parameters.runTests }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
preBuildSteps: ${{ parameters.preBuildSteps }}
container: ${{ parameters.container }}
condition: ${{ parameters.condition }}
dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths }}
disableComponentGovernance: ${{ parameters.disableComponentGovernance }}
pool: ${{ parameters.pool }}
runtimeVariant: ${{ parameters.runtimeVariant }}
testScope: ${{ parameters.testScope }}
name: build
displayName: 'Build'
${{ if and(ne(parameters.liveRuntimeBuildConfig, ''), eq(parameters.runTests, true)) }}:
dependsOn:
# Use full product dependency for test runs
- ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}', parameters.runtimeFlavor, parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveRuntimeBuildConfig) }}
variables:
- librariesTestsArtifactName: ${{ format('libraries_test_assets_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- _subset: tools+libs+libs.tests
- ${{ if and(eq(parameters.runTests, false), eq(parameters.useHelix, false)) }}:
- _subset: tools+libs
- _buildAction: ''
- _additionalBuildArguments: ''
- ${{ parameters.variables }}
# Tests only run for 'allConfiguration' and 'net48' build-jobs
# Only pass -test for when we aren't running tests using Helix.
- ${{ if and(eq(parameters.runTests, true), eq(parameters.useHelix, false)) }}:
- _buildAction: -restore -build -test
- ${{ if eq(parameters.useHelix, true) }}:
- _additionalBuildArguments: /p:ArchiveTests=true
- ${{ parameters.variables }}
steps:
- ${{ if eq(parameters.isOfficialBuild, true) }}:
- template: /eng/pipelines/common/restore-internal-tools.yml
- ${{ if in(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator') }}:
- 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
- script: $(_buildScript)
-subset $(_subset)
$(_buildAction)
$(_buildArguments)
$(_additionalBuildArguments)
displayName: Restore and Build Product
- ${{ if in(parameters.osGroup, 'osx', 'ios', 'tvos') }}:
- script: |
du -sh $(Build.SourcesDirectory)/*
df -h
displayName: Disk Usage after Build
- ${{ if eq(parameters.runTests, false) }}:
- template: /eng/pipelines/libraries/prepare-for-bin-publish.yml
parameters:
isOfficialBuild: ${{ parameters.isOfficialBuild }}
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.ArtifactStagingDirectory)/artifacts
includeRootFolder: false
archiveType: $(archiveType)
archiveExtension: $(archiveExtension)
tarCompression: $(tarCompression)
artifactName: $(librariesBuildArtifactName)
displayName: Build Assets
# Upload test assets if we are sending tests to Helix and not running them directly in this job.
- ${{ if and(eq(parameters.runTests, false), eq(parameters.useHelix, true)) }}:
- template: /eng/pipelines/common/upload-artifact-step.yml
parameters:
rootFolder: $(Build.SourcesDirectory)/artifacts/helix
includeRootFolder: true
archiveType: $(archiveType)
archiveExtension: $(archiveExtension)
tarCompression: $(tarCompression)
artifactName: $(librariesTestsArtifactName)
displayName: Test Assets
# Save AllConfigurations artifacts using the prepare-signed-artifacts format. The
# platform-specific jobs' nupkgs automatically flow through the matching platform-specific
# Installer build, but AllConfigurations should only be uploaded once, here.
- ${{ if eq(parameters.isOfficialAllConfigurations, true) }}:
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
parameters:
name: Libraries_AllConfigurations
publishPackagesCondition: >-
or(
eq(variables['_librariesBuildProducedPackages'], true),
eq(variables['Build.SourceBranchName'], 'main'),
eq(variables['System.PullRequest.TargetBranch'], 'main'))
- ${{ if and(eq(parameters.runTests, true), eq(parameters.useHelix, true)) }}:
- template: /eng/pipelines/libraries/helix.yml
parameters:
osGroup: ${{ parameters.osGroup }}
targetRid: ${{ parameters.targetRid }}
archType: ${{ parameters.archType }}
buildConfig: ${{ parameters.buildConfig }}
helixQueues: ${{ parameters.helixQueues }}
testScope: ${{ parameters.testScope }}
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
creator: dotnet-bot
testRunNamePrefixSuffix: $(_testRunNamePrefixSuffix)
extraHelixArguments: $(_extraHelixArguments)