forked from openstates/pyopenstates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.py
46 lines (34 loc) · 1.04 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
from invoke import task
from pathlib import Path
@task
def docs(c):
c.run("poetry run mkdocs serve", pty=True)
@task
def test(c, args=""):
c.run("poetry run pytest " + args, pty=True)
# --cov=src/ --cov-report html
@task
def mypy(c):
c.run("poetry run mypy src/", pty=True)
@task
def lint(c):
c.run("poetry run flake8 src/ tests/ --ignore=E203,E501,W503", pty=True)
c.run("poetry run black --check src/ tests/", pty=True)
@task
def spellcheck(c):
files = Path("docs").glob("*.md")
for file in files:
print(file)
c.run(f"aspell check {file}", pty=True)
@task(lint, test)
def release(c, old, new):
# c.run(
# "poetry run bump2version x pyproject.toml"
# f"--current-version {old} --new-version {new} --commit --tag --allow-dirty",
# pty=True,
# )
c.run("git push", pty=True)
c.run("git push --tags", pty=True)
c.run("poetry publish --build", pty=True)
c.run("poetry run mkdocs gh-deploy", pty=True)
c.run(f"gh release create v{new} -F docs/changelog.md")