pipeline.yml 13.0 KB
Newer Older
1 2 3 4
#
# This file should be kept in sync across https://www.github.com/dotnet/wpf and dotnet-wpf-int repos. 
#
# 
S
Steven Kirbach 已提交
5

6
parameters:
S
Steven Kirbach 已提交
7 8 9
  # Needed because runAsPublic is used in template expressions, which can't read from user-defined variables
  # Defaults to true
  runAsPublic: true
10
  repoName: dotnet/wpf
S
Steven Kirbach 已提交
11

S
Steven Kirbach 已提交
12
jobs:
J
Jon Fortescue 已提交
13
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) }}:
J
Jon Fortescue 已提交
14 15
  - template: /eng/common/templates/job/onelocbuild.yml
    parameters:
J
Jon Fortescue 已提交
16
      MirrorRepo: wpf
J
Jon Fortescue 已提交
17 18
      LclSource: lclFilesfromPackage
      LclPackageId: 'LCL-JUNO-PROD-WPF'
S
Steven Kirbach 已提交
19
- template: /eng/common/templates/jobs/jobs.yml
S
Steven Kirbach 已提交
20
  parameters:
S
Steven Kirbach 已提交
21 22
    enableMicrobuild: true
    enablePublishBuildArtifacts: true
23
    enablePublishTestResults: false # tests run in helix
S
Steven Kirbach 已提交
24
    enablePublishBuildAssets: true
M
Matt Mitchell 已提交
25
    enablePublishUsingPipelines: true
S
Steven Kirbach 已提交
26
    enableTelemetry: true
27 28 29 30 31 32
    enableSourceIndex: true
    sourceIndexParams:
      condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
      binlogPath: artifacts/log/Debug/x86/Build.binlog
      pool:
        ${{ if eq(variables['System.TeamProject'], 'public') }}:
A
Alex Perovich 已提交
33
          name: NetCore-Public
R
Rishabh Chauhan 已提交
34
          demands: ImageOverride -equals windows.vs2022preview.amd64.Open
35 36
        ${{ if eq(variables['System.TeamProject'], 'internal') }}:
          name: NetCore1ESPool-Internal
R
Rishabh Chauhan 已提交
37
          demands: ImageOverride -equals windows.vs2022preview.amd64
38
    helixRepo: $(repoName)
S
Steven Kirbach 已提交
39

S
Steven Kirbach 已提交
40 41
    jobs:
    - 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') }}:
A
Alex Perovich 已提交
48
          name: NetCore-Public
R
Rishabh Chauhan 已提交
49
          demands: ImageOverride -equals windows.vs2022preview.amd64.Open
50
        ${{ if eq(variables['System.TeamProject'], 'internal') }}:
51
          name: NetCore1ESPool-Internal
R
Rishabh Chauhan 已提交
52
          demands: ImageOverride -equals windows.vs2022preview.amd64
S
Steven Kirbach 已提交
53
      variables:
R
Rishabh Chauhan 已提交
54 55
        - name: Codeql.Enabled
          value: true
S
Steven Kirbach 已提交
56
        # needed for signing
S
Steven Kirbach 已提交
57
        - name: _TeamName
S
Steven Kirbach 已提交
58
          value: DotNetCore
S
Steven Kirbach 已提交
59
        - name: _SignType
60
          value: real
S
Steven Kirbach 已提交
61
        - name: _SignArgs
S
Steven Kirbach 已提交
62
          value: ''
S
Steven Kirbach 已提交
63
        - name: _PublishArgs
S
Steven Kirbach 已提交
64
          value: ''
S
Steven Kirbach 已提交
65
        - name: _OfficialBuildIdArgs
S
Steven Kirbach 已提交
66
          value: ''
S
Steven Kirbach 已提交
67 68
        - name: _Platform
          value: x86
69 70
        - name: _PlatformArgs
          value: /p:Platform=$(_Platform)
