Skip to content

Commit

Permalink
try fixing benchmarks (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry authored Aug 5, 2024
1 parent 68b8cd6 commit 84a7f93
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
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

0 comments on commit 84a7f93

Please sign in to comment.