forked from cs01/pygdbmi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
70 lines (53 loc) · 1.86 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import nox # type: ignore
from pathlib import Path
import shutil
nox.options.sessions = ["tests", "lint", "docs"]
nox.options.reuse_existing_virtualenvs = True
# Run tests with (at least) the oldest and newest versions we support.
# If these are modified, also modify .github/workflows/tests.yml and the list of supported versions
# in setup.py.
@nox.session(python=["3.7", "3.10"])
def tests(session):
session.install(".", "pytest")
session.run("pytest", *session.posargs)
@nox.session()
def lint(session):
session.install(*["black", "flake8", "mypy", "check-manifest"])
files = ["pygdbmi", "tests"] + [str(p) for p in Path(".").glob("*.py")]
session.run("black", "--check", *files)
session.run("flake8", *files)
session.run("mypy", *files) #
session.run("check-manifest")
session.run("python", "setup.py", "check", "--metadata", "--strict")
doc_dependencies = [
".",
"mkdocstrings",
"mkdocs",
"mkdocs-material",
"pygments",
]
@nox.session(python="3.7")
def docs(session):
session.install(*doc_dependencies)
session.run("mkdocs", "build")
@nox.session(python="3.7")
def serve_docs(session):
session.install(*doc_dependencies)
session.run("mkdocs", "serve")
@nox.session(python="3.7")
def publish_docs(session):
session.install(*doc_dependencies)
session.run("mkdocs", "gh-deploy")
@nox.session(python="3.7")
def build(session):
session.install("setuptools", "wheel", "twine")
shutil.rmtree("dist", ignore_errors=True)
shutil.rmtree("build", ignore_errors=True)
session.run("python", "setup.py", "--quiet", "sdist", "bdist_wheel")
session.run("twine", "check", "dist/*")
@nox.session(python="3.7")
def publish(session):
build(session)
print("REMINDER: Has the changelog been updated?")
session.run("python", "-m", "twine", "upload", "dist/*")
publish_docs(session)