ci: add CodSpeed workflow and pytest-codspeed for performance testing (#4350)

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-11-02 10:06:14 -03:00 committed by GitHub
commit a7f28394ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 51 additions and 0 deletions

29
.github/workflows/codspeed.yml vendored Normal file
View file

@ -0,0 +1,29 @@
name: Run benchmarks
on:
push:
branches:
- "main" # or "master"
pull_request:
workflow_dispatch:
jobs:
codspeed:
name: Run benchmarks
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.12"
steps:
- name: Check out the code at a specific ref
uses: actions/checkout@v4
- name: "Setup Environment"
uses: ./.github/actions/setup-uv
- name: Run benchmarks
uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: make unit_tests args="--codspeed -n auto"
- name: Minimize uv cache
run: uv cache prune --ci

View file

@ -172,6 +172,7 @@ dev-dependencies = [
"packaging>=23.2,<24.0",
"asgi-lifespan>=2.1.0",
"pytest-github-actions-annotate-failures>=0.2.0",
"pytest-codspeed>=3.0.0",
]

View file

@ -76,6 +76,7 @@ ignore = [
[tool.uv]
dev-dependencies = [
"asgi-lifespan>=2.1.0",
"pytest-codspeed>=3.0.0",
"pytest-github-actions-annotate-failures>=0.2.0",
]

20
uv.lock generated
View file

@ -3592,6 +3592,7 @@ dev = [
{ name = "pre-commit" },
{ name = "pytest" },
{ name = "pytest-asyncio" },
{ name = "pytest-codspeed" },
{ name = "pytest-cov" },
{ name = "pytest-flakefinder" },
{ name = "pytest-github-actions-annotate-failures" },
@ -3718,6 +3719,7 @@ dev = [
{ name = "pre-commit", specifier = ">=3.7.0" },
{ name = "pytest", specifier = ">=8.2.0" },
{ name = "pytest-asyncio", specifier = ">=0.23.0" },
{ name = "pytest-codspeed", specifier = ">=3.0.0" },
{ name = "pytest-cov", specifier = ">=5.0.0" },
{ name = "pytest-flakefinder", specifier = ">=1.1.0" },
{ name = "pytest-github-actions-annotate-failures", specifier = ">=0.2.0" },
@ -3860,6 +3862,7 @@ local = [
[package.dev-dependencies]
dev = [
{ name = "asgi-lifespan" },
{ name = "pytest-codspeed" },
{ name = "pytest-github-actions-annotate-failures" },
]
@ -3968,6 +3971,7 @@ requires-dist = [
[package.metadata.requires-dev]
dev = [
{ name = "asgi-lifespan", specifier = ">=2.1.0" },
{ name = "pytest-codspeed", specifier = ">=3.0.0" },
{ name = "pytest-github-actions-annotate-failures", specifier = ">=0.2.0" },
]
@ -6096,6 +6100,22 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/96/31/6607dab48616902f76885dfcf62c08d929796fc3b2d2318faf9fd54dbed9/pytest_asyncio-0.24.0-py3-none-any.whl", hash = "sha256:a811296ed596b69bf0b6f3dc40f83bcaf341b155a269052d82efa2b25ac7037b", size = 18024 },
]
[[package]]
name = "pytest-codspeed"
version = "3.0.0"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "cffi" },
{ name = "filelock" },
{ name = "pytest" },
{ name = "rich" },
{ name = "setuptools", marker = "python_full_version >= '3.12'" },
]
sdist = { url = "https://files.pythonhosted.org/packages/ba/78/40e613268cce75b11cd35ea9fdc280fb648e2233fc4187c76112377b1869/pytest_codspeed-3.0.0.tar.gz", hash = "sha256:c5b80100ea32dd44079bb2db298288763eb8fe859eafa1650a8711bd2c32fd06", size = 12540 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/a6/79/fa067436033410ac16e5d14b61b1a5f355688930ca8c6a8c61a52b2cbe0a/pytest_codspeed-3.0.0-py3-none-any.whl", hash = "sha256:ab1b8cb9da72e0d394718333d1abc7bea38524e09fd4854bc70a91abbcdcb20e", size = 15640 },
]
[[package]]
name = "pytest-cov"
version = "5.0.0"