Skip to content

Commit

Permalink
Switch to nox (pyca#954)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex authored Jan 17, 2025
1 parent df983f9 commit 765a385
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 80 deletions.
72 changes: 36 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
fail-fast: false
matrix:
PYTHON:
- {VERSION: "3.8", TOXENV: "py38"}
- {VERSION: "3.13", TOXENV: "py313"}
- {VERSION: "3.13t", TOXENV: "py313"}
- {VERSION: "3.8", NOXSESSION: "tests"}
- {VERSION: "3.13", NOXSESSION: "tests"}
- {VERSION: "3.13t", NOXSESSION: "tests"}
MACOS:
- macos-13
- macos-latest
Expand All @@ -38,10 +38,10 @@ jobs:
~/.cargo/git/db/
src/_bcrypt/target/
key: ${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: pip install tox
- run: tox
- run: pip install nox
- run: nox -v
env:
TOXENV: ${{ matrix.PYTHON.TOXENV }}
NOXSESSION: ${{ matrix.PYTHON.NOXSESSION }}
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}

windows:
Expand All @@ -52,9 +52,9 @@ jobs:
- {ARCH: 'x86', WINDOWS: 'win32', RUST_TRIPLE: 'i686-pc-windows-msvc'}
- {ARCH: 'x64', WINDOWS: 'win64', RUST_TRIPLE: 'x86_64-pc-windows-msvc'}
PYTHON:
- {VERSION: "3.8", TOXENV: "py38"}
- {VERSION: "3.13", TOXENV: "py313"}
- {VERSION: "3.13t", TOXENV: "py313"}
- {VERSION: "3.8", NOXSESSION: "tests"}
- {VERSION: "3.13", NOXSESSION: "tests"}
- {VERSION: "3.13t", NOXSESSION: "tests"}
name: "Python ${{ matrix.PYTHON.VERSION }} on ${{ matrix.WINDOWS.WINDOWS }}"
steps:
- uses: actions/[email protected]
Expand All @@ -76,32 +76,32 @@ jobs:
src/_bcrypt/target/
key: ${{ runner.os }}-${{ matrix.WINDOWS.ARCH }}-${{ steps.setup-python.outputs.python-version }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- run: pip install tox
- run: tox
- run: pip install nox
- run: nox -v
env:
TOXENV: ${{ matrix.PYTHON.TOXENV }}
NOXSESSION: ${{ matrix.PYTHON.NOXSESSION }}
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}
linux:
runs-on: ubuntu-22.04
strategy:
matrix:
PYTHON:
- {VERSION: "3.13", TOXENV: "pep8,packaging"}
- {VERSION: "3.13", TOXENV: "mypy"}
- {VERSION: "3.8", TOXENV: "py38"}
- {VERSION: "3.9", TOXENV: "py39"}
- {VERSION: "3.10", TOXENV: "py310"}
- {VERSION: "3.11", TOXENV: "py311"}
- {VERSION: "3.12", TOXENV: "py312"}
- {VERSION: "3.13", TOXENV: "py313"}
- {VERSION: "3.13t", TOXENV: "py313"}
- {VERSION: "pypy-3.9", TOXENV: "pypy3"}
- {VERSION: "pypy-3.10", TOXENV: "pypy3"}
- {VERSION: "3.13", NOXSESSION: "pep8,packaging"}
- {VERSION: "3.13", NOXSESSION: "mypy"}
- {VERSION: "3.8", NOXSESSION: "tests"}
- {VERSION: "3.9", NOXSESSION: "tests"}
- {VERSION: "3.10", NOXSESSION: "tests"}
- {VERSION: "3.11", NOXSESSION: "tests"}
- {VERSION: "3.12", NOXSESSION: "tests"}
- {VERSION: "3.13", NOXSESSION: "tests"}
- {VERSION: "3.13t", NOXSESSION: "tests"}
- {VERSION: "pypy-3.9", NOXSESSION: "tests"}
- {VERSION: "pypy-3.10", NOXSESSION: "tests"}

# MSRV
- {VERSION: "3.13", TOXENV: "py313", RUST_VERSION: "1.64.0"}
- {VERSION: "3.13", TOXENV: "py313", RUST_VERSION: "beta"}
- {VERSION: "3.13", TOXENV: "py313", RUST_VERSION: "nightly"}
- {VERSION: "3.13", NOXSESSION: "tests", RUST_VERSION: "1.64.0"}
- {VERSION: "3.13", NOXSESSION: "tests", RUST_VERSION: "beta"}
- {VERSION: "3.13", NOXSESSION: "tests", RUST_VERSION: "nightly"}
name: "${{ matrix.PYTHON.VERSION }} on linux, Rust ${{ matrix.PYTHON.RUST_VERSION || 'stable' }}"
steps:
- uses: actions/[email protected]
Expand All @@ -125,10 +125,10 @@ jobs:
with:
toolchain: ${{ matrix.PYTHON.RUST_VERSION || 'stable' }}

- run: pip install tox
- run: tox
- run: pip install nox
- run: nox -v
env:
TOXENV: ${{ matrix.PYTHON.TOXENV }}
NOXSESSION: ${{ matrix.PYTHON.NOXSESSION }}
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}

