Some checks failed
CI/CD Pipeline / Run Tests (push) Failing after 45s
CI/CD Pipeline / Code Quality Checks (push) Failing after 48s
CI/CD Pipeline / Build Docker Images (push) Has been skipped
CI/CD Pipeline / Push to Gitea Registry (push) Has been skipped
CI/CD Pipeline / Deploy to Server (push) Has been skipped
123 lines
3.6 KiB
Makefile
123 lines
3.6 KiB
Makefile
.PHONY: help install setup-dev dev-up dev-down services-up services-down prod-up prod-down logs test test-prod test-cov test-fast test-parallel test-failfast lint format type-check security-check pre-commit pre-push migrate createsuperuser shell clean
|
|
|
|
COMPOSE_DEV = docker compose -f docker-compose.dev.yml
|
|
COMPOSE_SERVICES = docker compose -f docker-compose.service.yml
|
|
COMPOSE_PROD = docker compose -f docker-compose.prod.yml --env-file .env.prod
|
|
|
|
help:
|
|
@echo "Available commands:"
|
|
@echo " make install - Install dependencies (uv sync --dev)"
|
|
@echo " make setup-dev - Install git hooks (pre-commit + pre-push)"
|
|
@echo " make dev-up - Start full local stack"
|
|
@echo " make dev-down - Stop local stack"
|
|
@echo " make services-up - Start only PostgreSQL and Redis"
|
|
@echo " make services-down - Stop PostgreSQL and Redis"
|
|
@echo " make prod-up - Start production compose"
|
|
@echo " make prod-down - Stop production compose"
|
|
@echo " make logs - Follow logs from dev compose"
|
|
@echo " make test - Run tests (use TARGET=... to filter)"
|
|
@echo " make test-prod - Run production-like tests"
|
|
@echo " make pre-commit - Run all pre-commit checks"
|
|
@echo " make pre-push - Run pre-push checks"
|
|
@echo " make migrate - Run Django migrations"
|
|
@echo " make createsuperuser - Create Django superuser"
|
|
@echo " make shell - Open Django shell"
|
|
@echo " make clean - Cleanup caches and artifacts"
|
|
|
|
install:
|
|
uv sync --dev
|
|
|
|
setup-dev: install
|
|
./scripts/setup-precommit.sh
|
|
|
|
dev-up:
|
|
$(COMPOSE_DEV) up -d
|
|
|
|
dev-down:
|
|
$(COMPOSE_DEV) down
|
|
|
|
services-up:
|
|
$(COMPOSE_SERVICES) up -d
|
|
|
|
services-down:
|
|
$(COMPOSE_SERVICES) down
|
|
|
|
prod-up:
|
|
$(COMPOSE_PROD) up -d
|
|
|
|
prod-down:
|
|
$(COMPOSE_PROD) down
|
|
|
|
logs:
|
|
$(COMPOSE_DEV) logs -f
|
|
|
|
test:
|
|
@if [ "$(TARGET)" ]; then \
|
|
echo "Running tests: $(TARGET)"; \
|
|
if [ -d "./tests/apps/$(TARGET)" ]; then \
|
|
./scripts/run-tests.sh "../tests/apps/$(TARGET)"; \
|
|
elif [ "$(TARGET)" = "models" ] || [ "$(TARGET)" = "views" ] || [ "$(TARGET)" = "serializers" ] || [ "$(TARGET)" = "services" ]; then \
|
|
./scripts/run-tests.sh ../tests -k "test_$(TARGET)"; \
|
|
elif echo "$(TARGET)" | grep -q '^test_'; then \
|
|
./scripts/run-tests.sh ../tests -k "$(TARGET)"; \
|
|
else \
|
|
./scripts/run-tests.sh "$(TARGET)"; \
|
|
fi; \
|
|
else \
|
|
echo "Running full test suite"; \
|
|
./scripts/run-tests.sh; \
|
|
fi
|
|
|
|
test-prod:
|
|
@if [ "$(TARGET)" ]; then \
|
|
echo "Running production-like tests: $(TARGET)"; \
|
|
./scripts/run-tests-prod.sh "$(TARGET)"; \
|
|
else \
|
|
echo "Running full production-like test suite"; \
|
|
./scripts/run-tests-prod.sh; \
|
|
fi
|
|
|
|
test-cov:
|
|
./scripts/run-tests.sh ../tests --cov=src --cov-report=term-missing --cov-report=xml --cov-report=html
|
|
|
|
test-fast:
|
|
./scripts/run-tests.sh ../tests -m "not slow"
|
|
|
|
test-parallel:
|
|
./scripts/run-tests.sh ../tests -n auto || ./scripts/run-tests.sh ../tests
|
|
|
|
test-failfast:
|
|
./scripts/run-tests.sh ../tests -x
|
|
|
|
pre-commit:
|
|
uv run pre-commit run --all-files
|
|
|
|
pre-push:
|
|
uv run pre-commit run --hook-stage pre-push --all-files
|
|
|
|
lint: pre-commit
|
|
|
|
format:
|
|
uv run pre-commit run --all-files ruff-format
|
|
uv run pre-commit run --all-files ruff
|
|
|
|
type-check: pre-commit
|
|
|
|
security-check: pre-commit
|
|
|
|
migrate:
|
|
cd src && uv run python manage.py makemigrations
|
|
cd src && uv run python manage.py migrate
|
|
|
|
createsuperuser:
|
|
cd src && uv run python manage.py createsuperuser
|
|
|
|
shell:
|
|
cd src && uv run python manage.py shell
|
|
|
|
clean:
|
|
find . -type f -name "*.pyc" -delete
|
|
find . -type d -name "__pycache__" -delete
|
|
rm -rf *.log htmlcov .coverage coverage.xml bandit-report.json
|
|
rm -rf .pytest_cache .mypy_cache .ruff_cache
|