Switch to nox (#954)
This commit is contained in:
parent
df983f9c98
commit
765a3851de
72
.github/workflows/ci.yml
vendored
72
.github/workflows/ci.yml
vendored
@ -14,9 +14,9 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
PYTHON:
|
PYTHON:
|
||||||
- {VERSION: "3.8", TOXENV: "py38"}
|
- {VERSION: "3.8", NOXSESSION: "tests"}
|
||||||
- {VERSION: "3.13", TOXENV: "py313"}
|
- {VERSION: "3.13", NOXSESSION: "tests"}
|
||||||
- {VERSION: "3.13t", TOXENV: "py313"}
|
- {VERSION: "3.13t", NOXSESSION: "tests"}
|
||||||
MACOS:
|
MACOS:
|
||||||
- macos-13
|
- macos-13
|
||||||
- macos-latest
|
- macos-latest
|
||||||
@ -38,10 +38,10 @@ jobs:
|
|||||||
~/.cargo/git/db/
|
~/.cargo/git/db/
|
||||||
src/_bcrypt/target/
|
src/_bcrypt/target/
|
||||||
key: ${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
- run: pip install tox
|
- run: pip install nox
|
||||||
- run: tox
|
- run: nox -v
|
||||||
env:
|
env:
|
||||||
TOXENV: ${{ matrix.PYTHON.TOXENV }}
|
NOXSESSION: ${{ matrix.PYTHON.NOXSESSION }}
|
||||||
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}
|
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
@ -52,9 +52,9 @@ jobs:
|
|||||||
- {ARCH: 'x86', WINDOWS: 'win32', RUST_TRIPLE: 'i686-pc-windows-msvc'}
|
- {ARCH: 'x86', WINDOWS: 'win32', RUST_TRIPLE: 'i686-pc-windows-msvc'}
|
||||||
- {ARCH: 'x64', WINDOWS: 'win64', RUST_TRIPLE: 'x86_64-pc-windows-msvc'}
|
- {ARCH: 'x64', WINDOWS: 'win64', RUST_TRIPLE: 'x86_64-pc-windows-msvc'}
|
||||||
PYTHON:
|
PYTHON:
|
||||||
- {VERSION: "3.8", TOXENV: "py38"}
|
- {VERSION: "3.8", NOXSESSION: "tests"}
|
||||||
- {VERSION: "3.13", TOXENV: "py313"}
|
- {VERSION: "3.13", NOXSESSION: "tests"}
|
||||||
- {VERSION: "3.13t", TOXENV: "py313"}
|
- {VERSION: "3.13t", NOXSESSION: "tests"}
|
||||||
name: "Python ${{ matrix.PYTHON.VERSION }} on ${{ matrix.WINDOWS.WINDOWS }}"
|
name: "Python ${{ matrix.PYTHON.VERSION }} on ${{ matrix.WINDOWS.WINDOWS }}"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v4.2.2
|
||||||
@ -76,32 +76,32 @@ jobs:
|
|||||||
src/_bcrypt/target/
|
src/_bcrypt/target/
|
||||||
key: ${{ runner.os }}-${{ matrix.WINDOWS.ARCH }}-${{ steps.setup-python.outputs.python-version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-${{ matrix.WINDOWS.ARCH }}-${{ steps.setup-python.outputs.python-version }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
- run: pip install tox
|
- run: pip install nox
|
||||||
- run: tox
|
- run: nox -v
|
||||||
env:
|
env:
|
||||||
TOXENV: ${{ matrix.PYTHON.TOXENV }}
|
NOXSESSION: ${{ matrix.PYTHON.NOXSESSION }}
|
||||||
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}
|
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}
|
||||||
linux:
|
linux:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
PYTHON:
|
PYTHON:
|
||||||
- {VERSION: "3.13", TOXENV: "pep8,packaging"}
|
- {VERSION: "3.13", NOXSESSION: "pep8,packaging"}
|
||||||
- {VERSION: "3.13", TOXENV: "mypy"}
|
- {VERSION: "3.13", NOXSESSION: "mypy"}
|
||||||
- {VERSION: "3.8", TOXENV: "py38"}
|
- {VERSION: "3.8", NOXSESSION: "tests"}
|
||||||
- {VERSION: "3.9", TOXENV: "py39"}
|
- {VERSION: "3.9", NOXSESSION: "tests"}
|
||||||
- {VERSION: "3.10", TOXENV: "py310"}
|
- {VERSION: "3.10", NOXSESSION: "tests"}
|
||||||
- {VERSION: "3.11", TOXENV: "py311"}
|
- {VERSION: "3.11", NOXSESSION: "tests"}
|
||||||
- {VERSION: "3.12", TOXENV: "py312"}
|
- {VERSION: "3.12", NOXSESSION: "tests"}
|
||||||
- {VERSION: "3.13", TOXENV: "py313"}
|
- {VERSION: "3.13", NOXSESSION: "tests"}
|
||||||
- {VERSION: "3.13t", TOXENV: "py313"}
|
- {VERSION: "3.13t", NOXSESSION: "tests"}
|
||||||
- {VERSION: "pypy-3.9", TOXENV: "pypy3"}
|
- {VERSION: "pypy-3.9", NOXSESSION: "tests"}
|
||||||
- {VERSION: "pypy-3.10", TOXENV: "pypy3"}
|
- {VERSION: "pypy-3.10", NOXSESSION: "tests"}
|
||||||
|
|
||||||
# MSRV
|
# MSRV
|
||||||
- {VERSION: "3.13", TOXENV: "py313", RUST_VERSION: "1.64.0"}
|
- {VERSION: "3.13", NOXSESSION: "tests", RUST_VERSION: "1.64.0"}
|
||||||
- {VERSION: "3.13", TOXENV: "py313", RUST_VERSION: "beta"}
|
- {VERSION: "3.13", NOXSESSION: "tests", RUST_VERSION: "beta"}
|
||||||
- {VERSION: "3.13", TOXENV: "py313", RUST_VERSION: "nightly"}
|
- {VERSION: "3.13", NOXSESSION: "tests", RUST_VERSION: "nightly"}
|
||||||
name: "${{ matrix.PYTHON.VERSION }} on linux, Rust ${{ matrix.PYTHON.RUST_VERSION || 'stable' }}"
|
name: "${{ matrix.PYTHON.VERSION }} on linux, Rust ${{ matrix.PYTHON.RUST_VERSION || 'stable' }}"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v4.2.2
|
||||||
@ -125,10 +125,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.PYTHON.RUST_VERSION || 'stable' }}
|
toolchain: ${{ matrix.PYTHON.RUST_VERSION || 'stable' }}
|
||||||
|
|
||||||
- run: pip install tox
|
- run: pip install nox
|
||||||
- run: tox
|
- run: nox -v
|
||||||
env:
|
env:
|
||||||
TOXENV: ${{ matrix.PYTHON.TOXENV }}
|
NOXSESSION: ${{ matrix.PYTHON.NOXSESSION }}
|
||||||
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}
|
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}
|
||||||
|
|
||||||
linux-distros:
|
linux-distros:
|
||||||
@ -137,10 +137,10 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
IMAGE:
|
IMAGE:
|
||||||
- {IMAGE: "alpine", TOXENV: "py312", RUNNER: "ubuntu-latest"}
|
- {IMAGE: "alpine", NOXSESSION: "tests", RUNNER: "ubuntu-latest"}
|
||||||
- {IMAGE: "alpine:aarch64", TOXENV: "py312", RUNNER: [self-hosted, Linux, ARM64]}
|
- {IMAGE: "alpine:aarch64", NOXSESSION: "tests", RUNNER: [self-hosted, Linux, ARM64]}
|
||||||
- {IMAGE: "ubuntu-rolling:aarch64", TOXENV: "py312", RUNNER: [self-hosted, Linux, ARM64]}
|
- {IMAGE: "ubuntu-rolling:aarch64", NOXSESSION: "tests", RUNNER: [self-hosted, Linux, ARM64]}
|
||||||
name: "${{ matrix.IMAGE.TOXENV }} on ${{ matrix.IMAGE.IMAGE }}"
|
name: "${{ matrix.IMAGE.NOXSESSION }} on ${{ matrix.IMAGE.IMAGE }}"
|
||||||
steps:
|
steps:
|
||||||
- name: Ridiculous alpine workaround for actions support on arm64
|
- name: Ridiculous alpine workaround for actions support on arm64
|
||||||
run: |
|
run: |
|
||||||
@ -153,10 +153,10 @@ jobs:
|
|||||||
- uses: actions/checkout@v4.2.2
|
- uses: actions/checkout@v4.2.2
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- run: /venv/bin/pip install tox
|
- run: /venv/bin/pip install nox
|
||||||
- run: '/venv/bin/tox'
|
- run: /venv/bin/nox -v
|
||||||
env:
|
env:
|
||||||
TOXENV: ${{ matrix.IMAGE.TOXENV }}
|
NOXSESSION: ${{ matrix.IMAGE.NOXSESSION }}
|
||||||
RUSTUP_HOME: /root/.rustup
|
RUSTUP_HOME: /root/.rustup
|
||||||
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}
|
CARGO_TARGET_DIR: ${{ format('{0}/src/_bcrypt/target/', github.workspace) }}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ include LICENSE README.rst
|
|||||||
|
|
||||||
include pyproject.toml
|
include pyproject.toml
|
||||||
|
|
||||||
include tox.ini .coveragerc
|
include noxfile.py .coveragerc
|
||||||
|
|
||||||
recursive-include src py.typed *.pyi
|
recursive-include src py.typed *.pyi
|
||||||
recursive-include src/_bcrypt Cargo.toml Cargo.lock *.rs
|
recursive-include src/_bcrypt Cargo.toml Cargo.lock *.rs
|
||||||
|
|||||||
42
noxfile.py
Normal file
42
noxfile.py
Normal file
@ -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"
|
||||||
|
)
|
||||||
@ -72,3 +72,6 @@ warn_redundant_casts = true
|
|||||||
warn_unused_ignores = true
|
warn_unused_ignores = true
|
||||||
warn_unused_configs = true
|
warn_unused_configs = true
|
||||||
strict_equality = true
|
strict_equality = true
|
||||||
|
|
||||||
|
[tool.check-manifest]
|
||||||
|
ignore = ["tests/reference/*"]
|
||||||
|
|||||||
43
tox.ini
43
tox.ini
@ -1,43 +0,0 @@
|
|||||||
[tox]
|
|
||||||
isolated_build = True
|
|
||||||
|
|
||||||
[testenv]
|
|
||||||
extras =
|
|
||||||
tests
|
|
||||||
deps =
|
|
||||||
coverage
|
|
||||||
passenv =
|
|
||||||
RUSTUP_HOME
|
|
||||||
commands =
|
|
||||||
coverage run -m pytest --strict-markers {posargs}
|
|
||||||
coverage combine
|
|
||||||
coverage report -m --fail-under 100
|
|
||||||
|
|
||||||
[testenv:pep8]
|
|
||||||
deps =
|
|
||||||
ruff
|
|
||||||
commands =
|
|
||||||
ruff check .
|
|
||||||
ruff format --check .
|
|
||||||
|
|
||||||
[testenv:mypy]
|
|
||||||
extras =
|
|
||||||
tests
|
|
||||||
deps =
|
|
||||||
mypy
|
|
||||||
commands =
|
|
||||||
mypy tests/
|
|
||||||
|
|
||||||
[testenv:packaging]
|
|
||||||
deps =
|
|
||||||
setuptools-rust
|
|
||||||
check-manifest
|
|
||||||
readme_renderer
|
|
||||||
commands =
|
|
||||||
check-manifest
|
|
||||||
python3 -m readme_renderer README.rst -o /dev/null
|
|
||||||
|
|
||||||
|
|
||||||
[check-manifest]
|
|
||||||
ignore =
|
|
||||||
tests/reference/*
|
|
||||||
Loading…
Reference in New Issue
Block a user