-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
95 lines (76 loc) · 2.11 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
DOCKER_IMAGE_NAME?=webdebugger
DOCKER_IMAGE_TAG?=local
DOCKER_USERNAME?=
DOCKER_PASSWORD?=
APP_PORT?=8000
APP_DELAY?=0
INTERACTIVE:=$(shell [ -t 0 ] && echo 1)
PYTHON_37_IMAGE?=python:3.7-slim
DOCKER_USER_FLAG?=-u $(shell id -u)
DOCKER_FLAGS?=-t
ifeq ($(INTERACTIVE), 1)
DOCKER_FLAGS:=-it
endif
#
# Requirements
#
.PHONY: install_poetry
install_poetry:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
.PHONY: requirements
requirements:
poetry install --local
#
# Tests
#
.PHONY: pycodesyle
pycodesyle:
poetry run pycodestyle webdebugger/
.PHONY: pytest
pytest:
poetry run pytest -v
.PHONY: hadolint
hadolint:
docker run --rm hadolint/hadolint:latest-alpine < ./Dockerfile
#
# Versions
#
.PHONY: version
version:
poetry version
.PHONY: version-patch
version-patch:
poetry run bump2version patch
$(MAKE) version
.PHONY: version-minor
version-minor:
poetry run bump2version minor
$(MAKE) version
.PHONY: version-major
version-major:
poetry run bump2version major
$(MAKE) version
#
# Docker
#
.PHONY: build
build:
docker build --cache-from $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) -t $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) .
.PHONY: docker-pycodestyle
docker-pycodestyle: build
docker run $(DOCKER_FLAGS) $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) poetry run pycodestyle webdebugger/
.PHONY: docker-pytest
docker-pytest: build
docker run $(DOCKER_FLAGS) $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) poetry run pytest -v
.PHONY: docker-run
docker-run: build
docker run -p $(APP_PORT):$(APP_PORT) --env APP_PORT=$(APP_PORT) --env APP_DELAY=$(APP_DELAY) $(DOCKER_FLAGS) $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
.PHONY: docker-shell
docker-shell: build
docker run -p $(APP_PORT):$(APP_PORT) --env APP_PORT=$(APP_PORT) --env APP_DELAY=$(APP_DELAY) $(DOCKER_FLAGS) $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) sh
.PHONY: docker-version
docker-version: build
docker run -p $(APP_PORT):$(APP_PORT) --env APP_PORT=$(APP_PORT) --env APP_DELAY=$(APP_DELAY) $(DOCKER_FLAGS) $(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) poetry version
.PHONY: docker-publish
docker-publish: build
./docker-publish.sh