-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (118 loc) · 3.58 KB
/
Makefile
File metadata and controls
142 lines (118 loc) · 3.58 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
.PHONY: help
help:
@echo "PrivaseeAI Security - Available Make Targets"
@echo "=============================================="
@echo ""
@echo "Testing:"
@echo " make test - Run all tests"
@echo " make test-unit - Run unit tests only"
@echo " make test-integration - Run integration tests only"
@echo " make test-coverage - Run tests with coverage report"
@echo " make test-watch - Run tests in watch mode"
@echo ""
@echo "Code Quality:"
@echo " make lint - Run code linters"
@echo " make format - Format code with black and isort"
@echo " make type-check - Run mypy type checking"
@echo " make pre-commit - Run pre-commit hooks on all files"
@echo " make security-check - Run security vulnerability checks"
@echo ""
@echo "Setup:"
@echo " make install - Install dependencies"
@echo " make install-dev - Install development dependencies"
@echo " make setup-hooks - Install pre-commit hooks"
@echo " make clean - Clean build artifacts"
@echo ""
@echo "Docker:"
@echo " make docker-build - Build Docker images"
@echo " make docker-up - Start Docker services"
@echo " make docker-down - Stop Docker services"
@echo " make docker-logs - View Docker logs"
@echo " make docker-shell - Open shell in app container"
@echo " make docker-test - Run tests in Docker"
@echo " make docker-clean - Clean Docker resources"
.PHONY: install
install:
pip install -r requirements.txt
.PHONY: install-dev
install-dev:
pip install -r requirements-dev.txt
pip install pre-commit
.PHONY: setup-venv
setup-venv:
@echo "Creating virtualenv in .venv and installing dev dependencies"
python3 -m venv .venv
. .venv/bin/activate && python -m pip install --upgrade pip
. .venv/bin/activate && python -m pip install -r requirements-dev.txt
.PHONY: test
test:
pytest
.PHONY: test-unit
test-unit:
pytest tests/unit -v
.PHONY: test-integration
test-integration:
pytest tests/integration -v
.PHONY: test-coverage
test-coverage:
pytest --cov --cov-report=html --cov-report=term
.PHONY: test-watch
test-watch:
pytest-watch
.PHONY: lint
lint:
flake8 src tests
black --check src tests
isort --check-only src tests
.PHONY: format
format:
black src tests
isort src tests
.PHONY: type-check
type-check:
mypy src
.PHONY: setup-hooks
setup-hooks:
pre-commit install
pre-commit install --hook-type commit-msg
@echo "✅ Pre-commit hooks installed successfully"
.PHONY: pre-commit
pre-commit:
pre-commit run --all-files
.PHONY: security-check
security-check:
bandit -r src/ -ll
pip-audit
.PHONY: clean
clean:
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name '*.pyc' -delete
find . -type d -name '*.egg-info' -exec rm -rf {} + 2>/dev/null || true
rm -rf build dist .coverage htmlcov .pytest_cache .mypy_cache
# =====================================
# Docker Targets
# =====================================
.PHONY: docker-build
docker-build:
docker compose build
.PHONY: docker-up
docker-up:
docker compose up -d
.PHONY: docker-down
docker-down:
docker compose down
.PHONY: docker-logs
docker-logs:
docker compose logs -f
.PHONY: docker-shell
docker-shell:
docker compose exec app /bin/bash
.PHONY: docker-test
docker-test:
@echo "Tests should be run on the host machine (production image excludes tests):"
@echo " make test - Run all tests"
@echo " make test-coverage - Run tests with coverage"
.PHONY: docker-clean
docker-clean:
docker compose down -v --remove-orphans
docker system prune -f