-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathsdk-build.yml
More file actions
201 lines (192 loc) · 9.34 KB
/
Copy pathsdk-build.yml
File metadata and controls
201 lines (192 loc) · 9.34 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
parameters:
### GENERAL ###
variables: {}
oneESCompat:
templateFolderName: templates
publishTaskPrefix: ''
container: ''
helixTargetContainer: ''
categoryName: Build
runTests: true
testProjects: $(Build.SourcesDirectory)/test/UnitTests.proj
publishRetryConfig: false
publishXunitResults: false
enableSbom: true
timeoutInMinutes: 150
### ENV VARS ###
testFullMSBuild: false
runAoTTests: false
### MSBUILD ###
buildArchitecture: x64
publishArgument: ''
signArgument: ''
runTestsAsTool: false
pgoInstrument: false
enableDefaultArtifacts: false
runtimeIdentifier: linux-x64
osProperties: ''
runtimeSourceProperties: ''
officialBuildProperties: ''
jobs:
- template: /eng/common/${{ parameters.oneESCompat.templateFolderName }}/job/job.yml
parameters:
${{ if eq(parameters.container, '') }}:
name: ${{ parameters.categoryName }}_${{ parameters.pool.os }}_${{ parameters.buildArchitecture }}
displayName: '${{ parameters.categoryName }}: ${{ parameters.pool.os }} (${{ parameters.buildArchitecture }})'
${{ else }}:
name: ${{ parameters.categoryName }}_${{ parameters.pool.os }}_${{ parameters.buildArchitecture }}_${{ parameters.container }}
displayName: '${{ parameters.categoryName }}: ${{ parameters.pool.os }} (${{ parameters.buildArchitecture }}) [${{ parameters.container }}]'
pool: ${{ parameters.pool }}
container: ${{ parameters.container }}
strategy: ${{ parameters.strategy }}
helixRepo: dotnet/sdk
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
enableMicrobuild: true
enablePublishBuildAssets: true
enableTelemetry: true
enablePublishUsingPipelines: true
enableSbom: ${{ parameters.enableSbom }}
variables:
- ${{ insert }}: ${{ parameters.variables }}
steps:
############## PREP ###############
- ${{ if eq(parameters.publishRetryConfig, true) }}:
# Publishes the build-configuration.json to the artifacts which Arcade uses to allow all the jobs in the pipeline to retry automatically.
# See: https://github.com/dotnet/arcade/blob/main/Documentation/Projects/Build%20Analysis/BuildRetryOnboard.md
- task: ${{ parameters.oneESCompat.publishTaskPrefix }}PublishPipelineArtifact@1
displayName: Publish build-configuration.json
inputs:
targetPath: $(Build.SourcesDirectory)/eng/BuildConfiguration
artifactName: BuildConfiguration
# Populate internal runtime variables.
- template: /eng/common/templates/steps/enable-internal-sources.yml
parameters:
legacyCredential: $(dn-bot-dnceng-artifact-feeds-rw)
- template: /eng/common/templates/steps/enable-internal-runtimes.yml
############### BUILDING ###############
- ${{ if eq(parameters.pool.os, 'windows') }}:
- powershell: eng/common/build.ps1
-restore -build -pack -ci -nativeToolsOnMachine
-configuration $(buildConfiguration)
${{ parameters.publishArgument }}
${{ parameters.signArgument }}
/p:EnableDefaultArtifacts=${{ parameters.enableDefaultArtifacts }}
/p:Architecture=${{ parameters.buildArchitecture }}
/p:RunTestsAsTool=${{ parameters.runTestsAsTool }}
/p:PgoInstrument=${{ parameters.pgoInstrument }}
${{ parameters.runtimeSourceProperties }}
${{ parameters.officialBuildProperties }}
/p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName)
displayName: Build
env:
BuildConfig: $(buildConfiguration)
TestFullMSBuild: ${{ parameters.testFullMSBuild }}
- ${{ else }}:
- script: |
source $(Build.SourcesDirectory)/eng/common/native/init-os-and-arch.sh
source $(Build.SourcesDirectory)/eng/common/native/init-distro-rid.sh
initDistroRidGlobal "$os" "$arch" ""
. $(Build.SourcesDirectory)/eng/common/build.sh \
-restore -build -pack -ci \
-configuration $(buildConfiguration) \
${{ parameters.publishArgument }} \
${{ parameters.signArgument }} \
/p:EnableDefaultArtifacts=${{ parameters.enableDefaultArtifacts }} \
/p:Architecture=${{ parameters.buildArchitecture }} \
/p:RunTestsAsTool=${{ parameters.runTestsAsTool }} \
/p:PgoInstrument=${{ parameters.pgoInstrument }} \
/p:Rid=${{ parameters.runtimeIdentifier }} \
${{ parameters.osProperties }} \
${{ parameters.runtimeSourceProperties }} \
${{ parameters.officialBuildProperties }} \
/p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName)
displayName: Build
env:
BuildConfig: $(buildConfiguration)
OPENSSL_ENABLE_SHA1_SIGNATURES: 1
############### TESTING ###############
- ${{ if eq(parameters.runTests, true) }}:
- ${{ if eq(parameters.runAoTTests, true) }}:
# For the reason this is here, see: https://github.com/dotnet/sdk/issues/22655
- script: $(Build.SourcesDirectory)/artifacts/bin/redist/$(buildConfiguration)/dotnet/dotnet workload install wasm-tools --skip-manifest-update
displayName: Install wasm-tools Workload
# For the /p:Projects syntax for PowerShell, see: https://github.com/dotnet/msbuild/issues/471#issuecomment-1146466335
- ${{ if eq(parameters.pool.os, 'windows') }}:
- powershell: eng/common/build.ps1
-restore -test -ci -prepareMachine -nativeToolsOnMachine
-configuration $(buildConfiguration)
/p:Projects=\`"${{ replace(parameters.testProjects, ';', '`;') }}\`"
/p:Architecture=${{ parameters.buildArchitecture }}
${{ parameters.runtimeSourceProperties }}
/p:CustomHelixTargetQueue=${{ parameters.helixTargetQueue }}
/bl:$(Build.SourcesDirectory)/artifacts/log/$(buildConfiguration)/${{ parameters.categoryName }}Tests.binlog
displayName: Run ${{ parameters.categoryName }} Tests
condition: succeeded()
env:
# Required by Arcade for running in Helix.
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
HelixAccessToken: $(HelixApiAccessToken)
RunAoTTests: ${{ parameters.runAoTTests }}
TestFullMSBuild: ${{ parameters.testFullMSBuild }}
- ${{ else }}:
# For the /p:Projects syntax for Bash, see: https://github.com/dotnet/msbuild/issues/471#issuecomment-1690189034
# The /p:CustomHelixTargetQueue syntax is: <queue-name>@<container-url>
# For the Helix containers, see the 'simpleTags' arrays here: https://github.com/dotnet/versions/blob/main/build-info/docker/image-info.dotnet-dotnet-buildtools-prereqs-docker-main.json
- script: eng/common/build.sh
-restore -test -ci -prepareMachine
-configuration $(buildConfiguration)
'/p:Projects="${{ parameters.testProjects }}"'
/p:Architecture=${{ parameters.buildArchitecture }}
/p:Rid=${{ parameters.runtimeIdentifier }}
${{ parameters.osProperties }}
${{ parameters.runtimeSourceProperties }}
/p:CustomHelixTargetQueue=${{ parameters.helixTargetQueue }}${{ parameters.helixTargetContainer }}
/bl:$(Build.SourcesDirectory)/artifacts/log/$(buildConfiguration)/${{ parameters.categoryName }}Tests.binlog
displayName: Run ${{ parameters.categoryName }} Tests
condition: succeeded()
env:
# Required by Arcade for running in Helix.
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
HelixAccessToken: $(HelixApiAccessToken)
RunAoTTests: ${{ parameters.runAoTTests }}
############### POST ###############
- ${{ if eq(parameters.publishXunitResults, true) }}:
# This is only necessary for non-Helix tests.
- task: PublishTestResults@2
displayName: Publish xUnit Test Results
inputs:
testResultsFormat: xUnit
testResultsFiles: artifacts/TestResults/$(buildConfiguration)/*.xml
testRunTitle: $(System.PhaseName)
buildPlatform: ${{ parameters.buildArchitecture }}
buildConfiguration: $(buildConfiguration)
continueOnError: true
condition: always()
- task: CopyFiles@2
displayName: Copy Logs
inputs:
SourceFolder: $(Build.SourcesDirectory)/artifacts
${{ if eq(parameters.runTests, false) }}:
Contents: |
log/$(buildConfiguration)/**/*
TestResults/$(buildConfiguration)/**/*
SymStore/$(buildConfiguration)/**/*
tmp/$(buildConfiguration)/**/*.binlog
${{ else }}:
Contents: |
log/$(buildConfiguration)/**/*
TestResults/$(buildConfiguration)/**/*
tmp/$(buildConfiguration)/**/*.binlog
TargetFolder: $(Build.ArtifactStagingDirectory)
continueOnError: true
condition: always()
- task: ${{ parameters.oneESCompat.publishTaskPrefix }}PublishBuildArtifacts@1
displayName: Publish Logs
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)
# This is the job name, but because of "legacy reasons", both Agent.JobName and System.JobName are not the actual job name.
# See: https://developercommunity.visualstudio.com/t/systemjobname-seems-to-be-incorrectly-assigned-and/1209736#TPIN-N1211828
ArtifactName: $(System.PhaseName)
publishLocation: Container
continueOnError: true
condition: always()