V
Vatsan Madhavan 已提交
71 72
        - 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
          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 76 77 78 79 80 81 82
        - name: _HelixStagingDir
          value: $(BUILD.STAGINGDIRECTORY)\helix\functests
        - name: _HelixSource
          value: ${{ parameters.repoName }}/$(Build.SourceBranch)
        - name: _HelixToken
          value: ''
        - name: _HelixCreator
          value: ${{ parameters.repoName }}
83 84 85 86
        - name: _programfilesx86
          value: ${Env:ProgramFiles(x86)}/dotnet          
        - name: _programfiles
          value:  ${Env:ProgramFiles}/dotnet
87 88 89 90
        - ${{ if ne(variables['System.TeamProject'], 'internal') }}:
          - name: _InternalRuntimeDownloadArgs
            value: ''
        - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
M
Matt Mitchell 已提交
91
          - group: DotNetBuilds storage account read tokens
92 93 94
          - group: AzureDevOps-Artifact-Feeds-Pats
          - name: _InternalRuntimeDownloadArgs
            value: >-
M
Matt Mitchell 已提交
95 96
              /p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal
              /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64)
V
Vatsan Madhavan 已提交
97

S
Steven Kirbach 已提交
98 99 100

        # Override some values if we're building internally
        - ${{ if eq(parameters.runAsPublic, 'false') }}:
S
Steven Kirbach 已提交
101
          # note: You have to use list syntax here (- name: value) or you will get errors about declaring the same variable multiple times
S
Steven Kirbach 已提交
102 103
          - name: _SignType
            value: real
104
          - group: DotNet-HelixApi-Access
S
Steven Kirbach 已提交
105 106 107 108 109 110 111

          # note: Even though they are referenced here, user defined variables (like $(_SignType)) are not resolved 
          # until the agent is running on the machine. They can be overridden any time before they are resolved,
          # like in the job matrix below (see Build_Debug)
          - name: _SignArgs
            value: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName)
          - name: _PublishArgs
M
Matt Mitchell 已提交
112
            value: /p:DotNetPublishUsingPipelines=true
S
Steven Kirbach 已提交
113 114
          - name: _OfficialBuildIdArgs
            value: /p:OfficialBuildId=$(BUILD.BUILDNUMBER)
V
Vatsan Madhavan 已提交
115 116
          - name: _PublicBuildPipeline
            value: false
117 118 119 120 121 122
          - name: _HelixSource
            value: official/${{ parameters.repoName }}/$(Build.SourceBranch)
          - name: _HelixToken
            value: '$(HelixApiAccessToken)' # from DotNet-HelixApi-Access group
          - name: _HelixCreator
            value: '' #if _HelixToken is set, Creator must be empty
S
Steven Kirbach 已提交
123
          - name: _TestHelixAgentPool
124
            value: 'Windows.10.Amd64.ClientRS5' # Preferred: 'Windows.10.Amd64%3bWindows.7.Amd64%3bWindows.10.Amd64.ClientRS5'
V
Vatsan Madhavan 已提交
125

S
Steven Kirbach 已提交
126 127
      strategy:
        matrix:
128 129 130 131 132
          ${{ if eq(parameters.runAsPublic, 'true') }}:
            Build_Debug_x86:
              _BuildConfig: Debug
              # override some variables for debug
              # _SignType has to be real for package publishing to succeed - do not override to test.
S
Steven Kirbach 已提交
133
          Build_Release_x86:
S
Steven Kirbach 已提交
134
            _BuildConfig: Release
135 136 137 138 139 140
          ${{ if eq(parameters.runAsPublic, 'true') }}:
            Build_Debug_x64:
              _BuildConfig: Debug
              # override some variables for debug
              # _SignType has to be real for package publishing to succeed - do not override to test.
              _Platform: x64
S
Steven Kirbach 已提交
141 142 143
          Build_Release_x64:
            _BuildConfig: Release
            _Platform: x64
144 145 146 147 148 149 150 151 152
          ${{ if eq(parameters.runAsPublic, 'true') }}:
            Build_Debug_arm64:
              _BuildConfig: Debug
              # override some variables for debug
              # _SignType has to be real for package publishing to succeed - do not override to test.
              _Platform: arm64
          Build_Release_arm64:
            _BuildConfig: Release
            _Platform: arm64
