-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
119 lines (97 loc) · 2.78 KB
/
Makefile
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Automation of various common tasks
# -----------------------------------------------------------------------------
# QA
# -----------------------------------------------------------------------------
.PHONY: isort
isort:
poetry run isort mlte/
poetry run isort test/
poetry run isort testbed/
poetry run isort demo/
poetry run isort tools/
.PHONY: check-isort
check-isort:
poetry run isort --check mlte/
poetry run isort --check test/
poetry run isort --check testbed/
poetry run isort --check demo/
poetry run isort --check tools/
# Format all source code
.PHONY: format
format:
poetry run black mlte/
poetry run black test/
poetry run black testbed/
poetry run black demo/
poetry run black demo/simple/*.ipynb
poetry run black demo/scenarios/*.ipynb
poetry run black tools/
.PHONY: check-format
check-format:
poetry run black --check mlte/
poetry run black --check test/
poetry run black --check testbed/
poetry run black --check demo/
poetry run black --check demo/simple/*.ipynb
poetry run black --check demo/scenarios/*.ipynb
poetry run black --check tools/
# Lint all source code
.PHONY: lint
lint:
poetry run flake8 mlte/
poetry run flake8 test/
poetry run flake8 tools/
.PHONY: check-lint
check-lint: lint
# Typecheck all source code
.PHONY: typecheck
typecheck:
poetry run mypy mlte/
poetry run mypy test/
poetry run mypy tools/
.PHONY: check-typecheck
check-typecheck: typecheck
# Doc generation.
.PHONY: docs
docs:
cd docs && poetry run mkdocs build --strict
# Clean cache files
.PHONY: clean
clean:
rm -r -f .mypy_cache .pytest_cache
# All quality assurance
.PHONY: qa
qa: isort format lint typecheck
# Check all QA tasks
.PHONY: check
check: check-isort check-format check-lint check-typecheck
# -----------------------------------------------------------------------------
# Unit Tests
# -----------------------------------------------------------------------------
# Run unit tests with pytest
.PHONY: test
test:
poetry run pytest --cov=mlte test
# Open coverage results in a browser
.PHONY: cov-results
cov-results:
coverage html && open htmlcov/index.html
# Demo Jupyter Notebook tests
.PHONY: demo-test
demo-test:
bash demo/simple/test.sh
bash demo/scenarios/test.sh
# -----------------------------------------------------------------------------
# Schema Generation / Vetting
# -----------------------------------------------------------------------------
.PHONY: gen
gen:
poetry run python tools/schema.py generate mlte --verbose
.PHONY: vet
vet:
poetry run python tools/schema.py vet mlte --verbose
# -----------------------------------------------------------------------------
# All actions and checks needed to update and review for pushing.
# -----------------------------------------------------------------------------
.PHONY: ci
ci: clean gen qa docs test