From 1e2081aba4eda48313d335272b34688c27579fe3 Mon Sep 17 00:00:00 2001 From: Ritwik Ranjan Date: Wed, 27 Nov 2024 19:46:05 +0000 Subject: [PATCH] feat: add performance testing workflow for PR workflow (#1079) # Description This pull request introduces a new job for performance testing and modifies the existing workflow for network performance measurement. The main changes include adding a new performance test job to the `images.yaml` workflow and updating the `perf.yaml` workflow to streamline its execution. New performance test job: * [`.github/workflows/images.yaml`](diffhunk://#diff-d0a3d6684c78a148cbf0725d5fe8b5aab6431da05b698a82c9e015516f3020baR334-R366): Added a new job `perf` to run Retina Performance Tests after the `manifests` job completes successfully. This job includes steps for checking out the code, setting up Go, logging into Azure CLI, and running end-to-end tests with performance tags. Updates to network performance measurement workflow: * [`.github/workflows/perf.yaml`](diffhunk://#diff-1aa140a875fcb7cae6b4ada7e6e973c4d55179ad046f56465f9f0ec592f283caL4-L7): Removed the `workflow_run` trigger and replaced it with a scheduled trigger to run the workflow every 12 hours. * [`.github/workflows/perf.yaml`](diffhunk://#diff-1aa140a875fcb7cae6b4ada7e6e973c4d55179ad046f56465f9f0ec592f283caL23): Removed the condition to check for `workflow_run` or `merge_group` events in the `perf_test` job. * [`.github/workflows/perf.yaml`](diffhunk://#diff-1aa140a875fcb7cae6b4ada7e6e973c4d55179ad046f56465f9f0ec592f283caL54-R52): Updated the `TAG` assignment logic to exclude the `merge_group` event and set the image registry to `ghcr.io`. ## Checklist - [X] I have read the [contributing documentation](https://retina.sh/docs/contributing). - [X] I signed and signed-off the commits (`git commit -S -s ...`). See [this documentation](https://docs.github.com/en/authentication/managing-commit-signature-verification/about-commit-signature-verification) on signing commits. - [X] I have correctly attributed the author(s) of the code. - [X] I have tested the changes locally. - [X] I have followed the project's style guidelines. - [X] I have updated the documentation, if necessary. - [X] I have added tests, if applicable. ## Screenshots (if applicable) or Testing Completed Please add any relevant screenshots or GIFs to showcase the changes made. ## Additional Notes Add any additional notes or context about the pull request here. --- Please refer to the [CONTRIBUTING.md](../CONTRIBUTING.md) file for more information on how to contribute to this project. --- .github/workflows/images.yaml | 33 +++++++++++++++++++++++++++++++++ .github/workflows/perf.yaml | 9 +-------- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.github/workflows/images.yaml b/.github/workflows/images.yaml index abd24a2b50..9c4974cb1a 100644 --- a/.github/workflows/images.yaml +++ b/.github/workflows/images.yaml @@ -331,3 +331,36 @@ jobs: run: | set -euo pipefail go test -v ./test/e2e/. -timeout 60m -tags=e2e -count=1 -args -image-tag=$(make version) -image-registry=${{ vars.ACR_NAME }} -image-namespace=${{ github.repository}} + + perf: + if: ${{ github.event_name == 'merge_group' && success('manifests')}} + name: Retina Performance Test + runs-on: ubuntu-latest + needs: [manifests] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + - run: go version + + - name: Az CLI login + uses: azure/login@v2 + if: ${{ github.event_name == 'merge_group' }} + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION }} + + - name: Run E2E Tests + env: + AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }} + AZURE_LOCATION: ${{ vars.AZURE_LOCATION }} + shell: bash + run: | + set -euo pipefail + go test -v ./test/e2e/. -timeout 2h -tags=perf -count=1 -args -image-tag=$(make version) -image-registry=${{ vars.ACR_NAME }} -image-namespace=${{ github.repository }} diff --git a/.github/workflows/perf.yaml b/.github/workflows/perf.yaml index bf5b7b67c3..dcbe96f7bf 100644 --- a/.github/workflows/perf.yaml +++ b/.github/workflows/perf.yaml @@ -1,10 +1,6 @@ name: Network Performance Measurement on: - workflow_run: - workflows: [Build Images] - types: - - completed schedule: # It runs on 17th minute of every 12 hours - cron: '17 */12 * * *' @@ -20,7 +16,6 @@ permissions: jobs: perf_test: - if: ${{ github.event_name != 'workflow_run' || github.event_name == 'merge_group' }} name: Retina Performance Test runs-on: ubuntu-latest @@ -51,9 +46,7 @@ jobs: set -euo pipefail if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then TAG=${{ github.event.inputs.tag }} - elif [ "${{ github.event_name }}" == "merge_group" ]; then - TAG=$(make version) else TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name) fi - go test -v ./test/e2e/. -timeout 2h -tags=perf -count=1 -args -image-tag=$TAG -image-registry=${{ vars.ACR_NAME }} -image-namespace=${{ github.repository }} + go test -v ./test/e2e/. -timeout 2h -tags=perf -count=1 -args -image-tag=$TAG -image-registry=ghcr.io -image-namespace=${{ github.repository }}