linux-distros:
Expand All @@ -137,10 +137,10 @@ jobs:
strategy:
matrix:
IMAGE:
- {IMAGE: "alpine", TOXENV: "py312", RUNNER: "ubuntu-latest"}
- {IMAGE: "alpine:aarch64", TOXENV: "py312", RUNNER: [self-hosted, Linux, ARM64]}
- {IMAGE: "ubuntu-rolling:aarch64", TOXENV: "py312", RUNNER: [self-hosted, Linux, ARM64]}
name: "${{ matrix.IMAGE.TOXENV }} on ${{ matrix.IMAGE.IMAGE }}"
- {IMAGE: "alpine", NOXSESSION: "tests", RUNNER: "ubuntu-latest"}
- {IMAGE: "alpine:aarch64", NOXSESSION: "tests", RUNNER: [self-hosted, Linux, ARM64]}
- {IMAGE: "ubuntu-rolling:aarch64", NOXSESSION: "tests", RUNNER: [self-hosted, Linux, ARM64]}
name: "${{ matrix.IMAGE.NOXSESSION }} on ${{ matrix.IMAGE.IMAGE }}"
steps:
- name: Ridiculous alpine workaround for actions support on arm64
run: |
Expand All @@ -153,10 +153,10 @@ jobs:
- uses: actions/[email protected]
with:
persist-credentials: false
- run: /venv/bin/pip install tox
- run: '/venv/bin/tox'
- run: /venv/bin/pip install nox
- run: /venv/bin/nox -v
env:
TOXENV: ${{ matrix.IMAGE.TOXENV }}
NOXSESSION: ${{ matrix.IMAGE.NOXSESSION }}
RUSTUP_HOME: /root/.rustup
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}

Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include LICENSE README.rst

include pyproject.toml

include tox.ini .coveragerc
include noxfile.py .coveragerc

recursive-include src py.typed *.pyi
recursive-include src/_bcrypt Cargo.toml Cargo.lock *.rs
Expand Down
42 changes: 42 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import nox

nox.options.reuse_existing_virtualenvs = True
nox.options.default_venv_backend = "uv|virtualenv"


@nox.session
def tests(session: nox.Session) -> None:
session.install("coverage")
session.install(".[tests]")

session.run(
"coverage", "run", "-m", "pytest", "--strict-markers", *session.posargs
)
session.run("coverage", "combine")
session.run("coverage", "report", "-m", "--fail-under", "100")


@nox.session
def pep8(session: nox.Session) -> None:
session.install("ruff")

session.run("ruff", "check", ".")
session.run("ruff", "format", "--check", ".")


@nox.session
def mypy(session: nox.Session) -> None:
session.install("mypy")
session.install(".[tests]")

session.run("mypy", "tests/")


@nox.session
def packaging(session: nox.Session) -> None:
session.install("setuptools-rust", "check-manifest", "readme_renderer")

session.run("check-manifest")
session.run(
"python3", "-m", "readme_renderer", "README.rst", "-o", "/dev/null"
)
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,6 @@ warn_redundant_casts = true
warn_unused_ignores = true
warn_unused_configs = true
strict_equality = true

[tool.check-manifest]
ignore = ["tests/reference/*"]
43 changes: 0 additions & 43 deletions tox.ini

This file was deleted.

0 comments on commit 765a385

Please sign in to comment.