forked from cheshire-cat-ai/core
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
61 lines (46 loc) · 2.53 KB
/
Makefile
File metadata and controls
61 lines (46 loc) · 2.53 KB
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
UID := $(shell id -u)
GID := $(shell id -g)
PWD = $(shell pwd)
args=
# if dockerfile is not defined
ifndef dockerfile
dockerfile=compose.yml
endif
docker-compose-files=-f ${dockerfile}
help: ## Show help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
build: ## Build docker image(s) [args="<name_of_image>"].
@docker compose $(docker-compose-files) build ${args}
build-no-cache: ## Build docker image(s) without cache [args="<name_of_image>"].
@docker compose $(docker-compose-files) --compatibility build ${args} --no-cache
up: ## Start docker container(s) [args="<name_of_service>"].
@docker compose ${docker-compose-files} up ${args} -d
down: ## Stop docker container(s) [args="<name_of_service>"].
@docker compose ${docker-compose-files} down ${args}
stop: ## Stop docker containers [args="<name_of_service>"].
@docker compose ${docker-compose-files} stop ${args}
restart: ## Restart service(s) [args="<name_of_service>"].
@docker compose ${docker-compose-files} restart ${args}
test: ## Run tests.
@docker exec grinning_cat_core uv run python -m pytest --color=yes -vvv -W ignore --disable-warnings ${args}
install: ## Update the local virtual environment with the latest requirements.
@uv sync --link-mode=copy --frozen --no-install-project --no-upgrade --no-cache
@find $(PWD)/cat/core_plugins -name requirements.txt -exec uv pip install --link-mode=copy --no-cache --no-upgrade -r {} \;
@uv cache clean
@pip cache purge
update: ## Update and compile requirements for the local virtual environment.
@uv sync --upgrade --link-mode=copy --no-install-project --no-cache
@find $(PWD)/cat/core_plugins -name requirements.txt -exec uv pip install --link-mode=copy --no-cache --no-upgrade -r {} \;
@uv cache clean
@pip cache purge
@rm -rf *.egg-info
check: ## Check requirements for the local virtual environment.
@uv sync --check
migrate: ## Apply database migrations
@docker exec -it grinning_cat_core uv run python migrations/manage_migrations.py upgrade head
make-migration: ## Create the migration file after changing the models. Argument `args` is mandatory as the comment of the migration.
@if [ -z "${args}" ]; then \
echo "Error: 'args' is required for 'run'. Example: make make-migration args=\"The comment to the migration\"" >&2; \
exit 1; \
fi
@docker exec -it grinning_cat_core uv run python migrations/manage_migrations.py revision -m "${args}"