Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pytest-benchmark to dev dependencies and run benchmark checks on PRs #177

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: Benchmark
on:
push:
branches:
- master
branches: [master]
pull_request:
branches: [master]

permissions:
contents: write
Expand All @@ -22,15 +23,15 @@ jobs:
- name: Install deps
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install --system -r requirements/fitting-requirements.txt
uv pip install --system pytest pytest-benchmark pytest-coverage
uv pip install --system -r requirements/dev-requirements.txt
- name: Install module
run: |
uv pip install --system .
- name: Run benchmark
run: |
pytest tests/benchmark*.py --benchmark-json output.json
- name: Store benchmark result
if: github.ref == 'refs/heads/master'
uses: benchmark-action/github-action-benchmark@v1
with:
name: Python Benchmark with pytest-benchmark
Expand All @@ -43,3 +44,16 @@ jobs:
alert-threshold: "200%"
comment-on-alert: true
fail-on-alert: true
- name: Check benchmark threshold
if: github.ref != 'refs/heads/master'
uses: benchmark-action/github-action-benchmark@v1
with:
name: Python Benchmark with pytest-benchmark
tool: "pytest"
output-file-path: output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: false
# Show alert with commit comment on detecting possible performance regression
alert-threshold: "200%"
comment-on-alert: true
fail-on-alert: true
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ fitting = [
]
dev = [
"pytest",
"pytest-benchmark",
"pytest-cov",
"nbmake",
"ruff==0.4.8",
Expand Down
9 changes: 9 additions & 0 deletions requirements/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,10 @@ pure-eval==0.2.2 \
# via
# -r requirements/fitting-requirements.txt
# stack-data
py-cpuinfo==9.0.0 \
--hash=sha256:3cdbbf3fac90dc6f118bfd64384f309edeadd902d7c8fb17f02ffa1fc3f49690 \
--hash=sha256:859625bc251f64e21f077d099d4162689c762b5d6a4c3c97553d56241c9674d5
# via pytest-benchmark
pygments==2.18.0 \
--hash=sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199 \
--hash=sha256:b8e6aca0523f3ab76fee51799c488e38782ac06eafcf95e7ba832985c8e7b13a
Expand All @@ -803,7 +807,12 @@ pytest==8.2.2 \
# via
# pyelli (pyproject.toml)
# nbmake
# pytest-benchmark
# pytest-cov
pytest-benchmark==4.0.0 \
--hash=sha256:fb0785b83efe599a6a956361c0691ae1dbb5318018561af10f3e915caa0048d1 \
--hash=sha256:fdb7db64e31c8b277dff9850d2a2556d8b60bcb0ea6524e36e28ffd7c87f71d6
# via pyelli (pyproject.toml)
pytest-cov==5.0.0 \
--hash=sha256:4f0764a1219df53214206bf1feea4633c3b558a2925c8b59f144f682861ce652 \
--hash=sha256:5837b58e9f6ebd335b0f8060eecce69b662415b16dc503883a02f45dfeb14857
Expand Down
Loading