-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtasks.py
80 lines (64 loc) · 1.81 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
76
77
78
79
80
import inspect
import os
import platform
from pathlib import Path
from invoke import task
os.chdir(Path(__file__).parent)
@task
def format(ctx):
"""Run black and isort"""
for cmd in ("black .", "isort ."):
ctx.run(cmd, echo=True)
@task
def check(ctx):
"""Run flake8"""
for cmd in ("flake8 .",):
ctx.run(cmd, echo=True)
@task
def test(ctx):
"""Run tests"""
for cmd in ("pytest -vv --cov --junitxml=../build/reports/tests.xml",):
ctx.run(cmd, echo=True)
@task
def build_doc(ctx):
for cmd in (
"sphinx-apidoc -P -f -o docs/source src/pygeofun",
"sphinx-build -b html docs dist/docs",
):
ctx.run(cmd, echo=True)
@task
def build(ctx):
"""Build"""
cmds = []
if platform.platform().startswith("Win"):
for pyver in ("3.9.13", "3.10.11", "3.11.5"):
cmds += [
"rmdir /S /Q build && echo 'Removed build dir' || echo 'No previous build'",
f"pyenv install {pyver}",
f"pyenv local {pyver}",
"pyenv local",
"pyenv exec python --version",
"pyenv exec poetry env use python",
"pyenv exec poetry update",
"pyenv exec poetry run poetry build -vv",
"pyenv exec poetry run poetry install",
]
else:
for pyver in ("3.9", "3.10", "3.11", "3.12"):
cmds += [
"rm -rf build",
f"poetry env use {pyver}",
"poetry update",
"poetry run poetry build -vv",
"poetry run poetry install",
]
for cmd in cmds:
ctx.run(cmd, echo=True)
@task(build)
def publish(ctx):
"""Publish"""
cmds = [
"poetry publish",
]
for cmd in cmds:
ctx.run(cmd, echo=True)