pipeline.yml 10.5 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 33 34 35 36 37
    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') }}:
          name: NetCore1ESPool-Public
          demands: ImageOverride -equals Build.Windows.Amd64.VS2022.Pre.Open
        ${{ if eq(variables['System.TeamProject'], 'internal') }}:
          name: NetCore1ESPool-Internal
          demands: ImageOverride -equals Build.Windows.Amd64.VS2022.Pre
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') }}:
48
          name: NetCore1ESPool-Public
49
          demands: ImageOverride -equals Build.Windows.Amd64.VS2022.Pre.Open
50
        ${{ if eq(variables['System.TeamProject'], 'internal') }}:
51
          name: NetCore1ESPool-Internal
52
          demands: ImageOverride -equals Build.Windows.Amd64.VS2022.Pre
S
Steven Kirbach 已提交
53 54
      variables:
        # needed for signing
S
Steven Kirbach 已提交
55
        - name: _TeamName
S
Steven Kirbach 已提交
56
          value: DotNetCore
S
Steven Kirbach 已提交
57
        - name: _SignType
58
          value: real
S
Steven Kirbach 已提交
59
        - name: _SignArgs
S
Steven Kirbach 已提交
60
          value: ''
S
Steven Kirbach 已提交
61
        - name: _PublishArgs
S
Steven Kirbach 已提交
62
          value: ''
S
Steven Kirbach 已提交
63
        - name: _OfficialBuildIdArgs
S
Steven Kirbach 已提交
64
          value: ''
S
Steven Kirbach 已提交
65 66
        - name: _Platform
          value: x86
67 68
        - name: _PlatformArgs
          value: /p:Platform=$(_Platform)
V
Vatsan Madhavan 已提交
69 70
        - 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
71
        - name: _TestHelixAgentPool
72
          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
73 74 75 76 77 78 79 80
        - name: _HelixStagingDir
          value: $(BUILD.STAGINGDIRECTORY)\helix\functests
        - name: _HelixSource
          value: ${{ parameters.repoName }}/$(Build.SourceBranch)
        - name: _HelixToken
          value: ''
        - name: _HelixCreator
          value: ${{ parameters.repoName }}
81 82 83 84
        - ${{ if ne(variables['System.TeamProject'], 'internal') }}:
          - name: _InternalRuntimeDownloadArgs
            value: ''
        - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
M
Matt Mitchell 已提交
85
          - group: DotNetBuilds storage account read tokens
86 87 88
          - group: AzureDevOps-Artifact-Feeds-Pats
          - name: _InternalRuntimeDownloadArgs
            value: >-
M
Matt Mitchell 已提交
89 90
              /p:DotNetRuntimeSourceFeed=https://dotnetbuilds.blob.core.windows.net/internal
              /p:DotNetRuntimeSourceFeedKey=$(dotnetbuilds-internal-container-read-token-base64)
V
Vatsan Madhavan 已提交
91

S
Steven Kirbach 已提交
92 93 94

        # Override some values if we're building internally
        - ${{ if eq(parameters.runAsPublic, 'false') }}:
S
Steven Kirbach 已提交
95
          # 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 已提交
96 97
          - name: _SignType
            value: real
98
          - group: DotNet-HelixApi-Access
S
Steven Kirbach 已提交
99 100 101 102 103 104 105

          # 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 已提交
106
            value: /p:DotNetPublishUsingPipelines=true
S
Steven Kirbach 已提交
107 108
          - name: _OfficialBuildIdArgs
            value: /p:OfficialBuildId=$(BUILD.BUILDNUMBER)
V
Vatsan Madhavan 已提交
109 110
          - name: _PublicBuildPipeline
            value: false
111 112 113 114 115 116
          - 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 已提交
117
          - name: _TestHelixAgentPool
118
            value: 'Windows.10.Amd64.ClientRS5' # Preferred: 'Windows.10.Amd64%3bWindows.7.Amd64%3bWindows.10.Amd64.ClientRS5'
