diff --git a/eng/common/pipelines/templates/jobs/perf.yml b/eng/common/pipelines/templates/jobs/perf.yml new file mode 100644 index 0000000000..17a5cb8315 --- /dev/null +++ b/eng/common/pipelines/templates/jobs/perf.yml @@ -0,0 +1,130 @@ +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