-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
69 lines (53 loc) · 1.96 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
#!/usr/bin/make -f
# Makefile for harambe
ifeq ($(OS),Windows_NT)
CWD ?= "$(shell echo %CD%)"
DOCKER ?= docker
else
CWD ?= "$(shell pwd)"
DOCKER ?= $(if $(shell docker -v 2>/dev/null),docker,podman)
endif
DOCKER_IMAGE_TAG ?= reworkd/harambe
.DEFAULT_GOAL := help
include Prebuild.mk
help: ## Show this helpful message
@for ML in $(MAKEFILE_LIST); do \
grep -E '^[a-zA-Z_-]+:.*?## .*$$' $$ML | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'; \
done
.PHONY: help
format: ## Format code using Docker
@$(DOCKER) run -it --rm -v "`pwd`":/src/$(DOCKER_IMAGE_TAG) -e TARGET=$(target) $(DOCKER_IMAGE_TAG) make FORMAT
.PHONY: format
FORMAT: ## Format code
@echo "Formatting code 🧹"
@poetry run ruff format
.PHONY: FORMAT
format_check: ## Check code formatting using Docker
@$(DOCKER) run -it --rm -v "`pwd`":/src/$(DOCKER_IMAGE_TAG) -e TARGET=$(target) $(DOCKER_IMAGE_TAG) make LINT
.PHONY: format_check
FORMAT_CHECK: ## Check code formatting
@echo "Checking code 🧹"
@poetry run ruff format --diff
.PHONY: FORMAT_CHECK
lint: ## Lint code using Docker
@$(DOCKER) run -it --rm -v "`pwd`":/src/$(DOCKER_IMAGE_TAG) -e TARGET=$(target) $(DOCKER_IMAGE_TAG) make LINT
.PHONY: lint
LINT: ## Lint code
@poetry run ruff check --fix
.PHONY: LINT
lint_check: ## Check code quality using Docker
@$(DOCKER) run -it --rm -v "`pwd`":/src/$(DOCKER_IMAGE_TAG) -e TARGET=$(target) $(DOCKER_IMAGE_TAG) make LINT_CHECK
.PHONY: lint_check
LINT_CHECK: ## Check code quality
@poetry run ruff check
.PHONY: LINT_CHECK
test: $(HARAMBE) $(OUTPUT_DIR) $(CONFIG_FILE) ## Run tests using Docker
@$(DOCKER) build -t $(DOCKER_IMAGE_TAG) .
@$(DOCKER) run -it --rm -v "`pwd`":/src/$(DOCKER_IMAGE_TAG) -e TARGET=$(target) $(DOCKER_IMAGE_TAG)
.PHONY: test
TEST: ## Run tests
@poetry run pytest . -v
.PHONY: TEST
shell: ## Enter Docker container's shell
@$(DOCKER) run -it --rm -v "`pwd`":/src/$(DOCKER_IMAGE_TAG) $(DOCKER_IMAGE_TAG) bash || true
.PHONY: shell