pipeline.yml 8.9 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
C
Cesar Soares Lucas 已提交
25
    enablePublishUsingPipelines: $(_PublishUsingPipelines)
S
Steven Kirbach 已提交
26
    enableTelemetry: true
27
    helixRepo: $(repoName)
S
Steven Kirbach 已提交
28

S
Steven Kirbach 已提交
29 30
    jobs:
    - job: Windows_NT
31
      timeoutInMinutes: 120  # how long to run the job before automatically cancelling; see https://github.com/dotnet/wpf/issues/952
32
      pool:
33
        # For public jobs, use the hosted pool.  For internal jobs use the internal pool.
34
        # Will eventually change this to two BYOC pools.
35
        # agent pool can't be read from a user-defined variable (Azure DevOps limitation)
36
        ${{ if eq(variables['System.TeamProject'], 'public') }}:
37 38
          name: NetCorePublic-Pool
          queue: BuildPool.Windows.10.Amd64.VS2019.Pre.Open
39
        ${{ if eq(variables['System.TeamProject'], 'internal') }}:
40
          name: NetCoreInternal-Pool
41
          queue: buildpool.windows.10.amd64.vs2019.pre
S
Steven Kirbach 已提交
42 43
      variables:
        # needed for signing
S
Steven Kirbach 已提交
44
        - name: _TeamName
S
Steven Kirbach 已提交
45
          value: DotNetCore
S
Steven Kirbach 已提交
46
        - name: _SignType
47
          value: real
S
Steven Kirbach 已提交
48
        - name: _SignArgs
S
Steven Kirbach 已提交
49
          value: ''
S
Steven Kirbach 已提交
50
        - name: _PublishArgs
S
Steven Kirbach 已提交
51
          value: ''
S
Steven Kirbach 已提交
52
        - name: _OfficialBuildIdArgs
S
Steven Kirbach 已提交
53
          value: ''
S
Steven Kirbach 已提交
54 55
        - name: _Platform
          value: x86
56 57
        - name: _PlatformArgs
          value: /p:Platform=$(_Platform)
V
Vatsan Madhavan 已提交
58 59
        - 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
60
        - name: _TestHelixAgentPool
61
          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
62 63 64 65 66 67 68 69
        - name: _HelixStagingDir
          value: $(BUILD.STAGINGDIRECTORY)\helix\functests
        - name: _HelixSource
          value: ${{ parameters.repoName }}/$(Build.SourceBranch)
        - name: _HelixToken
          value: ''
        - name: _HelixCreator
          value: ${{ parameters.repoName }}
70 71 72 73 74 75 76 77 78 79
        - ${{ if ne(variables['System.TeamProject'], 'internal') }}:
          - name: _InternalRuntimeDownloadArgs
            value: ''
        - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
          - group: DotNet-MSRC-Storage
          - group: AzureDevOps-Artifact-Feeds-Pats
          - name: _InternalRuntimeDownloadArgs
            value: >-
              /p:DotNetRuntimeSourceFeed=https://dotnetclimsrc.blob.core.windows.net/dotnet
              /p:DotNetRuntimeSourceFeedKey=$(dotnetclimsrc-read-sas-token-base64)
V
Vatsan Madhavan 已提交
80

S
Steven Kirbach 已提交
81 82 83

        # Override some values if we're building internally
        - ${{ if eq(parameters.runAsPublic, 'false') }}:
S
Steven Kirbach 已提交
84
          # 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 已提交
85 86 87 88
          - name: _SignType
            value: real
          - group: DotNet-Blob-Feed
          - group: DotNet-Symbol-Server-Pats
89
          - group: DotNet-HelixApi-Access
S
Steven Kirbach 已提交
90 91 92 93 94 95 96

          # 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
97
            value: 
98
              /p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines)
S
Steven Kirbach 已提交
99 100
          - name: _OfficialBuildIdArgs
            value: /p:OfficialBuildId=$(BUILD.BUILDNUMBER)
V
Vatsan Madhavan 已提交
101 102
          - name: _PublicBuildPipeline
            value: false
103 104 105 106 107 108
          - 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 已提交
109
          - name: _TestHelixAgentPool
110
            value: 'Windows.10.Amd64.ClientRS5' # Preferred: 'Windows.10.Amd64%3bWindows.7.Amd64%3bWindows.10.Amd64.ClientRS5'
V
Vatsan Madhavan 已提交
111

S
Steven Kirbach 已提交
112 113
      strategy:
        matrix:
114 115 116 117 118
          ${{ 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 已提交
119
          Build_Release_x86:
S
Steven Kirbach 已提交
120
            _BuildConfig: Release
121 122 123 124 125 126
          ${{ 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 已提交
127 128 129
          Build_Release_x64:
            _BuildConfig: Release
            _Platform: x64
130 131 132 133 134 135 136 137 138
          ${{ 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 已提交
139 140 141
      steps:
      - checkout: self
        clean: true
142 143 144 145 146

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

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

      # 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 已提交
189 190 191 192 193 194
        # 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 已提交
195
        condition: and(succeeded(), eq(variables['_HelixPipeline'], 'true') ,eq(variables['_BuildConfig'], 'Release'), eq(variables['_PublicBuildPipeline'], 'true'), eq(variables['_ContinuousIntegrationTestsEnabled'], 'true'))
196