-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(Makefile): add install, check and help targets
- add help target and description of all the targets - add install target to install project dependencies and setup virtual environment - add check target to quality check code using pre-commit hooks - set help as default target - remove lint and format targets as they are redundant
- Loading branch information
Showing
1 changed file
with
24 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
gen: | ||
rm -f gen/*.py; cd proto; buf generate; cd ... | ||
|
||
mongo: | ||
docker run -d --name py-mongo -p 27017:27017 mongo | ||
|
||
dev: | ||
poetry run nodemon --no-colors --exec python main.py | ||
install: ## Install dependencies and pre-commit hooks + setup virtual environment. | ||
@echo "🚀 Creating virtual environment using pyenv and poetry" | ||
@poetry install | ||
@poetry run pre-commit install | ||
@poetry shell | ||
|
||
env: | ||
poetry shell | ||
|
||
docker: | ||
docker build -t py-amibot . | ||
gen: ## Generate proto buffs. | ||
rm -f gen/*.py; cd proto; buf generate; cd ... | ||
|
||
dockerRun: | ||
docker run -d --name py-amibot -p 3333:3333 py-amibot | ||
mongo: ## Run mongodb server in docker. | ||
docker run -d --name py-mongo -p 27017:27017 mongo | ||
|
||
lint: | ||
poetry run ruff check **/*.py | ||
dev: ## Run amibot server | ||
poetry run nodemon --no-colors --exec python main.py | ||
|
||
format: | ||
poetry run ruff format **/*.py | ||
docker: ## Builds the docker image for amibot server. | ||
@docker build -t py-amibot . | ||
|
||
.PHONY: gen, mongo, dev, env, docker, dockerRun | ||
dockerRun: ## Runs the amibot server in docker. | ||
@docker run -d --name py-amibot -p 3333:3333 py-amibot | ||
|
||
check: ## Run code quality tools. | ||
@echo "🚀 Checking Poetry lock file consistency with 'pyproject.toml': Running poetry lock --check" | ||
@poetry check --lock | ||
@echo "🚀 Linting code: Running pre-commit" | ||
@poetry run pre-commit run -a | ||
|
||
help: ## List available targets with respective description. | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | ||
|
||
.PHONY: gen, mongo, dev, env, docker, dockerRun, install, check, help | ||
.DEFAULT_GOAL := help |