-
Notifications
You must be signed in to change notification settings - Fork 1
/
tasks.py
75 lines (59 loc) · 1.47 KB
/
tasks.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
from invoke import task
@task
def clean_build(c):
"""
Remove build artifacts
"""
c.run("rm -fr build/")
c.run("rm -fr dist/")
c.run("rm -fr *.egg-info")
@task
def clean_pyc(c):
"""
Remove python file artifacts
"""
c.run("find . -name '*.pyc' -exec rm -f {} +")
c.run("find . -name '*.pyo' -exec rm -f {} +")
c.run("find . -name '*~' -exec rm -f {} +")
@task
def coverage(c):
"""
check code coverage quickly with the default Python
"""
c.run("coverage run --source preferences_utils runtests.py tests")
c.run("coverage report -m")
c.run("coverage html")
c.run("xdg-open htmlcov/index.html")
@task
def test_all(c):
"""
Run tests on every python version with tox
"""
c.run("tox")
@task
def clean(c):
"""
Remove python file and build artifacts
"""
clean_build(c)
clean_pyc(c)
@task
def unittest(c):
"""
Run unittests
"""
c.run("python manage.py test")
@task(help={'bumpsize': 'Bump either for a "feature" or "breaking" change'})
def release(c, bumpsize=''):
"""
Package and upload a release
"""
clean(c)
if bumpsize:
bumpsize = '--' + bumpsize
import preferences_utils
c.run("python setup.py sdist bdist_wheel")
c.run("twine upload dist/*")
c.run('git tag -a {version} -m "build: bumpe version number to {version}"'.format(version=preferences_utils.__version__))
c.run("git push --tags")
c.run("git push origin main")