Skip to content

Commit da0336b

Browse files
committed
Cleanup makefile
1 parent 59d5374 commit da0336b

File tree

1 file changed

+59
-48
lines changed

1 file changed

+59
-48
lines changed

Makefile

+59-48
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
# - In windows, only WSL is supported
77
#
88
# by sanderegg, pcrespov
9+
#
910
.DEFAULT_GOAL := help
10-
SHELL := /bin/bash
1111

12+
SHELL := /bin/bash
1213

13-
# TOOLS --------------------------------------
1414

1515
MAKE_C := $(MAKE) --no-print-directory --directory
1616

@@ -60,7 +60,9 @@ export SWARM_STACK_NAME ?= simcore
6060
export DOCKER_IMAGE_TAG ?= latest
6161
export DOCKER_REGISTRY ?= itisfoundation
6262

63+
6364
.PHONY: help
65+
6466
help: ## help on rule's targets
6567
ifeq ($(IS_WIN),)
6668
@awk --posix 'BEGIN {FS = ":.*?## "} /^[[:alpha:][:space:]_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@@ -70,7 +72,7 @@ endif
7072

7173

7274

73-
## docker BUILD -------------------------------
75+
## DOCKER BUILD -------------------------------
7476
#
7577
# - all builds are inmediatly tagged as 'local/{service}:${BUILD_TARGET}' where BUILD_TARGET='development', 'production', 'cache'
7678
# - only production and cache images are released (i.e. tagged pushed into registry)
@@ -127,7 +129,6 @@ endif
127129
endif
128130

129131

130-
# TODO: should download cache if any??
131132
build-cache build-cache-nc build-cache-kit build-cache-x: .env ## Build cache images and tags them as 'local/{service-name}:cache'
132133
ifeq ($(target),)
133134
# Compiling front-end
@@ -152,7 +153,7 @@ shell:
152153
docker run -it local/$(target):production /bin/sh
153154

154155

155-
## docker SWARM -------------------------------
156+
## DOCKER SWARM -------------------------------
156157
#
157158
# - All resolved configuration are named as .stack-${name}-*.yml to distinguish from docker-compose files which can be parametrized
158159
#
@@ -179,6 +180,7 @@ docker-compose-configs = $(wildcard services/docker-compose*.yml)
179180
# Creating config for ops stack to $@
180181
@docker-compose -f services/docker-compose-ops.yml --log-level=ERROR config > $@
181182

183+
182184
.PHONY: up-devel up-prod up-version up-latest .deploy-ops
183185

184186
.deploy-ops: .stack-ops.yml
@@ -235,7 +237,7 @@ leave: ## Forces to stop all services, networks, etc by the node leaving the swa
235237
$(if $(SWARM_HOSTS),,docker swarm init)
236238

237239

238-
## docker TAGS -------------------------------
240+
## DOCKER TAGS -------------------------------
239241

240242
.PHONY: tag-local tag-cache tag-version tag-latest
241243

@@ -263,10 +265,10 @@ tag-latest: ## Tags last locally built production images as '${DOCKER_REGISTRY}/
263265

264266

265267

266-
## docker PULL/PUSH -------------------------------
268+
## DOCKER PULL/PUSH -------------------------------
267269
#
268-
# TODO: cannot push modified/untracke
269-
# TODO: cannot push discetedD
270+
# TODO: cannot push modified/untracked
271+
# TODO: cannot push disceted
270272
#
271273
.PHONY: pull-cache pull-version
272274
pull-cache: .env
@@ -296,21 +298,7 @@ push-version: tag-version
296298
)
297299

298300

299-
## PYTHON -------------------------------
300-
.PHONY: pylint
301-
302-
pylint: ## Runs python linter framework's wide
303-
# See exit codes and command line https://pylint.readthedocs.io/en/latest/user_guide/run.html#exit-codes
304-
# TODO: NOT windows friendly
305-
/bin/bash -c "pylint --jobs=0 --rcfile=.pylintrc $(strip $(shell find services packages -iname '*.py' \
306-
-not -path "*egg*" \
307-
-not -path "*migration*" \
308-
-not -path "*datcore.py" \
309-
-not -path "*sandbox*" \
310-
-not -path "*-sdk/python*" \
311-
-not -path "*generated_code*" \
312-
-not -path "*datcore.py" \
313-
-not -path "*web/server*"))"
301+
## ENVIRONMENT -------------------------------
314302

315303
.PHONY: devenv devenv-all
316304

@@ -332,25 +320,42 @@ devenv-all: devenv ## sets up extra development tools (everything else besides p
332320
@$(MAKE_C) scripts/json-schema-to-openapi-schema
333321

334322

