.PHONY: help down ci_lint_and_test ci_lint_and_test_clean
.DEFAULT_GOAL := help

# define root project dir
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

help:
	@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

down: ## Shutdown docker app
	docker compose down --remove-orphans -v

ci_lint_and_test:  ## Run linters and unit tests inside docker
	mkdir -p build
	chmod 777 build
	docker compose up \
		--build \
		--exit-code-from lint-and-test \
		--abort-on-container-exit \
		--remove-orphans \
		lint-and-test

ci_lint_and_test_clean: down
	rm -rf build
