forked from funkyfuture/deck-chores
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
108 lines (86 loc) · 2.76 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
.DEFAULT_GOAL := build-dev
REPO_NAME = funkyfuture/deck-chores
VERSION = $(shell grep "VERSION = " setup.py | cut -d"=" -f2 | tr -d " '")
IMAGE_NAME = $(REPO_NAME):$(VERSION)
GIT_SHA1 = $(shell git rev-parse HEAD)
export IMAGE_NAME
export GIT_SHA1
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
.PHONY: black
black: ## code-formatting with black
black deck_chores tests setup.py
.PHONY: help
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
.PHONY: build
build: ## builds the Docker image
hooks/build
.PHONY: run
run: build ## runs deck-chores in a temporary container
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock $(IMAGE_NAME)
.PHONY: build-dev
build-dev: ## builds the Docker image for debugging
docker build -t $(REPO_NAME):dev --rm -f Dockerfile-dev .
.PHONY: run-dev
run-dev: build-dev ## runs deck-chores in a temporary container for debugging
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock $(REPO_NAME):dev
.PHONY: clean
clean: clean-build clean-pyc clean-test ## cleans all artifacts
.PHONY: clean-build
clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
.PHONY: clean-pyc
clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
.PHONY: clean-test
clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
.PHONY: lint
lint: ## check style with flake8
flake8 deck_chores tests
.PHONY: test
test: ## run all tests
tox
.PHONY: docs
docs: ## generate Sphinx HTML documentation, including API docs
$(MAKE) -C docs clean
$(MAKE) -C docs html
xdg-open docs/_build/html/index.html
.PHONY: release
release: test clean build ## release the current version on github, the PyPI and the Docker hub
git tag -f $(VERSION)
git push origin master
git push -f origin $(VERSION)
python setup.py sdist bdist_wheel upload
$(MAKE) release-multiimage
.PHONY: release-arm
release-arm: ## release the arm build on the Docker hub
hooks/release-arm $(IMAGE_NAME) $(GIT_SHA1)
.PHONY: release-multiimage
release-multiimage: release-arm ## release the multi-arch manifest on the Docker hub
hooks/release-multiimage $(REPO_NAME) $(VERSION)
.PHONY: dist
dist: clean ## builds source and wheel package
python setup.py sdist
python setup.py bdist_wheel
ls -l dist
.PHONY: install
install: clean ## install the package to the active Python's site-packages
python setup.py install