Skip to content

Commit

Permalink
use pytest-benchmark in CI (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
LegrandNico authored Jan 27, 2025
1 parent 01dd2ff commit eeacec3
Show file tree
Hide file tree
Showing 8 changed files with 341 additions and 272 deletions.
41 changes: 4 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is autogenerated by maturin v1.7.8
# This file is autogenerated by maturin v1.8.1
# To update, run
#
# maturin generate-ci github
Expand All @@ -19,35 +19,6 @@ permissions:
contents: read

jobs:
linux:
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-22.04
target: x86_64
- runner: ubuntu-22.04
target: x86
python:
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --find-interpreter
sccache: 'true'
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist

windows:
runs-on: ${{ matrix.platform.runner }}
strategy:
Expand All @@ -57,13 +28,11 @@ jobs:
target: x64
- runner: windows-latest
target: x86
python:
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
python-version: 3.x
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
Expand All @@ -86,13 +55,11 @@ jobs:
target: x86_64
- runner: macos-14
target: aarch64
python:
- "3.12"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand Down Expand Up @@ -124,7 +91,7 @@ jobs:
name: Release
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
needs: [linux, musllinux, windows, macos, sdist]
needs: [windows, macos, sdist]
permissions:
# Use to sign the release artifacts
id-token: write
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,28 @@ jobs:
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}

# # Step 10: Download baseline benchmark artifact
# - name: Download baseline benchmark
# uses: actions/download-artifact@v3
# with:
# name: baseline-benchmark
# path: .benchmarks/baseline_benchmark.json

# Step 11: Run pytest-benchmark
- name: Run pytest-benchmark
run: |
poetry run pytest --benchmark-only --benchmark-json=.benchmarks/new_benchmark.json
# # Step 12: Compare benchmarks with thresholds
# - name: Compare benchmarks
# run: |
# poetry run pytest-benchmark compare .benchmarks/baseline_benchmark.json .benchmarks/new_benchmark.json
# continue-on-error: true

# Step 13: Upload benchmark artifact
- name: Upload baseline benchmark
uses: actions/upload-artifact@v3
with:
name: baseline-benchmark
path: .benchmarks/new_benchmark.json
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ coverage.xm
.mypy_cache
.pytest_cache
dist/*
target*
target*
.benchmarks/
59 changes: 35 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ crate-type = ["cdylib", "rlib"]
path = "src/lib.rs" # The source file of the target.

[dependencies]
pyo3 = { version = "0.23.3", features = ["extension-module"] }
pyo3 = { version = "0.23.4", features = ["extension-module"] }
numpy = "0.23"
Loading

0 comments on commit eeacec3

Please sign in to comment.