-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjeeves.py
59 lines (42 loc) · 1.35 KB
/
jeeves.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
from pathlib import Path
import sh
from jeeves_yeti_pyproject import flakeheaven
from rich.console import Console
gh = sh.gh.bake(_env={**os.environ, 'NO_COLOR': '1'})
artifacts = Path(__file__).parent / 'tests/artifacts'
pytest_xml = artifacts / 'pytest.xml'
console = Console()
def install_mkdocs_insiders():
"""Install Insiders version of `mkdocs-material` theme."""
name = 'mkdocs-material-insiders'
if not (Path.cwd() / name).is_dir():
sh.gh.repo.clone(f'iolanta-tech/{name}')
sh.pip.install('-e', name)
def deploy_to_github_pages():
"""Build the docs & deploy → gh-pages branch."""
try:
sh.mkdocs('gh-deploy', '--force', '--clean', '--verbose')
except sh.ErrorReturnCode as error:
raise ValueError(error.stderr.decode('utf-8'))
def serve():
"""
Serve the iolanta.tech site.
The site will be available at http://localhost:9841
"""
sh.mkdocs.serve(
'-a', 'localhost:6451',
_fg=True,
)
def ci():
"""Run pytest and save the results to artifacts directory."""
flakeheaven.call(Path(__file__).parent)
artifacts.mkdir(parents=True, exist_ok=True)
sh.pytest.bake(
color='no',
junitxml=pytest_xml,
cov_report='term-missing:skip-covered',
cov='iolanta',
).tests(
_out=artifacts / 'coverage.txt',
)