forked from cs01/gdbgui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
128 lines (99 loc) · 3.48 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import nox # type: ignore
from pathlib import Path
nox.options.sessions = ["tests", "lint", "docs"]
python = ["3.6", "3.7", "3.8"]
doc_dependencies = [".", "mkdocs", "mkdocs-material"]
lint_dependencies = ["black", "flake8", "mypy", "check-manifest"]
@nox.session(python=python)
def tests(session):
session.install(".")
tests = session.posargs or ["tests"]
session.install(".", "pytest", "pytest-cov")
tests = session.posargs or ["tests"]
session.run(
"pytest", "--cov=gdbgui", "--cov-config", ".coveragerc", "--cov-report=", *tests
)
session.run("yarn", "install", external=True)
session.run("yarn", "test", external=True)
session.run("yarn", "build", external=True)
session.notify("cover")
@nox.session
def cover(session):
"""Coverage analysis"""
session.install("coverage")
session.run(
"coverage",
"report",
"--show-missing",
"--omit=gdbgui/SSLify.py",
"--fail-under=30",
)
session.run("coverage", "erase")
@nox.session(python="3.7")
def lint(session):
session.run(
"npx",
"prettier",
"--check",
"--config",
".prettierrc.js",
"gdbgui/src/js/**/*",
external=True,
)
session.install(*lint_dependencies)
files = ["gdbgui", "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",
"--ignore",
"build.js,gdbgui/static/js,gdbgui/static/js/build.js.map",
)
session.run("python", "setup.py", "check", "--metadata", "--strict")
@nox.session(python="3.7")
def docs(session):
session.install(*doc_dependencies)
session.run("mkdocs", "build")
@nox.session(python=python)
def develop(session):
session.install(*doc_dependencies, *lint_dependencies)
session.install("-e", ".")
command = "source %s/bin/activate" % (session.virtualenv.location_name)
session.log("Virtual Envrionment is ready to be used for development")
session.log("To use, run: '%s'", command)
@nox.session(python="3.7")
def build(session):
session.install("setuptools", "wheel", "twine")
session.run("rm", "-rf", "dist", external=True)
session.run("yarn", "build")
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/*")
@nox.session(python="3.7")
def watch_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 docker_executables(session):
session.install("PyInstaller==3.3.1")
# Windows
session.run(
"docker", "build", "-t", "gdbgui_windows", "docker/windows", external=True
)
session.run("docker", "run", "-v", '"`pwd`:/src/"', "gdbgui_windows", external=True)
# linux
session.run("docker", "build", "-t", "gdbgui_linux", "docker/linux", external=True)
session.run("docker", "run", "-v", '"`pwd`:/src/"', "gdbgui_linux", external=True)
@nox.session(python="3.7")
def build_executable_current_os(session):
session.install("PyInstaller==3.3.1")
session.run("python", "make_executable.py")