Skip to content

Commit

Permalink
feat: add performance testing workflow for PR workflow (#1079)
Browse files Browse the repository at this point in the history
# 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.
  • Loading branch information
ritwikranjan authored Nov 27, 2024
1 parent 2e7b979 commit 1e2081a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
9 changes: 1 addition & 8 deletions .github/workflows/perf.yaml
Original file line number Diff line number Diff line change
@@ -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 * * *'
Expand All @@ -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

Expand Down Expand Up @@ -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 }}

0 comments on commit 1e2081a

Please sign in to comment.