# Deep Dive Makefile - Build Automation # Usage: make install-deps, make test, make run-dry .PHONY: help install install-systemd test test-e2e run-dry clean VENV_PATH ?= $(HOME)/.venvs/deepdive CONFIG ?= config.yaml PYTHON := $(VENV_PATH)/bin/python PIP := $(VENV_PATH)/bin/pip help: @echo "Deep Dive Build Commands:" @echo " make install - Create venv + install dependencies" @echo " make install-systemd - Install systemd timer for daily runs" @echo " make test - Run unit tests" @echo " make test-e2e - Run full pipeline (dry-run)" @echo " make run-dry - Execute pipeline --dry-run" @echo " make run-live - Execute pipeline with live delivery" @echo " make clean - Remove cache and build artifacts" install: @echo "Creating virtual environment at $(VENV_PATH)..." python3 -m venv $(VENV_PATH) $(PIP) install --upgrade pip $(PIP) install -r requirements.txt @echo "Installing embedding model (80MB)..." $(PYTHON) -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')" @echo "Installation complete. Run: make test-e2e" install-systemd: @echo "Installing systemd timer for 06:00 daily execution..." mkdir -p $(HOME)/.config/systemd/user cp systemd/deepdive.service $(HOME)/.config/systemd/user/ cp systemd/deepdive.timer $(HOME)/.config/systemd/user/ systemctl --user daemon-reload systemctl --user enable deepdive.timer systemctl --user start deepdive.timer @echo "Timer installed. Check status: systemctl --user status deepdive.timer" test: @echo "Running unit tests..." cd tests && $(PYTHON) -m pytest -v test-e2e: @echo "Running end-to-end test (dry-run, last 24h)..." $(PYTHON) pipeline.py --config $(CONFIG) --dry-run --since 24 run-dry: @echo "Executing pipeline (dry-run)..." $(PYTHON) pipeline.py --config $(CONFIG) --dry-run run-live: @echo "Executing pipeline with LIVE DELIVERY..." @read -p "Confirm live delivery to Telegram? [y/N] " confirm; \ if [ "$$confirm" = "y" ]; then \ $(PYTHON) pipeline.py --config $(CONFIG); \ else \ echo "Aborted."; \ fi clean: @echo "Cleaning cache..." rm -rf $(HOME)/.cache/deepdive rm -rf tests/__pycache__ find . -type f -name "*.pyc" -delete find . -type d -name "__pycache__" -delete @echo "Clean complete."