Skip to content

Commit 8ebd773

Browse files
authored
Adding pipeline-pr.yml (#8908)
1 parent f4319bc commit 8ebd773

File tree

2 files changed

+312
-2
lines changed

2 files changed

+312
-2
lines changed

azure-pipelines-pr.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ pr:
5959
exclude:
6060
- Documentation/*
6161

62-
# Call the pipeline.yml template, which does the real work
62+
# Call the pipeline-pr.yml template, which does the real work
6363
stages:
6464
- stage: build
6565
displayName: Build
6666
jobs:
67-
- template: /eng/pipeline.yml
67+
- template: /eng/pipeline-pr.yml
6868
parameters:
6969
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
7070
runAsPublic: false

eng/pipeline-pr.yml

+310
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,310 @@
1+
#
2+
# This file should be kept in sync across https://www.github.com/dotnet/wpf and dotnet-wpf-int repos.
3+
#
4+
#
5+
6+
parameters:
7+
# Needed because runAsPublic is used in template expressions, which can't read from user-defined variables
8+
# Defaults to true
9+
runAsPublic: true
10+
repoName: dotnet/wpf
11+
12+
jobs:
13+
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
14+
- template: /eng/common/templates/job/onelocbuild.yml
15+
parameters:
16+
MirrorRepo: wpf
17+
LclSource: lclFilesfromPackage
18+
LclPackageId: 'LCL-JUNO-PROD-WPF'
19+
- template: /eng/common/templates/jobs/jobs.yml
20+
parameters:
21+
enableMicrobuild: true
22+
enablePublishBuildArtifacts: true
23+
enablePublishTestResults: false # tests run in helix
24+
enablePublishBuildAssets: true
25+
enablePublishUsingPipelines: true
26+
enableTelemetry: true
27+
enableSourceIndex: true
28+
sourceIndexParams:
29+
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
30+
binlogPath: artifacts/log/Debug/x86/Build.binlog
31+
pool:
32+
${{ if eq(variables['System.TeamProject'], 'public') }}:
33+
name: NetCore-Public
34+
demands: ImageOverride -equals windows.vs2022preview.amd64.Open
35+
${{ if eq(variables['System.TeamProject'], 'internal') }}:
36+
name: NetCore1ESPool-Internal
37+
demands: ImageOverride -equals windows.vs2022preview.amd64
38+
helixRepo: $(repoName)
39+
40+
jobs:
41+
- job: Windows_NT
42+
timeoutInMinutes: 120 # how long to run the job before automatically cancelling; see https://github.com/dotnet/wpf/issues/952
43+
pool:
44+
# For public jobs, use the hosted pool. For internal jobs use the internal pool.
45+
# Will eventually change this to two BYOC pools.
46+
# agent pool can't be read from a user-defined variable (Azure DevOps limitation)
47+
${{ if eq(variables['System.TeamProject'], 'public') }}:
48+
name: NetCore-Public
49+
demands: ImageOverride -equals windows.vs2022preview.amd64.Open
50+
${{ if eq(variables['System.TeamProject'], 'internal') }}:
51+
name: NetCore1ESPool-Internal
52+
demands: ImageOverride -equals windows.vs2022preview.amd64
53+
variables:
54+
- name: Codeql.Enabled
55+
value: true
56+
# needed for signing
57+
- name: _TeamName
58+
value: DotNetCore
59+
- name: _SignType
60+
value: real
61+
- name: _SignArgs
62+
value: ''
63+
- name: _PublishArgs
64+
value: ''
65+
- name: _OfficialBuildIdArgs
66+
value: ''
67+
- name: _Platform
68+
value: x86
69+
- name: _PlatformArgs
70+
value: /p:Platform=$(_Platform)
71+
- name: _PublicBuildPipeline # We will run Helix tests when building in the open, but do not repeat when building and publishing again using the internal build-pipeline
72+
value: true
73+
- name: _TestHelixAgentPool
74+
value: 'Windows.10.Amd64.ClientRS5.Open' # Preferred:'Windows.10.Amd64.Open%3bWindows.7.Amd64.Open%3bWindows.10.Amd64.ClientRS5.Open'; See https://github.com/dotnet/wpf/issues/952
75+
- name: _HelixStagingDir
76+
value: $(BUILD.STAGINGDIRECTORY)\helix\functests
77+
- name: _HelixSource
78+
value: ${{ parameters.repoName }}/$(Build.SourceBranch)
79+
- name: _HelixToken
80+
value: ''
81+
- name: _HelixCreator
82+
value: ${{ parameters.repoName }}
83+
- name: _programfilesx86
84+
value: ${Env:ProgramFiles(x86)}/dotnet
85+
- name: _programfiles
86+
value: ${Env:ProgramFiles}/dotnet
87+
- ${{ if ne(variables['System.TeamProject'], 'internal') }}:
88+
- name: _InternalRuntimeDownloadArgs
89+
value: ''
90+
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
91+
- group: DotNetBuilds storage account read tokens
92+
- group: AzureDevOps-Artifact-Feeds-Pats
93+
- name: _InternalRuntimeDownloadArgs
94+
value: >-
95+
/p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal
96+
/p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64)
97+
98+
99+
# Override some values if we're building internally
100+
- ${{ if eq(parameters.runAsPublic, 'false') }}:
101+
# note: You have to use list syntax here (- name: value) or you will get errors about declaring the same variable multiple times
102+
- name: _SignType
103+
value: real
104+
- group: DotNet-HelixApi-Access
105+
106+
# note: Even though they are referenced here, user defined variables (like $(_SignType)) are not resolved
107+
# until the agent is running on the machine. They can be overridden any time before they are resolved,
108+
# like in the job matrix below (see Build_Debug)
109+
- name: _SignArgs
110+
value: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName)
111+
- name: _PublishArgs
112+
value: /p:DotNetPublishUsingPipelines=true
113+
- name: _OfficialBuildIdArgs
114+
value: /p:OfficialBuildId=$(BUILD.BUILDNUMBER)
115+
- name: _PublicBuildPipeline
116+
value: false
117+
- name: _HelixSource
118+
value: official/${{ parameters.repoName }}/$(Build.SourceBranch)
119+
- name: _HelixToken
120+
value: '$(HelixApiAccessToken)' # from DotNet-HelixApi-Access group
121+
- name: _HelixCreator
122+
value: '' #if _HelixToken is set, Creator must be empty
123+
- name: _TestHelixAgentPool
124+
value: 'Windows.10.Amd64.ClientRS5' # Preferred: 'Windows.10.Amd64%3bWindows.7.Amd64%3bWindows.10.Amd64.ClientRS5'
125+
126+
strategy:
127+
matrix:
128+
${{ if eq(parameters.runAsPublic, 'true') }}:
129+
Build_Debug_x86:
130+
_BuildConfig: Debug
131+
# override some variables for debug
132+
# _SignType has to be real for package publishing to succeed - do not override to test.
133+
Build_Release_x86:
134+
_BuildConfig: Release
135+
${{ if eq(parameters.runAsPublic, 'true') }}:
136+
Build_Debug_x64:
137+
_BuildConfig: Debug
138+
# override some variables for debug
139+
# _SignType has to be real for package publishing to succeed - do not override to test.
140+
_Platform: x64
141+
Build_Release_x64:
142+
_BuildConfig: Release
143+
_Platform: x64
144+
${{ if eq(parameters.runAsPublic, 'true') }}:
145+
Build_Debug_arm64:
146+
_BuildConfig: Debug
147+
# override some variables for debug
148+
# _SignType has to be real for package publishing to succeed - do not override to test.
149+
_Platform: arm64
150+
Build_Release_arm64:
151+
_BuildConfig: Release
152+
_Platform: arm64
153+
steps:
154+
- checkout: self
155+
clean: true
156+
157+
# Set VSO Variable(s)
158+
- powershell: eng\pre-build.ps1
159+
displayName: Pre-Build - Set VSO Variables
160+
161+
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
162+
- task: PowerShell@2
163+
displayName: Setup Private Feeds Credentials
164+
inputs:
165+
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
166+
arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
167+
env:
168+
Token: $(dn-bot-dnceng-artifact-feeds-rw)
169+
170+
# Use utility script to run script command dependent on agent OS.
171+
- script: eng\scripts\cibuild.cmd
172+
-configuration $(_BuildConfig)
173+
-prepareMachine
174+
$(_PublishArgs)
175+
$(_SignArgs)
176+
$(_OfficialBuildIdArgs)
177+
$(_PlatformArgs)
178+
$(_InternalRuntimeDownloadArgs)
179+
displayName: Windows Build / Publish
180+
# This condition should be kept in sync with the condition for 'Run DRTs' step
181+
# When building on a regular pipeline (!_HelixPipeline), build as usual
182+
# When building on a Helix pipeline, only build Release configs
183+
# (!_HelixPipeline) ||
184+
# (_HelixPipeline && _PublicBuildPipeline && _ContinuousIntegrationTestsEnabled && _BuildConfig == Release)
185+
condition: or(ne(variables['_HelixPipeline'], 'true'), and(eq(variables['_HelixPipeline'], 'true') ,eq(variables['_BuildConfig'], 'Release'), eq(variables['_PublicBuildPipeline'], 'true'), eq(variables['_ContinuousIntegrationTestsEnabled'], 'true')))
186+
187+
- script: eng\scripts\ciunittest.cmd
188+
-configuration $(_BuildConfig)
189+
-prepareMachine
190+
$(_PublishArgs)
191+
$(_SignArgs)
192+
$(_OfficialBuildIdArgs)
193+
$(_PlatformArgs)
194+
$(_InternalRuntimeDownloadArgs)
195+
displayName: Run xUnit Tests
196+
condition: and(or(ne(variables['_HelixPipeline'], 'true'), and(eq(variables['_HelixPipeline'], 'true') ,eq(variables['_BuildConfig'], 'Release'), eq(variables['_PublicBuildPipeline'], 'true'), eq(variables['_ContinuousIntegrationTestsEnabled'], 'true'))), ne(variables['_Platform'], 'arm64'))
197+
198+
- task: PublishTestResults@2
199+
displayName: Publish XUnit Test Results
200+
inputs:
201+
testResultsFormat: 'xUnit'
202+
testResultsFiles: '*.xml'
203+
searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
204+
mergeTestResults: true
205+
continueOnError: true
206+
condition: and(eq(variables['_BuildConfig'], 'Release'), ne(variables['_Platform'], 'arm64'))
207+
208+
- task: PowerShell@2
209+
displayName: Install .NET Core
210+
inputs:
211+
filePath: $(Build.SourcesDirectory)/dotnet-test-install.ps1
212+
arguments: -InstallDir $(_programfiles) -Architecture $(_Platform) -Runtime dotnet -Channel 8.0 -Quality daily
213+
condition: eq(variables['_Platform'], 'x64')
214+
215+
- task: PowerShell@2
216+
displayName: Install .NET Core(x86)
217+
inputs:
218+
filePath: $(Build.SourcesDirectory)/dotnet-test-install.ps1
219+
arguments: -InstallDir $(_programfilesx86) -Architecture $(_Platform) -Runtime dotnet -Channel 8.0 -Quality daily
220+
condition: eq(variables['_Platform'], 'x86')
221+
222+
- task: PowerShell@2
223+
displayName: Install .NET WindowsDesktop
224+
inputs:
225+
filePath: $(Build.SourcesDirectory)/dotnet-test-install.ps1
226+
arguments: -InstallDir $(_programfiles) -Architecture $(_Platform) -Runtime windowsdesktop -Channel 8.0 -Quality daily
227+
condition: eq(variables['_Platform'], 'x64')
228+
229+
- task: PowerShell@2
230+
displayName: Install .NET WindowsDesktop(x86)
231+
inputs:
232+
filePath: $(Build.SourcesDirectory)/dotnet-test-install.ps1
233+
arguments: -InstallDir $(_programfilesx86) -Architecture $(_Platform) -Runtime windowsdesktop -Channel 8.0 -Quality daily
234+
condition: eq(variables['_Platform'], 'x86')
235+
236+
- task: PowerShell@2
237+
displayName: Replace WPF binaries
238+
inputs:
239+
targetType: 'inline'
240+
script: '.\eng\copy-wpf.ps1 -testhost -destination .dotnet -$(_BuildConfig) -arch $(_Platform)'
241+
condition: and(eq(variables['System.TeamProject'], 'public'), ne(variables['_Platform'], 'arm64'))
242+
243+
- task: DownloadPipelineArtifact@2
244+
displayName: Fetch Test Binaries
245+
inputs:
246+
buildType: 'specific'
247+
project: 'cbb18261-c48f-4abb-8651-8cdcb5474649'
248+
pipeline: '81'
249+
buildVersionToDownload: 'latestFromBranch'
250+
branchName: 'refs/heads/main'
251+
downloadPath: '$(System.ArtifactsDirectory)\testbinzip\'
252+
checkDownloadedFiles: true
253+
artifactName: Tests.$(_BuildConfig).$(_Platform).zip
254+
condition: and(eq(variables['System.TeamProject'], 'public'), ne(variables['_Platform'], 'arm64'))
255+
256+
- task: ExtractFiles@1
257+
displayName: Extract Test Bins
258+
inputs:
259+
archiveFilePatterns: '$(System.ArtifactsDirectory)\testbinzip\*.zip'
260+
destinationFolder: '$(System.ArtifactsDirectory)\testbins'
261+
cleanDestinationFolder: true
262+
overwriteExistingFiles: true
263+
condition: and(eq(variables['System.TeamProject'], 'public'), ne(variables['_Platform'], 'arm64'))
264+
265+
- task: PowerShell@2
266+
displayName: Run Tests
267+
inputs:
268+
targetType: 'inline'
269+
script: '.\CIRunDrts.cmd'
270+
workingDirectory: '$(System.ArtifactsDirectory)\testbins'
271+
condition: and(eq(variables['System.TeamProject'], 'public'), ne(variables['_Platform'], 'arm64'))
272+
273+
- task: CopyFiles@2
274+
inputs:
275+
SourceFolder: 'C:\Users\cloudtest\AppData\Roaming\QualityVault\Run\Report\'
276+
Contents: '**'
277+
TargetFolder: '$(System.DefaultWorkingDirectory)\Results\'
278+
CleanTargetFolder: true
279+
OverWrite: true
280+
condition: and(eq(variables['System.TeamProject'], 'public'), eq(variables['_Platform'], 'x64'), eq(variables['_BuildConfig'], 'Release'))
281+
282+
- task: CopyFiles@2
283+
inputs:
284+
SourceFolder: 'C:\Users\cloudtest\AppData\Roaming\QualityVault\Run\Report\'
285+
Contents: '**'
286+
TargetFolder: '$(System.DefaultWorkingDirectory)\ResultsX86\'
287+
CleanTargetFolder: true
288+
OverWrite: true
289+
condition: and(eq(variables['System.TeamProject'], 'public'), eq(variables['_Platform'], 'x86'), eq(variables['_BuildConfig'], 'Release'))
290+
291+
- task: PublishPipelineArtifact@1
292+
inputs:
293+
artifactName: 'TestResultsX64'
294+
targetPath: '$(System.DefaultWorkingDirectory)\Results\'
295+
condition: and(eq(variables['System.TeamProject'], 'public'), eq(variables['_Platform'], 'x64'), eq(variables['_BuildConfig'], 'Release'))
296+
297+
- task: PublishPipelineArtifact@1
298+
inputs:
299+
artifactName: 'TestResultsX86'
300+
targetPath: '$(System.DefaultWorkingDirectory)\ResultsX86\'
301+
condition: and(eq(variables['System.TeamProject'], 'public'), eq(variables['_Platform'], 'x86'), eq(variables['_BuildConfig'], 'Release'))
302+
303+
- task: PublishTestResults@2
304+
inputs:
305+
testResultsFormat: 'XUnit'
306+
testResultsFiles: 'testResults.xml'
307+
searchFolder: '$(System.DefaultWorkingDirectory)\Results\'
308+
testRunTitle: 'Test results'
309+
mergeTestResults: true
310+
condition: eq(variables['System.TeamProject'], 'public')

0 commit comments

Comments
 (0)