V
Vatsan Madhavan 已提交
119

S
Steven Kirbach 已提交
120 121
      strategy:
        matrix:
122 123 124 125 126
          ${{ 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 已提交
127
          Build_Release_x86:
S
Steven Kirbach 已提交
128
            _BuildConfig: Release
129 130 131 132 133 134
          ${{ 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 已提交
135 136 137
          Build_Release_x64:
            _BuildConfig: Release
            _Platform: x64
138 139 140 141 142 143 144 145 146
          ${{ 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 已提交
147 148 149
      steps:
      - checkout: self
        clean: true
150 151 152 153 154

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

155 156 157 158 159 160 161 162 163
      - ${{ 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 已提交
164 165 166 167 168 169 170
      # 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 已提交
171
          $(_PlatformArgs)
172
          $(_InternalRuntimeDownloadArgs)
173
        displayName: Windows Build / Publish
174
        # This condition should be kept in sync with the condition for 'Run DRTs' step 
V
Vatsan Madhavan 已提交
175 176 177 178 179
        #   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')))
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196

      # Run DRTs
      - powershell: eng\common\cibuild.cmd
          -configuration $(_BuildConfig)
          $(_OfficialBuildIdArgs) 
          $(_PlatformArgs)
          -projects $(Build.SourcesDirectory)\eng\helixpublish.proj
          /bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\HelixDrt.binlog
        displayName: Run Developer Regression Tests on Helix Machine (Release)
        env:
          HelixSource: $(_HelixSource)
          HelixType: 'tests/drt'
          HelixBuild: $(Build.BuildNumber)
          HelixTargetQueues: $(_TestHelixAgentPool)
          HelixAccessToken: $(_HelixToken)              # only defined for internal CI
          Creator: $(_HelixCreator)
          SYSTEM_ACCESSTOKEN: $(System.AccessToken)
V
Vatsan Madhavan 已提交
197 198 199 200 201 202
        # This condition should be kept in sync with the condition for cibuild.cmd step with displayName: "Windows Build / Publish"
        # Only run ...
        # ...When building on a Helix pipeline, only build Release configs
        #
        #   (_HelixPipeline && _PublicBuildPipeline && _ContinuousIntegrationTestsEnabled && _BuildConfig == Release)
        #
V
Vatsan Madhavan 已提交
203
        condition: and(succeeded(), eq(variables['_HelixPipeline'], 'true') ,eq(variables['_BuildConfig'], 'Release'), eq(variables['_PublicBuildPipeline'], 'true'), eq(variables['_ContinuousIntegrationTestsEnabled'], 'true'))
204

205 206 207 208 209 210 211 212 213 214 215 216 217
      - task: PowerShell@2
        displayName: Replace WPF binaries
        inputs:
          targetType: 'inline'
          script: '.\eng\copy-wpf.ps1 -testhost -destination .dotnet -$(_BuildConfig) -arch $(_Platform)'
          
      - task: DownloadBuildArtifacts@1
        displayName: Fetch Test Binaries
        inputs:
          buildType: 'specific'
          project: '9ee6d478-d288-47f7-aacc-f6e6d082ae6d'
          pipeline: '1145'
          buildVersionToDownload: 'specific'
A
Ashish Singh 已提交
218
          buildId: '1934148'
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
          downloadPath: '$(System.ArtifactsDirectory)\testbinzip\'
          checkDownloadedFiles: true

      - task: ExtractFiles@1
        displayName: Extract Test Bins
        inputs:
          archiveFilePatterns: '$(System.ArtifactsDirectory)\testbinzip\*.zip'
          destinationFolder: '$(System.ArtifactsDirectory)\testbins'
          cleanDestinationFolder: true
          overwriteExistingFiles: false

      - task: PowerShell@2
        displayName: Run Tests
        inputs:
          targetType: 'inline'
          script: '.\CIRunDrts.cmd'
          workingDirectory: '$(System.ArtifactsDirectory)\testbins'