335-
## MISC -------------------------------
336-
337-
.PHONY: new-service
338-
new-service: .venv ## Bakes a new project from cookiecutter-simcore-pyservice and drops it under services/ [UNDER DEV]
339-
$</bin/pip3 --quiet install cookiecutter
340-
.venv/bin/cookiecutter gh:itisfoundation/cookiecutter-simcore-pyservice --output-dir $(CURDIR)/services
341-
342-
# TODO: NOT windows friendly
343323
.env: .env-devel ## creates .env file from defaults in .env-devel
344324
$(if $(wildcard $@), \
345325
@echo "WARNING ##### $< is newer than $@ ####"; diff -uN $@ $<; false;,\
346-
@echo "WARNING ##### $@ does not exist, copying $< ############"; cp $< $@)
326+
@echo "WARNING ##### $@ does not exist, cloning $< as $@ ############"; cp $< $@)
327+
347328

348-
# TODO: NOT windows friendly
349329
.vscode/settings.json: .vscode-template/settings.json
350330
$(info WARNING: ##### $< is newer than $@ ####)
351331
@diff -uN $@ $<
352332
@false
353333

334+
335+
336+
## TOOLS -------------------------------
337+
338+
.PHONY: pylint
339+
340+
pylint: ## Runs python linter framework's wide
341+
/bin/bash -c "pylint --jobs=0 --rcfile=.pylintrc $(strip $(shell find services packages -iname '*.py' \
342+
-not -path "*egg*" \
343+
-not -path "*migration*" \
344+
-not -path "*datcore.py" \
345+
-not -path "*sandbox*" \
346+
-not -path "*-sdk/python*" \
347+
-not -path "*generated_code*" \
348+
-not -path "*datcore.py" \
349+
-not -path "*web/server*"))"
350+
# See exit codes and command line https://pylint.readthedocs.io/en/latest/user_guide/run.html#exit-codes
351+
352+
353+
.PHONY: new-service
354+
new-service: .venv ## Bakes a new project from cookiecutter-simcore-pyservice and drops it under services/ [UNDER DEV]
355+
$</bin/pip3 --quiet install cookiecutter
356+
.venv/bin/cookiecutter gh:itisfoundation/cookiecutter-simcore-pyservice --output-dir $(CURDIR)/services
357+
358+
354359
.PHONY: openapi-specs
355360
openapi-specs: ## bundles and validates openapi specifications and schemas of ALL service's API
356361
@$(MAKE_C) services/web/server $@
@@ -366,6 +371,23 @@ code-analysis: .codeclimate.yml ## runs code-climate analysis
366371
./scripts/code-climate.bash analyze
367372

368373

374+
.PHONY: auto-doc
375+
auto-doc: .stack-simcore-version.yml ## updates diagrams for README.md
376+
# Parsing docker-compose config $< and creating graph
377+
@./scripts/docker-compose-viz.bash $<
378+
# Updating docs/img
379+
@mv --verbose $<.png docs/img/
380+
381+
382+
.PHONY: postgres-upgrade
383+
postgres-upgrade: ## initalize or upgrade postgres db to latest state
384+
@$(MAKE_C) packages/postgres-database/docker build
385+
@$(MAKE_C) packages/postgres-database/docker upgrade
386+
387+
388+
389+
## INFO -------------------------------
390+
369391
.PHONY: info info-images info-swarm info-tools
370392
info: ## displays setup information
371393
# setup info:
@@ -388,7 +410,6 @@ info: ## displays setup information
388410
@echo ' python : $(shell python3 --version)'
389411

390412

391-
392413
define show-meta
393414
$(foreach iid,$(shell docker images */$(1):* -q | sort | uniq),\
394415
docker image inspect $(iid) | jq '.[0] | .RepoTags, .ContainerConfig.Labels';)
@@ -423,6 +444,9 @@ ifneq ($(SWARM_HOSTS), )
423444
endif
424445

425446

447+
448+
## CLEAN -------------------------------
449+
426450
.PHONY: clean clean-images clean-venv clean-all clean-ps
427451

428452
_git_clean_args := -dxf -e .vscode -e TODO.md -e .venv
@@ -460,19 +484,6 @@ clean-all: clean clean-ps clean-images # Deep clean including .venv and produced
460484
-rm -rf .venv
461485

462486

463-
.PHONY: postgres-upgrade
464-
postgres-upgrade: ## initalize or upgrade postgres db to latest state
465-
@$(MAKE_C) packages/postgres-database/docker build
466-
@$(MAKE_C) packages/postgres-database/docker upgrade
467-
468-
469487
.PHONY: reset
470488
reset: ## restart docker daemon (LINUX ONLY)
471489
sudo systemctl restart docker
472-
473-
.PHONY: auto-doc
474-
auto-doc: .stack-simcore-version.yml ## updates diagrams for README.md
475-
# Parsing docker-compose config $< and creating graph
476-
@./scripts/docker-compose-viz.bash $<
477-
# Updating docs/img
478-
@mv --verbose $<.png docs/img/

0 commit comments

Comments
 (0)