FitMop/Makefile

67 lines
2.0 KiB
Makefile
Raw Blame History

# FitMop Development Automation
# Ensure we use the modern Node.js version
export PATH := /usr/local/opt/node@24/bin:$(PATH)
.PHONY: all setup lint test coverage build check run force-stop
# Root directory
ROOT_DIR := $(shell pwd)
BACKEND_DIR := $(ROOT_DIR)/backend
FRONTEND_DIR := $(ROOT_DIR)/frontend
all: check run
setup:
@echo "Installing dependencies..."
cd $(BACKEND_DIR) && uv sync
cd $(FRONTEND_DIR) && npm install
lint:
@echo "Running linters..."
cd $(BACKEND_DIR) && uv run ruff check . --fix
cd $(FRONTEND_DIR) && npm run lint
cd $(FRONTEND_DIR) && npm run format
test:
@echo "Running unit tests..."
cd $(BACKEND_DIR) && uv run pytest
cd $(FRONTEND_DIR) && npm run test
coverage:
@echo "Generating coverage reports..."
cd $(BACKEND_DIR) && uv run pytest --cov=src --cov-report=term-missing --cov-fail-under=100
cd $(FRONTEND_DIR) && npm run test -- --coverage --coverage.threshold.lines=100
build:
@echo "Building frontend..."
cd $(FRONTEND_DIR) && npm run build
test-e2e:
@echo "Running E2E Smoke Tests..."
cd $(FRONTEND_DIR) && npm run test:e2e
check: lint coverage build test-e2e
@echo "Pipeline check passed!"
run:
@echo "🚀 Starting FitMop Environment..."
@bash -c 'trap "trap - SIGINT SIGTERM; kill 0; echo -e \"\n<> FitMop stopped.\"" SIGINT SIGTERM; \
echo "<22>📦 Starting Backend API (Port 8000)..."; \
cd $(BACKEND_DIR) && export PYTHONPATH=$(BACKEND_DIR)/src && uv run uvicorn main:app --port 8000 > ../backend.log 2>&1 & \
echo "⏳ Waiting for Backend..."; \
sleep 2; \
until curl -s http://localhost:8000/health > /dev/null; do sleep 1; done; \
echo "✅ Backend is Ready!"; \
echo "🌐 Starting Frontend (Port 5173)..."; \
cd $(FRONTEND_DIR) && npm run dev -- --port 5173 > ../frontend.log 2>&1 & \
echo "🎉 FitMop is running!"; \
echo "🔗 Dashboard: http://localhost:5173"; \
echo "Press Ctrl+C to stop both services."; \
wait'
force-stop:
@echo "🛑 Stopping FitMop services..."
@lsof -ti:8000 | xargs kill -9 2>/dev/null || true
@lsof -ti:5173 | xargs kill -9 2>/dev/null || true
@echo "👋 FitMop stopped."