<commit_before>parameters:
- name: Variables
  type: object
  default: []
- name: OperatingSystems
  type: string
  default: 'Linux'
- name: Language
  type: string
  default: ''
- name: InstallLanguageSteps
  type: stepList
  default: []
- name: ServiceDirectory
  type: string
  default: ''
- name: Services
  type: string
  default: ''
- name: PackageVersions
  type: string
  default: '.*'
- name: Tests
  type: string
  default: '.*'
- name: Arguments
  type: string
  default: '.*'
- name: Iterations
  type: number
  default: '5'
- name: AdditionalArguments
  type: string
  default: ''
- name: EnvVars
  type: object
  default: {}

resources:
  repositories:
  - repository: azure-sdk-tools
    type: github
    endpoint: Azure
    name: Azure/azure-sdk-tools
    ref: main

variables:
- ${{ parameters.Variables }}

jobs:
- job: Perf
  timeoutInMinutes: 360
  strategy:
    matrix:
      ${{ if contains(parameters.OperatingSystems, 'Linux') }}:
        Linux:
          Pool: 'azsdk-pool-mms-ubuntu-2004-perf'
          OsVmImage: 'MMSUbuntu20.04'
          MatrixName: 'Linux'
      ${{ if contains(parameters.OperatingSystems, 'Windows') }}:
        Windows:
          Pool: 'azsdk-pool-mms-win-2019-perf'
          OsVmImage: 'MMS2019'
          MatrixName: 'Windows'
  pool:
    name: $(Pool)
    vmImage: $(OSVmImage)
  steps:
  - checkout: self
    path: s

  - checkout: azure-sdk-tools
    path: s/azure-sdk-tools

  - template: /eng/common/pipelines/templates/steps/verify-agent-os.yml
    parameters:
      AgentImage: $(OSVmImage)

  - ${{ parameters.InstallLanguageSteps }}

  - template: /eng/common/TestResources/deploy-test-resources.yml
    parameters:
      ServiceDirectory: ${{ parameters.ServiceDirectory }}
      Location: westus
      ResourceType: perf

  - pwsh: |
      set-content -path config.yml -value "WorkingDirectories:"
      add-content -path config.yml -value "  ${{ parameters.Language }}: $(Agent.BuildDirectory)/s"
    workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation
    displayName: Create config.yml

  - script: >-
      dotnet run -- run
      --no-sync
      --languages ${{ parameters.Language }}
      --services "${{ parameters.Services }}"
      --package-versions "${{ parameters.PackageVersions }}"
      --tests "${{ parameters.Tests }}"
      --arguments "${{ parameters.Arguments }}"
      --iterations ${{ parameters.Iterations }}
      ${{ parameters.AdditionalArguments }}
    workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation
    env:
      ${{ each var in parameters.EnvVars }}:
        ${{ var.key }}: ${{ var.value }}
    displayName: Run perf tests

  - pwsh: |
      get-content results.csv
    workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results
    displayName: Print results.csv
    condition: always()

  - pwsh: |
      get-content results.json
    workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results
    displayName: Print results.json
    condition: always()

  - task: PublishPipelineArtifact@1
    inputs:
      targetPath: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results
      artifactName: results-$(MatrixName)
    condition: always()

  - template: /eng/common/TestResources/remove-test-resources.yml
    parameters:
      ServiceDirectory: ${{ parameters.ServiceDirectory }}
      ResourceType: perf<commit_msg>Print additional result summary formats to pipelines UI (#25306)<commit_after>parameters:
- name: Variables
  type: object
  default: []
- name: OperatingSystems
  type: string
  default: 'Linux'
- name: Language
  type: string
  default: ''
- name: InstallLanguageSteps
  type: stepList
  default: []
- name: ServiceDirectory
  type: string
  default: ''
- name: Services
  type: string
  default: ''
- name: PackageVersions
  type: string
  default: '.*'
- name: Tests
  type: string
  default: '.*'
- name: Arguments
  type: string
  default: '.*'
- name: Iterations
  type: number
  default: '5'
- name: AdditionalArguments
  type: string
  default: ''
- name: EnvVars
  type: object
  default: {}

resources:
  repositories:
  - repository: azure-sdk-tools
    type: github
    endpoint: Azure
    name: Azure/azure-sdk-tools
    ref: main

variables:
- ${{ parameters.Variables }}

jobs:
- job: Perf
  timeoutInMinutes: 360
  strategy:
    matrix:
      ${{ if contains(parameters.OperatingSystems, 'Linux') }}:
        Linux:
          Pool: 'azsdk-pool-mms-ubuntu-2004-perf'
          OsVmImage: 'MMSUbuntu20.04'
          MatrixName: 'Linux'
      ${{ if contains(parameters.OperatingSystems, 'Windows') }}:
        Windows:
          Pool: 'azsdk-pool-mms-win-2019-perf'
          OsVmImage: 'MMS2019'
          MatrixName: 'Windows'
  pool:
    name: $(Pool)
    vmImage: $(OSVmImage)
  steps:
  - checkout: self
    path: s

  - checkout: azure-sdk-tools
    path: s/azure-sdk-tools

  - template: /eng/common/pipelines/templates/steps/verify-agent-os.yml
    parameters:
      AgentImage: $(OSVmImage)

  - ${{ parameters.InstallLanguageSteps }}

  - template: /eng/common/TestResources/deploy-test-resources.yml
    parameters:
      ServiceDirectory: ${{ parameters.ServiceDirectory }}
      Location: westus
      ResourceType: perf

  - pwsh: |
      set-content -path config.yml -value "WorkingDirectories:"
      add-content -path config.yml -value "  ${{ parameters.Language }}: $(Agent.BuildDirectory)/s"
    workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation
    displayName: Create config.yml

  - script: >-
      dotnet run -- run
      --no-sync
      --languages ${{ parameters.Language }}
      --services "${{ parameters.Services }}"
      --package-versions "${{ parameters.PackageVersions }}"
      --tests "${{ parameters.Tests }}"
      --arguments "${{ parameters.Arguments }}"
      --iterations ${{ parameters.Iterations }}
      ${{ parameters.AdditionalArguments }}
    workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation
    env:
      ${{ each var in parameters.EnvVars }}:
        ${{ var.key }}: ${{ var.value }}
    displayName: Run perf tests

  - pwsh: |
      get-content results.txt
    workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results
    displayName: Print results.txt
    condition: always()

  - pwsh: |
      get-content results.csv
    workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results
    displayName: Print results.csv
    condition: always()

  - pwsh: |
      get-content results.md
    workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results
    displayName: Print results.md
    condition: always()

  - pwsh: |
      get-content results.json
    workingDirectory: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results
    displayName: Print results.json
    condition: always()

  - task: PublishPipelineArtifact@1
    inputs:
      targetPath: azure-sdk-tools/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation/results
      artifactName: results-$(MatrixName)
    condition: always()

  - template: /eng/common/TestResources/remove-test-resources.yml
    parameters:
      ServiceDirectory: ${{ parameters.ServiceDirectory }}
      ResourceType: perf
{'fraction_non_alphanumeric': 0.12835016835016835, 'fraction_numerical': 0.00632996632996633, 'mean_word_length': 2.939522546419098, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3096810', 'n_tokens_mistral': 2399, 'n_tokens_neox': 2284, 'n_words': 461}