S
Steven Kirbach 已提交
153 154 155
      steps:
      - checkout: self
        clean: true
156 157 158 159 160

      # Set VSO Variable(s)
      - powershell: eng\pre-build.ps1
        displayName: Pre-Build - Set VSO Variables

161 162 163 164 165 166 167 168 169
      - ${{ if ne(variables['System.TeamProject'], 'public') }}:
        - task: PowerShell@2
          displayName: Setup Private Feeds Credentials
          inputs:
            filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
            arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
          env:
            Token: $(dn-bot-dnceng-artifact-feeds-rw)

S
Steven Kirbach 已提交
170 171 172 173 174 175 176
      # Use utility script to run script command dependent on agent OS.
      - script: eng\common\cibuild.cmd
          -configuration $(_BuildConfig) 
          -prepareMachine
          $(_PublishArgs)
          $(_SignArgs)
          $(_OfficialBuildIdArgs)
S
Steven Kirbach 已提交
177
          $(_PlatformArgs)
178
          $(_InternalRuntimeDownloadArgs)
179
        displayName: Windows Build / Publish
180
        # This condition should be kept in sync with the condition for 'Run DRTs' step 
V
Vatsan Madhavan 已提交
181 182 183 184 185
        #   When building on a regular pipeline (!_HelixPipeline), build as usual 
        #   When building on a Helix pipeline, only build Release configs
        #   (!_HelixPipeline) ||
        #   (_HelixPipeline && _PublicBuildPipeline && _ContinuousIntegrationTestsEnabled && _BuildConfig == Release)
        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 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
      - task: PowerShell@2
        displayName: Install .NET Core
        inputs:
          filePath: $(Build.SourcesDirectory)/dotnet-test-install.ps1
          arguments: -InstallDir $(_programfiles) -Architecture $(_Platform) -Runtime dotnet -Version 8.0.0-preview.3.23174.8
          condition: eq(variables['_Platform'], 'x64')
      
      - task: PowerShell@2
        displayName: Install .NET Core(x86)
        inputs:
          filePath: $(Build.SourcesDirectory)/dotnet-test-install.ps1
          arguments: -InstallDir $(_programfilesx86) -Architecture $(_Platform) -Runtime dotnet -Version 8.0.0-preview.3.23174.8
        condition: eq(variables['_Platform'], 'x86')
  
      - task: PowerShell@2
        displayName: Install .NET WindowsDesktop
        inputs:
          filePath: $(Build.SourcesDirectory)/dotnet-test-install.ps1
          arguments: -InstallDir $(_programfiles) -Architecture $(_Platform) -Runtime windowsdesktop -Version 8.0.0-preview.3.23178.1
        condition: eq(variables['_Platform'], 'x64')
     
      - task: PowerShell@2
        displayName: Install .NET WindowsDesktop(x86)
        inputs:
          filePath: $(Build.SourcesDirectory)/dotnet-test-install.ps1
          arguments: -InstallDir $(_programfilesx86) -Architecture $(_Platform) -Runtime windowsdesktop -Version 8.0.0-preview.3.23178.1
        condition: eq(variables['_Platform'], 'x86')  

A
Ashish Kumar Singh 已提交
215 216 217 218 219
      - task: PowerShell@2
        displayName: Replace WPF binaries
        inputs:
          targetType: 'inline'
          script: '.\eng\copy-wpf.ps1 -testhost -destination .dotnet -$(_BuildConfig) -arch $(_Platform)'
A
Ashish Kumar Singh 已提交
220
        condition: and(eq(variables['System.TeamProject'], 'public'), ne(variables['_Platform'], 'arm64'))
A
Ashish Kumar Singh 已提交
221 222 223 224 225 226 227

      - task: DownloadPipelineArtifact@2
        displayName: Fetch Test Binaries
        inputs:
          buildType: 'specific'
          project: 'cbb18261-c48f-4abb-8651-8cdcb5474649'
          pipeline: '81'
