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

try fixing benchmarks #538

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
27 changes: 12 additions & 15 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,36 @@ jobs:
benchmark:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest]
env:
PYTEST_BENCHMARK_STORAGE: file://${{ github.workspace }}/.benchmarks
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Upgrade nox and uv
run: |
python -m pip install --upgrade 'nox[uv]' pytest-benchmark
uv --version
nox --version

- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
fetch-depth: 0
path: base

- name: Benchmark on base branch
run: nox -s bench -- --benchmark-save=base

- uses: actions/checkout@v4
with:
fetch-depth: 0
path: pr

- name: Upgrade pip and nox
run: python -m pip install --upgrade pip nox pytest-benchmark

- name: Benchmark on base branch
working-directory: base
run: |
nox -s bench -- --benchmark-save=base
clean: false

- name: Benchmark on pull request
working-directory: pr
run: |
nox -s bench -- --benchmark-save=${GITHUB_SHA::7} --benchmark-compare=0001 --benchmark-compare-fail=mean:10%
run: nox -s bench -- --benchmark-save=${GITHUB_SHA::7} --benchmark-compare=0001 --benchmark-compare-fail=mean:10%

- name: Compare benchmark
if: always()
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ jobs:
with:
python-version: '3.11'

- name: Upgrade pip and nox
- name: Upgrade nox and uv
run: |
pip install --upgrade pip nox
pip --version
python -m pip install --upgrade 'nox[uv]'
nox --version
uv --version

- name: Build package
run: nox -s build
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ jobs:
with:
python-version: ${{ matrix.pyv }}

- name: Upgrade pip and nox
- name: Upgrade nox and uv
run: |
python -m pip install --upgrade pip nox
pip --version
python -m pip install --upgrade 'nox[uv]'
nox --version
uv --version

- name: Cache pre-commit hooks
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Lint code
run: nox -s lint
Expand Down
5 changes: 3 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import nox

nox.options.default_venv_backend = "uv|virtualenv"
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = "lint", "tests"

Expand Down Expand Up @@ -46,8 +47,8 @@ def lint(session: nox.Session) -> None:

@nox.session
def build(session: nox.Session) -> None:
session.install("build", "setuptools", "twine")
session.run("python", "-m", "build")
session.install("build", "setuptools", "twine", "uv")
session.run("python", "-m", "build", "--installer", "uv")
dists = glob.glob("dist/*")
session.run("twine", "check", *dists, silent=True)

Expand Down
Loading