-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (66 loc) · 3.18 KB
/
Copy pathMakefile
File metadata and controls
79 lines (66 loc) · 3.18 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
.PHONY: help install test coverage lint format translate run dev clean publish
.DEFAULT_GOAL := help
help: ## Show this help message
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-15s %s\n", $$1, $$2}'
install: ## Install dependencies and pre-commit hooks
uv sync --all-extras
git config --local --unset-all core.hooksPath 2>/dev/null || true
git config --global --unset-all core.hooksPath 2>/dev/null || true
uv run pre-commit install
PYTHON_VERSIONS := 3.10 3.11 3.12 3.13 3.14
test: ## Run tests (PY=all for all versions, PY=3.x for specific version)
ifeq ($(PY),all)
@for ver in $(PYTHON_VERSIONS); do \
echo "=== Python $$ver ==="; \
uv run --python $$ver --all-extras pytest tests/ -v -n auto || exit 1; \
done
else ifdef PY
uv run --python $(PY) --all-extras pytest tests/ -v -n auto
else
uv run --all-extras pytest tests/ -v -n auto
endif
coverage: ## Run tests with coverage (PY=all for all versions, PY=3.x for specific version)
ifeq ($(PY),all)
@for ver in $(PYTHON_VERSIONS); do \
echo "=== Python $$ver ==="; \
uv run --python $$ver --all-extras pytest tests/ -n auto --cov --cov-report=term-missing --cov-report=html || exit 1; \
done
else ifdef PY
uv run --python $(PY) --all-extras pytest tests/ -n auto --cov --cov-report=term-missing --cov-report=html
else
uv run --all-extras pytest tests/ -n auto --cov --cov-report=term-missing --cov-report=html
endif
@echo "HTML report: htmlcov/index.html"
lint: ## Run linters
uv run ruff check src/ tests/
uv run ty check src/
format: ## Format code
uv run ruff format src/ tests/
LOCALES := zh es fr de ja pt
VERSION := $(shell sed -n 's/^__version__ = "\(.*\)"/\1/p' src/iac_code/__init__.py)
translate: ## Extract, update and compile translations
@uv run pybabel extract -F babel.cfg --add-location=file --project=iac-code --version=$(VERSION) -o src/iac_code/i18n/messages.pot . > /dev/null 2>&1 && echo "Extract: OK" || (echo "Extract: FAILED"; exit 1)
@for lang in $(LOCALES); do \
uv run pybabel update --ignore-pot-creation-date -i src/iac_code/i18n/messages.pot -d src/iac_code/i18n/locales -l $$lang > /dev/null 2>&1 && echo "Update $$lang: OK" || (echo "Update $$lang: FAILED"; exit 1); \
done
@for lang in $(LOCALES); do \
perl -i -pe 's/^"Project-Id-Version: .*/"Project-Id-Version: iac-code $(VERSION)\\n"/' src/iac_code/i18n/locales/$$lang/LC_MESSAGES/messages.po; \
done
@for lang in $(LOCALES); do \
uv run pybabel compile -d src/iac_code/i18n/locales -l $$lang > /dev/null 2>&1 && echo "Compile $$lang: OK" || (echo "Compile $$lang: FAILED"; exit 1); \
done
run: ## Run iac-code
IAC_CODE_INSTRUCTION_MEMORY_FILE=IAC-CODE.md uv run iac-code
dev: ## Run iac-code in debug mode
IAC_CODE_INSTRUCTION_MEMORY_FILE=IAC-CODE.md uv run iac-code --debug
clean: ## Clean build artifacts
rm -rf .ruff_cache .pytest_cache dist build htmlcov .coverage coverage.xml
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type d -name "*.egg-info" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pot" -delete
find . -type f -name "*.mo" -delete
find . -type f -name ".coverage.*" -delete