Last active
September 14, 2023 12:47
-
-
Save toloco/1fc89c343aed33128c3383bd22b88e25 to your computer and use it in GitHub Desktop.
Makefile template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!make | |
################################################################################ | |
# Makefile internals | |
################################################################################ | |
.PHONY: help | |
help: | |
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | sort | \ | |
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-6s\033[0m %s\n", $$1, $$2}' | |
################################################################################ | |
clean: ## Remove all pyc and caches | |
@find . -name '*.py[co]' -exec rm -f {} + | |
@find . -name '\.pytest_cache' -exec rm -fr {} + | |
@find . -name '\.mypy_cache' -exec rm -fr {} + | |
@find . -name '__pycache__' -exec rm -fr {} + | |
@docker ps -aq | xargs -r docker rm -f | |
@docker volume ls -q | xargs -r docker volume rm -f | |
@docker images | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi -f | |
@docker builder prune -f | |
format: ## Format the code | |
@docker-compose run --no-deps backend sh -c " \ | |
python -m isort --atomic . && \ | |
python -m black . && \ | |
python -m autoflake \ | |
--in-place \ | |
--remove-unused-variables \ | |
--remove-all-unused-imports \ | |
--remove-duplicate-keys \ | |
--ignore-init-module-imports \ | |
--recursive . \ | |
" | |
@docker-compose run --no-deps frontend npm run format | |
lint: ## Static analysis | |
@docker-compose run --no-deps backend sh -c " \ | |
python -m isort -c --atomic . && \ | |
python -m black --check . \ | |
" | |
@docker-compose run --no-deps frontend npm run lint | |
build: ## Build all docker images | |
docker-compose build | |
test: | |
@docker-compose run --no-deps backend sh -c "pytest ." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment