From e5aace976528dd01cd4279d5c65dab75d91b2303 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Sat, 23 Apr 2022 16:52:37 +0000 Subject: [PATCH] feat: add Makefile Make easier to handle common tasks --- Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fde3e64 --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +.DEFAULT_GOAL := help + +COMPOSE = docker-compose -f docker-compose.yml -f docker-compose.override.yml + +.PHONY: setup +setup: ## setup project + @mkdir -p priv/plts + @mix do local.rebar --force, local.hex --force + @mix do deps.get, deps.compile + @mix dialyzer --plt + +.PHONY: check_format +check_format: ## run format checker + @mix format --check-formatted + +.PHONY: credo +credo: ## run credo + @mix credo suggest --strict --format=flycheck + +.PHONY: dialyzer +dialyzer: ## run dialyzer + @mix dialyzer --no-check --quiet --ignore-exit-status --format short + +.PHONY: static_code_analysis +static_code_analysis: check_format credo dialyzer ## run static code analysis + +.PHONY: test +test: ## run tests + @mix test --cover --trace --slowest 10 + +.PHONY: compose_up +compose_up: ## start containers for this service + @$(COMPOSE) up -d + +.PHONY: compose_test +compose_test: ## run tests in containers + @$(COMPOSE) run -e MIX_ENV=test --entrypoint make app test + +.PHONY: help +help: + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'