-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
128 lines (98 loc) · 4.07 KB
/
Makefile
File metadata and controls
128 lines (98 loc) · 4.07 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
# Package paths
NODE_PKG := packages/node-commitlint
PYTHON_PKG := packages/python-gitlint
PYTHON_SOURCES := gitlint_rai/ tests/
.PHONY: help install install-locked update-locks clean ai-checks
.PHONY: test test-node test-python
.PHONY: benchmark benchmark-node benchmark-python
.PHONY: lint lint-node lint-python lint-format
.PHONY: format format-node format-python
.PHONY: build build-node build-python
help:
@echo "Main targets:"
@echo " ai-checks - Full env refresh + all checks (clean, install, lint, test, benchmark, build)"
@echo " test - Run all tests (Node + Python)"
@echo " benchmark - Run all benchmarks (Node + Python)"
@echo " lint - Run all linters (Node + Python)"
@echo " format - Format all code (Node + Python)"
@echo " build - Build all packages"
@echo " install - Install dependencies (updates locks if needed)"
@echo " install-locked - Install from existing lock files (CI mode)"
@echo " update-locks - Explicitly update all lock files"
@echo " clean - Clean build artifacts"
# ============================================================================
# Install & Clean
# ============================================================================
# Default install: updates lock files if they need resolution (e.g., missing or invalid)
# This is the recommended mode for local development.
# For reproducible builds in CI, use 'install-locked' instead.
install:
npm install
cd $(PYTHON_PKG) && uv sync --group dev
# CI install: uses existing lock files (fails if out of sync)
install-locked:
npm ci
cd $(PYTHON_PKG) && uv sync --locked --group dev
# Explicitly update lock files
update-locks:
npm install
cd $(PYTHON_PKG) && uv lock
clean:
rm -rf .venv node_modules
rm -rf $(NODE_PKG)/dist $(NODE_PKG)/node_modules
rm -rf $(PYTHON_PKG)/build $(PYTHON_PKG)/dist $(PYTHON_PKG)/*.egg-info
rm -rf $(PYTHON_PKG)/htmlcov $(PYTHON_PKG)/.venv
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
# ============================================================================
# Test
# ============================================================================
test: test-node test-python
test-node:
cd $(NODE_PKG) && mkdir -p reports && npm test
test-python:
cd $(PYTHON_PKG) && mkdir -p reports && \
uv run pytest \
--cov \
--cov-report=xml \
--cov-report=term-missing
# ============================================================================
# Benchmark
# ============================================================================
benchmark: benchmark-node benchmark-python
benchmark-node:
cd $(NODE_PKG) && npx vitest run tests/node-benchmark.test.ts
benchmark-python:
cd $(PYTHON_PKG) && uv run python tests/python_benchmark.py
# ============================================================================
# Lint
# ============================================================================
lint: lint-format lint-node lint-python
lint-format:
npm run format
lint-node:
cd $(NODE_PKG) && npm run lint
lint-python:
cd $(PYTHON_PKG) && uv run black --check $(PYTHON_SOURCES)
cd $(PYTHON_PKG) && uv run isort --check-only $(PYTHON_SOURCES)
# ============================================================================
# Format
# ============================================================================
format: format-node format-python
format-node:
npm run format
format-python:
cd $(PYTHON_PKG) && uv run black $(PYTHON_SOURCES)
cd $(PYTHON_PKG) && uv run isort $(PYTHON_SOURCES)
# ============================================================================
# Build
# ============================================================================
build: build-node build-python
build-node:
cd $(NODE_PKG) && npm run build
build-python:
cd $(PYTHON_PKG) && uv build
# ============================================================================
# AI Checks
# ============================================================================
ai-checks: clean install format lint test benchmark build