Skip to content

Commit

Permalink
Switch to nox (#668)
Browse files Browse the repository at this point in the history
* Switch to nox

* Actually fix conflict
  • Loading branch information
pquentin authored Dec 4, 2024
1 parent e3dc904 commit a49a64b
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 50 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- "dependabot/**"
pull_request:

env:
FORCE_COLOR: "1"

jobs:
test:
strategy:
Expand All @@ -16,9 +19,11 @@ jobs:
- macos-latest
- windows-latest
- ubuntu-latest
nox-session: ['']
include:
- python-version: pypy3.10
os: ubuntu-latest
nox-session: test-pypy3.10
name: ${{ fromJson('{"macos-latest":"macOS","windows-latest":"Windows","ubuntu-latest":"Ubuntu"}')[matrix.os] }} (${{ matrix.python-version }})
timeout-minutes: 20
runs-on: ${{ matrix.os }}
Expand All @@ -31,8 +36,13 @@ jobs:
python-version: '${{ matrix.python-version }}'
allow-prereleases: true
- name: Run tests
run: ./ci.sh
run: |
python -m pip install --upgrade nox
nox -s ${NOX_SESSION:-test-$PYTHON_VERSION}
shell: bash
env:
PYTHON_VERSION: ${{ matrix.python-version }}
NOX_SESSION: ${{ matrix.nox-session }}
- name: "Upload coverage data"
uses: "actions/upload-artifact@v4"
with:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- "dependabot/**"
pull_request:

env:
FORCE_COLOR: "1"

jobs:
Lint:
name: 'Lint'
Expand All @@ -19,4 +22,6 @@ jobs:
with:
python-version: '3.x'
- name: Run lint
run: ./lint.sh
run: |
python -m pip install --upgrade nox
nox -s lint
20 changes: 0 additions & 20 deletions ci.sh

This file was deleted.

1 change: 1 addition & 0 deletions lint-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pytest>=6.2
idna>=3.2
black
isort
nox
38 changes: 27 additions & 11 deletions lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile lint-requirements.in
#
# This file was autogenerated by uv via the following command:
# uv pip compile --universal lint-requirements.in
argcomplete==3.5.1
# via nox
black==24.10.0
# via -r lint-requirements.in
cffi==1.17.1
cffi==1.17.1 ; platform_python_implementation != 'PyPy'
# via cryptography
click==8.1.7
# via black
cryptography==43.0.3
colorama==0.4.6 ; sys_platform == 'win32' or platform_system == 'Windows'
# via
# click
# colorlog
# pytest
colorlog==6.9.0
# via nox
cryptography==44.0.0
# via
# -r lint-requirements.in
# types-pyopenssl
distlib==0.3.9
# via virtualenv
filelock==3.16.1
# via virtualenv
idna==3.10
# via -r lint-requirements.in
iniconfig==2.0.0
Expand All @@ -26,19 +35,24 @@ mypy-extensions==1.0.0
# via
# black
# mypy
nox==2024.10.9
# via -r lint-requirements.in
packaging==24.2
# via
# black
# nox
# pytest
pathspec==0.12.1
# via black
platformdirs==4.3.6
# via black
# via
# black
# virtualenv
pluggy==1.5.0
# via pytest
pycparser==2.22
pycparser==2.22 ; platform_python_implementation != 'PyPy'
# via cffi
pytest==8.3.3
pytest==8.3.4
# via -r lint-requirements.in
types-cffi==1.16.0.20240331
# via types-pyopenssl
Expand All @@ -48,3 +62,5 @@ types-setuptools==75.6.0.20241126
# via types-cffi
typing-extensions==4.12.2
# via mypy
virtualenv==20.28.0
# via nox
17 changes: 0 additions & 17 deletions lint.sh

This file was deleted.

32 changes: 32 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os

import nox


@nox.session()
def lint(session: nox.Session) -> None:
session.install("-r", "lint-requirements.txt")
LINT_PATHS = ("src/trustme", "tests", "noxfile.py")
session.run("black", *LINT_PATHS)
session.run("isort", "--profile", "black", *LINT_PATHS)
session.run("mypy", *LINT_PATHS)


@nox.session(python=["3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.10"])
def test(session: nox.Session) -> None:
session.install(".", "-r", "test-requirements.txt")
session.run(
"coverage",
"run",
"--parallel-mode",
"-m",
"pytest",
"-W",
"error",
"-ra",
"-s",
*(session.posargs or ("tests/",)),
)
if os.environ.get("CI") != "true":
session.run("coverage", "combine")
session.run("coverage", "report", "-m")

0 comments on commit a49a64b

Please sign in to comment.