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

Switch to nox #668

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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
31 changes: 21 additions & 10 deletions lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile lint-requirements.in
#
black==24.8.0
# This file was autogenerated by uv via the following command:
# uv pip compile lint-requirements.in
argcomplete==3.5.1
# via nox
black==24.10.0
# via -r lint-requirements.in
cffi==1.17.1
# via cryptography
click==8.1.7
# via black
cryptography==42.0.4
colorlog==6.8.2
# via nox
cryptography==43.0.1
# via
# -r lint-requirements.in
# types-pyopenssl
idna==3.6
distlib==0.3.8
# via virtualenv
filelock==3.16.1
# via virtualenv
idna==3.10
# via -r lint-requirements.in
iniconfig==2.0.0
# via pytest
Expand All @@ -26,14 +30,19 @@ mypy-extensions==1.0.0
# via
# black
# mypy
nox==2024.4.15
# via -r lint-requirements.in
packaging==24.1
# 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
Expand All @@ -48,3 +57,5 @@ types-setuptools==75.1.0.20240917
# via types-cffi
typing-extensions==4.12.2
# via mypy
virtualenv==20.26.6
# 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")