diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 0b81a10e..fcef18fb 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -1,8 +1,9 @@ name: Benchmark on: push: - branches: - - master + branches: [master] + pull_request: + branches: [master] permissions: contents: write @@ -22,8 +23,7 @@ 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 . @@ -31,6 +31,7 @@ jobs: 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 @@ -41,5 +42,18 @@ jobs: auto-push: true # Show alert with commit comment on detecting possible performance regression alert-threshold: "200%" + comment-on-alert: false + fail-on-alert: false + - 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 + fail-on-alert: false diff --git a/pyproject.toml b/pyproject.toml index 6050f66d..f2fd2696 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ fitting = [ ] dev = [ "pytest", + "pytest-benchmark", "pytest-cov", "nbmake", "ruff==0.4.8", diff --git a/requirements/dev-requirements.txt b/requirements/dev-requirements.txt index 48d4f3c8..4a0fd62f 100644 --- a/requirements/dev-requirements.txt +++ b/requirements/dev-requirements.txt @@ -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 @@ -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