This repository has been archived by the owner on Apr 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
62 lines (45 loc) · 1.67 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
import os
import shutil
import nox
nox.options.reuse_existing_virtualenvs = True
PYTHON_VERSIONS = ['3.6', '3.7', '3.8']
@nox.session(python=PYTHON_VERSIONS[-1])
def lint(session):
"""Performs pep8 and security checks."""
source_code = 'infoblox'
session.install('flake8==3.7.9', 'bandit==1.6.2')
session.run('flake8', source_code)
session.run('bandit', '-r', source_code)
@nox.session(python=PYTHON_VERSIONS)
def tests(session):
"""Runs the test suite."""
session.install('poetry>=1.0.0,<2.0.0')
session.run('poetry', 'install')
session.run('pytest')
# we notify codecov when the latest version of python is used
if session.python == PYTHON_VERSIONS[-1] and 'APPVEYOR_URL' not in os.environ:
session.notify('codecov')
@nox.session
def codecov(session):
"""Runs codecov command to share coverage information on codecov.io"""
session.install('codecov==2.0.15')
session.run('coverage', 'xml', '-i')
session.run('codecov', '-f', 'coverage.xml')
@nox.session(python=PYTHON_VERSIONS[-1])
def docs(session):
"""Builds the documentation."""
session.install('mkdocs==1.0.4')
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,<2.0.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)