forked from canonical/craft-store
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
109 lines (89 loc) · 2.49 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
.PHONY: help
help: ## Show this help.
@printf "%-40s %s\n" "Target" "Description"
@printf "%-40s %s\n" "------" "-----------"
@fgrep " ## " $(MAKEFILE_LIST) | fgrep -v grep | awk -F ': .*## ' '{$$1 = sprintf("%-40s", $$1)} 1'
.PHONY: autoformat
autoformat: ## Run automatic code formatters.
isort .
autoflake --remove-all-unused-imports --ignore-init-module-imports -ri .
black .
.PHONY: clean
clean: ## Clean artifacts from building, testing, etc.
rm -rf build/
rm -rf dist/
rm -rf .eggs/
find . -name '*.egg-info' -exec rm -rf {} +
find . -name '*.egg' -exec rm -f {} +
rm -rf docs/_build/
rm -f docs/craft_store.*
rm -f docs/modules.rst
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -rf {} +
rm -rf .tox/
rm -f .coverage
rm -rf htmlcov/
rm -rf .pytest_cache
.PHONY: coverage
coverage: ## Run pytest with coverage report.
coverage run --source craft_sore -m pytest
coverage report -m
coverage html
.PHONY: docs
docs: ## Generate documentation.
rm -f docs/craft_store.rst
rm -f docs/modules.rst
pip install -r docs/requirements.txt
$(MAKE) -C docs clean
$(MAKE) -C docs html
.PHONY: dist
dist: clean ## Build python package.
python setup.py sdist
python setup.py bdist_wheel
ls -l dist
.PHONY: freeze-requirements
freeze-requirements: ## Re-freeze requirements.
tools/freeze-requirements.sh
.PHONY: install
install: clean ## Install python package.
python setup.py install
.PHONY: lint
lint: test-black test-codespell test-flake8 test-isort test-mypy test-pydocstyle test-pylint test-pyright ## Run all linting tests.
.PHONY: release
release: dist ## Release with twine.
twine upload dist/*
.PHONY: test-black
test-black:
black --check --diff .
.PHONY: test-codespell
test-codespell:
codespell .
.PHONY: test-flake8
test-flake8:
flake8 .
.PHONY: test-integrations
test-integrations: ## Run integration tests.
pytest tests/integration
.PHONY: test-isort
test-isort:
isort --check craft_store tests
.PHONY: test-mypy
test-mypy:
mypy craft_store tests
.PHONY: test-pydocstyle
test-pydocstyle:
pydocstyle craft_store --ignore-decorator=overrides
.PHONY: test-pylint
test-pylint:
pylint craft_store
pylint tests --disable=missing-module-docstring,missing-function-docstring,redefined-outer-name
.PHONY: test-pyright
test-pyright:
pyright .
.PHONY: test-units
test-units: ## Run unit tests.
pytest tests/unit
.PHONY: tests
tests: lint test-integrations test-units ## Run all tests.