-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
52 lines (46 loc) · 1.87 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
TEST = pytest
TEST_ARGS = -s --verbose --color=yes
TYPE_CHECK = mypy --strict --allow-untyped-decorators --ignore-missing-imports
STYLE_CHECK = flake8
COVERAGE = python -m pytest
DEMO = './demo-assignments'
.PHONY: all
all: check-style check-type run-test run-test-coverage clean
@echo "All checks passed!"
.PHONY: check-type
check-type:
$(TYPE_CHECK) $(DEMO)/A0/hello
$(TYPE_CHECK) $(DEMO)/A0-OOP/hello
$(TYPE_CHECK) $(DEMO)/A1/cold
$(TYPE_CHECK) $(DEMO)/A1-OOP/cold
$(TYPE_CHECK) $(DEMO)/A2-ABC/egypt
.PHONY: check-style
check-style:
$(STYLE_CHECK) $(DEMO)/A0/hello
$(STYLE_CHECK) $(DEMO)/A0-OOP/hello
$(STYLE_CHECK) $(DEMO)/A1/cold
$(STYLE_CHECK) $(DEMO)/A1-OOP/cold
$(STYLE_CHECK) $(DEMO)/A2-ABC/egypt
# discover and run all tests
.PHONY: run-test
run-test:
$(TEST) $(TEST_ARGS) $(DEMO)/A0/hello/tests
$(TEST) $(TEST_ARGS) $(DEMO)/A0-OOP/hello/tests
$(TEST) $(TEST_ARGS) $(DEMO)/A1/cold/tests
$(TEST) $(TEST_ARGS) $(DEMO)/A1-OOP/cold/tests
$(TEST) $(TEST_ARGS) $(DEMO)/A2-ABC/egypt/tests
.PHONY: run-test-coverage
run-test-coverage:
$(COVERAGE) -v --cov-report=term-missing --cov=$(DEMO)/A0/hello $(DEMO)/A0/hello/tests
$(COVERAGE) -v --cov-report=term-missing --cov=$(DEMO)/A0-OOP/hello $(DEMO)/A0-OOP/hello/tests
$(COVERAGE) -v --cov-report=term-missing --cov=$(DEMO)/A1/cold $(DEMO)/A1/cold/tests
$(COVERAGE) -v --cov-report=term-missing --cov=$(DEMO)/A1-OOP/cold $(DEMO)/A1-OOP/cold/tests
$(COVERAGE) -v --cov-report=term-missing --cov=$(DEMO)/A2-ABC/egypt $(DEMO)/A2-ABC/egypt/tests
.PHONY: clean
clean:
# remove all caches recursively
rm -rf `find . -type d -name __pycache__` # remove all pycache
rm -rf `find . -type d -name .pytest_cache` # remove all pytest cache
rm -rf `find . -type d -name .mypy_cache` # remove all mypy cache
rm -rf `find . -type d -name .hypothesis` # remove all hypothesis cache
rm -rf `find . -name .coverage` # remove all coverage cache