This repository has been archived by the owner on May 23, 2024. It is now read-only.
forked from hellofresh/eks-rolling-update
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (65 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
### --------------------------------------------------------------------------------------------------------------------
### Variables
### (https://www.gnu.org/software/make/manual/html_node/Using-Variables.html#Using-Variables)
### --------------------------------------------------------------------------------------------------------------------
PYTHON_PATH ?= python3
VENV ?= .venv
ARGS ?= --help
IMAGE_NAME ?= "public.ecr.aws/mx51io/eks-rolling-update-fork"
ACTIVATE := true
# Other config
NO_COLOR=\033[0m
OK_COLOR=\033[32;01m
ERROR_COLOR=\033[31;01m
WARN_COLOR=\033[33;01m
### --------------------------------------------------------------------------------------------------------------------
### RULES
### (https://www.gnu.org/software/make/manual/html_node/Rule-Introduction.html#Rule-Introduction)
### --------------------------------------------------------------------------------------------------------------------
.PHONY: requirements dist
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " run to run the service"
@echo " test to run unit tests"
@echo " setup to setup the working virtual environment, and to install requirements for development"
@echo " clean to remove the created virtualenv folder"
@echo " code-style to run pep8 on src"
@echo " dist version=1.2.3 to build wheel distribution of version 1.2.3"
@echo " dist-upload version=1.2.3 to build + upload to PyPi wheel distributionof version 1.2.3"
@echo " docker-dist version=1.2.3 to build a Docker image of version 1.2.3"
setup: clean venv requirements test-requirements
venv:
$(eval ACTIVATE := . $(VENV)/bin/activate)
[ -d $(VENV) ] || ( $(PYTHON_PATH) -m venv $(VENV) \
&& $(ACTIVATE) \
&& pip3 install pip==20.2 )
run:
( $(ACTIVATE) \
&& $(PYTHON_PATH) $(CURDIR)/eks_rolling_update.py $(ARGS) )
test: code-style test-unit
test-unit:
PYTHONPATH=$(CURDIR) AWS_DEFAULT_REGION=us-east-1 nose2 --with-coverage
code-style:
flake8 --ignore E501 eksrollup/
clean:
rm -rf $(CURDIR)/$(VENV) $(CURDIR)/build $(CURDIR)/dist
requirements:
( $(ACTIVATE) \
&& $(CURDIR)/$(VENV)/bin/pip3 install -r requirements.txt )
test-requirements:
( $(ACTIVATE) \
&& $(CURDIR)/$(VENV)/bin/pip3 install -r requirements-tests.txt )
before-dist: check_version
mkdir -p build && echo "VERSION = '$(version)'" > build/__version__.py
dist: before-dist
$(PYTHON_PATH) $(CURDIR)/setup.py sdist bdist_wheel
dist-upload: dist
twine upload $(CURDIR)/dist/*
docker-dist: check_version
docker build . --build-arg VERSION=$(version) \
-t $(IMAGE_NAME):$(version) \
-t $(IMAGE_NAME):latest
check_version:
ifndef version
$(error Please specify release `version` argument.`)
endif