From 1a917e7a5d709b137bc7aa34f9cbd4b450373f52 Mon Sep 17 00:00:00 2001 From: Emil Simeonov Date: Fri, 19 Jun 2026 13:18:17 +0200 Subject: [PATCH] GRM-23: fix: improve make setup with version guard, pre-push hooks and commit-msg validator --- .pre-commit-config.yaml | 7 +++++++ Makefile | 12 +++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e97e077..4c54c95 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,13 @@ repos: - repo: local hooks: + - id: validate-commit-msg + name: validate commit message + entry: python3 scripts/validate_commit_msg.py + language: system + stages: [commit-msg] + pass_filenames: true + - id: ruff-lint name: ruff lint entry: .venv/bin/ruff check src/ tests/ diff --git a/Makefile b/Makefile index 9f0954d..79c1754 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,16 @@ setup: $(VENV)/bin/activate .env activate-scripts checkmake $(BIN)/ansible-galaxy collection install -r ansible/requirements.yml $(BIN)/pre-commit install $(BIN)/pre-commit install --hook-type commit-msg - @echo "Setup complete. Activate the virtual environment with: source .venv/bin/activate" + $(BIN)/pre-commit install --hook-type pre-push + @echo "" + @echo "Setup complete." + @echo "Activate the virtual environment with one of:" + @echo " source .venv/bin/activate (generic)" + @echo " source activate.sh (bash)" + @echo " source activate.fish (fish)" + @echo " source activate.zsh (zsh)" + @-$(BIN)/grm --version + @-$(BIN)/pre-commit --version .env: @if [ ! -f .env ]; then \ @@ -21,6 +30,7 @@ setup: $(VENV)/bin/activate .env activate-scripts checkmake fi $(VENV)/bin/activate: + @python3 -c "import sys; v=sys.version_info; assert v >= (3, 11), f'Python 3.11+ required, found {v.major}.{v.minor}'; print(f'Python {v.major}.{v.minor}.{v.micro} OK')" $(PYTHON) -m venv $(VENV) $(BIN)/pip install --upgrade pip setuptools wheel