-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·51 lines (41 loc) · 1.33 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
# env vars
dirs = src/corva_unit_converter tests
coverage_report_params = --precision=2 --fail-under=94
## help: Show this help.
.PHONY: help
help: Makefile
@sed -n 's/^##\s//p' $<
## github: GitHub Actions target.
.PHONY: github
github: install lint coverage
## install: Install all requirements and Local Testing Framework.
.PHONY: install
install:
@pip install -U -r requirements.txt
@pip install -U -r requirements-test.txt
## lint: Run linter.
.PHONY: lint
lint:
@flake8 --max-line-length 100 $(dirs)
@isort --check-only --quiet --profile black $(dirs)
@mypy --check-untyped-defs --scripts-are-modules --explicit-package-bases $(dirs)
## test: Run tests and show code coverage.
.PHONY: test
test:
@coverage run -m --branch --source=. pytest tests
## coverage: Display code coverage in the console.
.PHONY: coverage
coverage: test
@coverage report $(coverage_report_params)
## testcov: Run tests and show code coverage in browser.
.PHONY: testcov
testcov: test
@coverage html --precision=2 --fail-under=50; x-www-browser htmlcov/index.html
## clean: Delete autogenerated files.
.PHONY: clean
clean:
@-python3 -Bc "for p in __import__('pathlib').Path('.').rglob('*.py[co]'): p.unlink()"
@-python3 -Bc "for p in __import__('pathlib').Path('.').rglob('__pycache__'): p.rmdir()"
@-rm -rf .pytest_cache
@-rm -rf htmlcov
@-rm -rf .coverage