fix: forgot a file
This commit is contained in:
@@ -3,9 +3,15 @@
|
|||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
|
|
||||||
# --- SETTINGS ---
|
# --- SETTINGS ---
|
||||||
|
PYTHON_VERSION = 3.12.7
|
||||||
|
PYTHON_VERSION_SHORT = $(shell echo $(PYTHON_VERSION) | cut -d. -f1,2)
|
||||||
# Change to 'uv' when ready.
|
# Change to 'uv' when ready.
|
||||||
RUNNER ?= poetry
|
RUNNER ?= poetry
|
||||||
|
|
||||||
|
export PYTHON_VERSION
|
||||||
|
export PYTHON_VERSION_SHORT
|
||||||
export RUNNER
|
export RUNNER
|
||||||
|
export IMAGE_NAME
|
||||||
|
|
||||||
# --- VARIABLES ---
|
# --- VARIABLES ---
|
||||||
CORE_DIR = brain
|
CORE_DIR = brain
|
||||||
@@ -20,7 +26,11 @@ INSTALL_CMD = $(if $(filter uv,$(RUNNER)),sync,install)
|
|||||||
ARGS = $(filter-out $@,$(MAKECMDGOALS))
|
ARGS = $(filter-out $@,$(MAKECMDGOALS))
|
||||||
BUMP_CMD = cd $(CORE_DIR) && $(RUNNER) run bump-my-version bump
|
BUMP_CMD = cd $(CORE_DIR) && $(RUNNER) run bump-my-version bump
|
||||||
COMPOSE_CMD = docker-compose
|
COMPOSE_CMD = docker-compose
|
||||||
DOCKER_CMD = cd $(CORE_DIR) && docker build --build-arg RUNNER=$(RUNNER) -t $(IMAGE_NAME):latest .
|
DOCKER_CMD = cd $(CORE_DIR) && docker build \
|
||||||
|
--build-arg PYTHON_VERSION=$(PYTHON_VERSION) \
|
||||||
|
--build-arg PYTHON_VERSION_SHORT=$(PYTHON_VERSION_SHORT) \
|
||||||
|
--build-arg RUNNER=$(RUNNER) \
|
||||||
|
-t $(IMAGE_NAME):latest .
|
||||||
|
|
||||||
RUNNER_ADD = cd $(CORE_DIR) && $(RUNNER) add
|
RUNNER_ADD = cd $(CORE_DIR) && $(RUNNER) add
|
||||||
RUNNER_HOOKS = cd $(CORE_DIR) && $(RUNNER) run pre-commit install -c ../.pre-commit-config.yaml
|
RUNNER_HOOKS = cd $(CORE_DIR) && $(RUNNER) run pre-commit install -c ../.pre-commit-config.yaml
|
||||||
@@ -35,7 +45,7 @@ T = \033[36m
|
|||||||
R = \033[0m
|
R = \033[0m
|
||||||
|
|
||||||
# --- TARGETS ---
|
# --- TARGETS ---
|
||||||
.PHONY: add build check-docker check-runner clean coverage down format help init-env install install-hooks lint logs major minor patch prune ps restart run shell test up update _check_branch
|
.PHONY: add build build-test check-docker check-runner clean coverage down format help init-dotenv install install-hooks lint logs major minor patch prune ps restart run shell test up update _check_branch _ci-image-name _ci-run-tests
|
||||||
|
|
||||||
# Catch-all for args
|
# Catch-all for args
|
||||||
%:
|
%:
|
||||||
@@ -50,6 +60,16 @@ build: check-docker
|
|||||||
$(DOCKER_CMD)
|
$(DOCKER_CMD)
|
||||||
@echo "✅ Image $(IMAGE_NAME):latest ready."
|
@echo "✅ Image $(IMAGE_NAME):latest ready."
|
||||||
|
|
||||||
|
build-test: check-docker
|
||||||
|
@echo "$(T)🐳 Building test image (with dev deps)...$(R)"
|
||||||
|
cd $(CORE_DIR) && docker build \
|
||||||
|
--build-arg RUNNER=$(RUNNER) \
|
||||||
|
--build-arg PYTHON_VERSION=$(PYTHON_VERSION) \
|
||||||
|
--build-arg PYTHON_VERSION_SHORT=$(PYTHON_VERSION_SHORT) \
|
||||||
|
--target test \
|
||||||
|
-t $(IMAGE_NAME):test .
|
||||||
|
@echo "✅ Test image $(IMAGE_NAME):test ready."
|
||||||
|
|
||||||
check-docker:
|
check-docker:
|
||||||
@command -v docker >/dev/null 2>&1 || { echo "$(R)❌ Docker not installed$(R)"; exit 1; }
|
@command -v docker >/dev/null 2>&1 || { echo "$(R)❌ Docker not installed$(R)"; exit 1; }
|
||||||
@docker info >/dev/null 2>&1 || { echo "$(R)❌ Docker daemon not running$(R)"; exit 1; }
|
@docker info >/dev/null 2>&1 || { echo "$(R)❌ Docker daemon not running$(R)"; exit 1; }
|
||||||
@@ -87,12 +107,13 @@ help:
|
|||||||
@echo "$(G)Setup:$(R)"
|
@echo "$(G)Setup:$(R)"
|
||||||
@echo " $(T)check-docker $(R) Verify Docker is installed and running."
|
@echo " $(T)check-docker $(R) Verify Docker is installed and running."
|
||||||
@echo " $(T)check-runner $(R) Verify package manager ($(RUNNER))."
|
@echo " $(T)check-runner $(R) Verify package manager ($(RUNNER))."
|
||||||
@echo " $(T)init-env $(R) Create .env from .env.example with generated secrets."
|
@echo " $(T)init-dotenv $(R) Create .env from .env.example with generated secrets."
|
||||||
@echo " $(T)install $(R) Install ALL dependencies (Prod + Dev)."
|
@echo " $(T)install $(R) Install ALL dependencies (Prod + Dev)."
|
||||||
@echo " $(T)install-hooks $(R) Install git pre-commit hooks."
|
@echo " $(T)install-hooks $(R) Install git pre-commit hooks."
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "$(G)Docker:$(R)"
|
@echo "$(G)Docker:$(R)"
|
||||||
@echo " $(T)build $(R) Build the docker image."
|
@echo " $(T)build $(R) Build the docker image (production)."
|
||||||
|
@echo " $(T)build-test $(R) Build the docker image (with dev deps for testing)."
|
||||||
@echo " $(T)down $(R) Stop and remove containers."
|
@echo " $(T)down $(R) Stop and remove containers."
|
||||||
@echo " $(T)logs $(R) Follow logs."
|
@echo " $(T)logs $(R) Follow logs."
|
||||||
@echo " $(T)prune $(R) Clean Docker system."
|
@echo " $(T)prune $(R) Clean Docker system."
|
||||||
@@ -107,13 +128,13 @@ help:
|
|||||||
@echo " $(T)coverage $(R) Run tests with coverage."
|
@echo " $(T)coverage $(R) Run tests with coverage."
|
||||||
@echo " $(T)format $(R) Format code (Ruff)."
|
@echo " $(T)format $(R) Format code (Ruff)."
|
||||||
@echo " $(T)lint $(R) Lint code without fixing."
|
@echo " $(T)lint $(R) Lint code without fixing."
|
||||||
@echo " $(T)test ... $(R) Run tests."
|
@echo " $(T)test ... $(R) Run tests (local with $(RUNNER))."
|
||||||
@echo " $(T)update $(R) Update dependencies."
|
@echo " $(T)update $(R) Update dependencies."
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "$(G)Versioning:$(R)"
|
@echo "$(G)Versioning:$(R)"
|
||||||
@echo " $(T)major/minor/patch $(R) Bump version."
|
@echo " $(T)major/minor/patch $(R) Bump version."
|
||||||
|
|
||||||
init-env:
|
init-dotenv:
|
||||||
@echo "$(T)🔑 Initializing .env file...$(R)"
|
@echo "$(T)🔑 Initializing .env file...$(R)"
|
||||||
@if [ -f .env ]; then \
|
@if [ -f .env ]; then \
|
||||||
echo "$(R)⚠️ .env already exists. Skipping.$(R)"; \
|
echo "$(R)⚠️ .env already exists. Skipping.$(R)"; \
|
||||||
@@ -196,7 +217,7 @@ shell: check-docker
|
|||||||
|
|
||||||
test: check-runner
|
test: check-runner
|
||||||
@echo "$(T)🧪 Running tests...$(R)"
|
@echo "$(T)🧪 Running tests...$(R)"
|
||||||
$(RUNNER_RUN) pytest -n auto --dist=loadscope $(ARGS)
|
$(RUNNER_RUN) pytest $(ARGS)
|
||||||
|
|
||||||
up: check-docker
|
up: check-docker
|
||||||
@echo "$(T)🚀 Starting Agent Media...$(R)"
|
@echo "$(T)🚀 Starting Agent Media...$(R)"
|
||||||
@@ -213,3 +234,11 @@ _check_branch:
|
|||||||
if [ "$$curr" != "main" ]; then \
|
if [ "$$curr" != "main" ]; then \
|
||||||
echo "❌ Error: not on the main branch"; exit 1; \
|
echo "❌ Error: not on the main branch"; exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
_ci-image-name:
|
||||||
|
@echo "IMAGE_NAME=$(IMAGE_NAME)"
|
||||||
|
|
||||||
|
_ci-run-tests: build-test
|
||||||
|
@echo "$(T)🧪 Running tests in Docker...$(R)"
|
||||||
|
docker run --rm $(IMAGE_NAME):test pytest
|
||||||
|
@echo "✅ Tests passed."
|
||||||
|
|||||||
Reference in New Issue
Block a user