228 229
          buildVersionToDownload: 'latestFromBranch'
          branchName: 'refs/heads/main'
A
Ashish Kumar Singh 已提交
230 231
          downloadPath: '$(System.ArtifactsDirectory)\testbinzip\'
          checkDownloadedFiles: true
A
Ashish Kumar Singh 已提交
232 233
          artifactName: Tests.$(_BuildConfig).$(_Platform).zip
        condition: and(eq(variables['System.TeamProject'], 'public'), ne(variables['_Platform'], 'arm64'))
A
Ashish Kumar Singh 已提交
234 235 236 237

      - task: ExtractFiles@1
        displayName: Extract Test Bins
        inputs:
A
Ashish Kumar Singh 已提交
238
          archiveFilePatterns: '$(System.ArtifactsDirectory)\testbinzip\*.zip'
A
Ashish Kumar Singh 已提交
239 240 241
          destinationFolder: '$(System.ArtifactsDirectory)\testbins'
          cleanDestinationFolder: true
          overwriteExistingFiles: true
A
Ashish Kumar Singh 已提交
242
        condition: and(eq(variables['System.TeamProject'], 'public'), ne(variables['_Platform'], 'arm64'))
A
Ashish Kumar Singh 已提交
243 244 245 246 247 248

      - task: PowerShell@2
        displayName: Run Tests
        inputs:
          targetType: 'inline'
          script: '.\CIRunDrts.cmd'
249
          workingDirectory: '$(System.ArtifactsDirectory)\testbins'
A
Ashish Kumar Singh 已提交
250
        condition: and(eq(variables['System.TeamProject'], 'public'), ne(variables['_Platform'], 'arm64'))
251
      
252 253 254 255 256 257 258 259
      - task: CopyFiles@2
        inputs:
          SourceFolder: 'C:\Users\cloudtest\AppData\Roaming\QualityVault\Run\Report\'
          Contents: '**'
          TargetFolder: '$(System.DefaultWorkingDirectory)\Results\'
          CleanTargetFolder: true
          OverWrite: true
        condition: and(eq(variables['System.TeamProject'], 'public'), eq(variables['_Platform'], 'x64'), eq(variables['_BuildConfig'], 'Release'))
260
        
261 262 263 264 265 266 267 268
      - task: CopyFiles@2
        inputs:
          SourceFolder: 'C:\Users\cloudtest\AppData\Roaming\QualityVault\Run\Report\'
          Contents: '**'
          TargetFolder: '$(System.DefaultWorkingDirectory)\ResultsX86\'
          CleanTargetFolder: true
          OverWrite: true
        condition: and(eq(variables['System.TeamProject'], 'public'), eq(variables['_Platform'], 'x86'), eq(variables['_BuildConfig'], 'Release'))
269

270 271 272 273 274
      - task: PublishPipelineArtifact@1
        inputs:
          artifactName: 'TestResultsX64'
          targetPath: '$(System.DefaultWorkingDirectory)\Results\'      
        condition: and(eq(variables['System.TeamProject'], 'public'), eq(variables['_Platform'], 'x64'), eq(variables['_BuildConfig'], 'Release'))
275

276 277 278 279 280
      - task: PublishPipelineArtifact@1
        inputs:
          artifactName: 'TestResultsX86'
          targetPath: '$(System.DefaultWorkingDirectory)\ResultsX86\'
        condition: and(eq(variables['System.TeamProject'], 'public'), eq(variables['_Platform'], 'x86'), eq(variables['_BuildConfig'], 'Release'))
281
          
282 283 284 285 286 287 288
      - task: PublishTestResults@2
        inputs:
          testResultsFormat: 'XUnit'
          testResultsFiles: 'testResults.xml'
          searchFolder: '$(System.DefaultWorkingDirectory)\Results\'
          testRunTitle: 'CTP results'
          condition: eq(variables['System.TeamProject'], 'public')