summaryrefslogtreecommitdiff
path: root/eng/common/templates/job/performance.yml
blob: f877fd7a898004eeac25377fa7567ab011d646c4 (plain)
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
parameters:
  steps: []                       # optional -- any additional steps that need to happen before pulling down the performance repo and sending the performance benchmarks to helix (ie building your repo)
  variables: []                   # optional -- list of additional variables to send to the template
  jobName: ''                     # required -- job name
  displayName: ''                 # optional -- display name for the job. Will use jobName if not passed
  pool: ''                        # required -- name of the Build pool
  container: ''                   # required -- name of the container
  osGroup: ''                     # required -- operating system for the job
  extraSetupParameters: ''        # optional -- extra arguments to pass to the setup script
  frameworks: ['netcoreapp3.0']   # optional -- list of frameworks to run against
  continueOnError: 'false'        # optional -- determines whether to continue the build if the step errors
  dependsOn: ''                   # optional -- dependencies of the job
  timeoutInMinutes: 320           # optional -- timeout for the job
  enableTelemetry: false          # optional -- enable for telemetry

jobs:
- template: ../jobs/jobs.yml
  parameters:
    dependsOn: ${{ parameters.dependsOn }}
    enableTelemetry: ${{ parameters.enableTelemetry }}
    enablePublishBuildArtifacts: true
    continueOnError: ${{ parameters.continueOnError }}
    
    jobs:
      - job: '${{ parameters.jobName }}'

        ${{ if ne(parameters.displayName, '') }}:
          displayName: '${{ parameters.displayName }}'
        ${{ if eq(parameters.displayName, '') }}:
          displayName: '${{ parameters.jobName }}'

        timeoutInMinutes: ${{ parameters.timeoutInMinutes }}

        variables:

        - ${{ each variable in parameters.variables }}:
          - ${{ if ne(variable.name, '') }}:
            - name: ${{ variable.name }}
              value: ${{ variable.value }}
          - ${{ if ne(variable.group, '') }}:
            - group: ${{ variable.group }}

        - IsInternal: ''
        - HelixApiAccessToken: ''
        - HelixPreCommand: ''

        - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
          - ${{ if eq( parameters.osGroup, 'Windows_NT') }}:
            - HelixPreCommand: 'set "PERFLAB_UPLOAD_TOKEN=$(PerfCommandUploadToken)"'
            - IsInternal: -Internal
          - ${{ if ne(parameters.osGroup, 'Windows_NT') }}:
            - HelixPreCommand: 'export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"'
            - IsInternal: --internal
            
          - group: DotNet-HelixApi-Access
          - group: dotnet-benchview

        workspace:
          clean: all
        pool:
          ${{ parameters.pool }}
        container: ${{ parameters.container }}
        strategy:
          matrix:
            ${{ each framework in parameters.frameworks }}:
              ${{ framework }}:
                _Framework: ${{ framework }}
        steps:
        - checkout: self
          clean: true
        # Run all of the steps to setup repo
        - ${{ each step in parameters.steps }}:
          - ${{ step }}
        - powershell: $(Build.SourcesDirectory)\eng\common\performance\performance-setup.ps1 $(IsInternal) -Framework $(_Framework) ${{ parameters.extraSetupParameters }}
          displayName: Performance Setup (Windows)
          condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT'))
          continueOnError: ${{ parameters.continueOnError }}
        - script: $(Build.SourcesDirectory)/eng/common/performance/performance-setup.sh $(IsInternal) --framework $(_Framework) ${{ parameters.extraSetupParameters }}
          displayName: Performance Setup (Unix)
          condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT'))
          continueOnError: ${{ parameters.continueOnError }}
        - script: $(Python) $(PerformanceDirectory)/scripts/ci_setup.py $(SetupArguments)
          displayName: Run ci setup script
        # Run perf testing in helix
        - template: /eng/common/templates/steps/perf-send-to-helix.yml
          parameters:
            HelixSource: '$(HelixSourcePrefix)/$(Build.Repository.Name)/$(Build.SourceBranch)' # sources must start with pr/, official/, prodcon/, or agent/
            HelixType: 'test/performance/$(Kind)/$(_Framework)/$(Architecture)'
            HelixAccessToken: $(HelixApiAccessToken)
            HelixTargetQueues: $(Queue)
            HelixPreCommands: $(HelixPreCommand)
            Creator: $(Creator)
            WorkItemTimeout: 4:00 # 4 hours
            WorkItemDirectory: '$(WorkItemDirectory)' # WorkItemDirectory can not be empty, so we send it some docs to keep it happy
            CorrelationPayloadDirectory: '$(PayloadDirectory)' # it gets checked out to a folder with shorter path than WorkItemDirectory so we can avoid file name too long exceptions