forked from click-contrib/click_params
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
59 lines (43 loc) · 1.56 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
import os
import shutil
import nox
nox.options.reuse_existing_virtualenvs = True
PYTHON_VERSIONS = ['pypy3', '3.7', '3.8', '3.9', '3.10', '3.11']
CI_ENVIRONMENT = 'GITHUB_ACTIONS' in os.environ
@nox.session(python=PYTHON_VERSIONS[-1])
def lint(session):
"""Performs pep8 and security checks."""
source_code = 'click_params'
session.install('flake8==3.9.2', 'bandit==1.7.4')
session.run('flake8', source_code)
session.run('bandit', '-r', source_code)
@nox.session(python=PYTHON_VERSIONS[-1])
def safety(session):
"""Checks vulnerabilities of the installed packages."""
session.install('poetry>=1.0.0,<1.3.0')
session.run('poetry', 'install')
session.run('safety', 'check')
@nox.session(python=PYTHON_VERSIONS)
def tests(session):
"""Runs the test suite."""
session.install('poetry>=1.0.0,<1.3.0')
session.run('poetry', 'install')
session.run('pytest')
@nox.session(python=PYTHON_VERSIONS[-1])
def docs(session):
"""Builds the documentation."""
session.install('mkdocs==1.3.0')
session.run('mkdocs', 'build', '--clean')
@nox.session(python=PYTHON_VERSIONS[1])
def deploy(session):
"""
Deploys on pypi.
"""
if 'POETRY_PYPI_TOKEN_PYPI' not in os.environ:
session.error('you must specify your pypi token api to deploy your package')
session.install('poetry>=1.0.0,<1.3.0')
session.run('poetry', 'publish', '--build')
@nox.session(python=False)
def clean(*_):
"""Since nox take a bit of memory, this command helps to clean nox environment."""
shutil.rmtree('.nox', ignore_errors=True)