forked from Andrelamor/manual-abertura-2023-3
/
Makefile
96 lines (74 loc) · 2.98 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
.ONESHELL:
.PHONY: help setup venv install scripts format lint-blue lint-isort link-prospect lint security tests clean
ACTIVATE_LINUX=. venv/bin/activate
INSTALL_PACKAGES=pip install -r requirements.txt
UNINSTALL_PACKAGES=pip uninstall -r unrequirements.txt -y
PDFS= $(wildcard docs/assets/pdfs/*.pdf)
IMAGES= $(patsubst docs/assets/pdfs/%.pdf, docs/assets/images/%, $(PDFS))
help: ## Short description to make targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-10s\033[0m %s\n", $$1, $$2}'
image: ## Build Docker Container
@echo 'Build Docker Image...'
@docker build . --file Dockerfile --tag work-stefanini:latest
container: ## Start Docker Container
@echo 'Starting Docker Container...'
@docker run -it --rm -v /$(PWD):/work_dir -p 8000:8000 work-stefanini:latest bash
setup: clean venv install scripts ## Initial project setup with package installation and needed scripts
venv: ## Create python virtual environment in 'venv' folder
@echo "Creating python virtual environment in 'venv' folder..."
@python3 -m venv venv
install: ## Install python packages
@echo "Installing python packages..."
@$(ACTIVATE_LINUX)
@$(INSTALL_PACKAGES)
scripts: ## Run initial setup scripts
@echo "Running initial setup scripts..."
@$(ACTIVATE_LINUX)
@python3 scripts/setup.py
@git add . && git commit -m 'Initial setup'
format: ## Run blue and isor python libraries to better format the code
@echo "Running blue and isor python libraries to better format the code..."
@$(ACTIVATE_LINUX)
@blue .
@isort .
lint-blue: ## Use blue python library to check code formats
@echo "Using blue python library to check code formats..."
@$(ACTIVATE_LINUX)
@blue --check .
lint-isort: ## Use isort python library to check import orders
@echo "Using isort python library to check import orders..."
@$(ACTIVATE_LINUX)
@isort --check .
link-prospect: ## Use prospector python library to check docstrings formats
@echo "Using prospector python library to check docstrings formats..."
@$(ACTIVATE_LINUX)
@prospector --with-tool pydocstyle --doc-warning
lint: lint-blue lint-isort link-prospect
security: ## Check python libraries installed with pip-audit
@echo "Checking python libraries installed with pip-audit..."
@$(ACTIVATE_LINUX)
@$(UNINSTALL_PACKAGES)
@pip-audit --desc
@$(INSTALL_PACKAGES)
tests: ## Run python tests
@echo "Running python tests..."
@$(ACTIVATE_LINUX)
@pytest -v
security-pull: lint security tests
gh-deploy-mkdocs: ## Deploy docs
@echo "Running mkdocs gh-deploy..."
@$(ACTIVATE_LINUX)
@mkdocs gh-deploy
gh-deploy-mike: ## Deploy docs
@echo "Running mike deploy..."
@$(ACTIVATE_LINUX)
@mike deploy --push --update-aliases 0.1 latest
convert-pdf: $(IMAGES)
$(IMAGES): docs/assets/images/%: docs/assets/pdfs/*.pdf
pdftoppm -png $< $@
serve: ## Start mkdocs server
@echo "Starting mkdocs server"
@mkdocs serve -a 0.0.0.0:8000
clean: ## Clean previous python virtual environment
@echo "Cleaning previous python virtual environment..."
@rm -rf venv