GRM-64: refactor: migrate from scripts/ to devx package

This commit is contained in:
emil
2026-06-22 19:45:24 +00:00
parent a0f997cb3e
commit 041e5ac4aa
73 changed files with 294 additions and 12114 deletions
+29 -21
View File
@@ -1,4 +1,4 @@
.PHONY: all setup setup-ci setup-quality setup-molecule setup-release install update lint ansible-lint makefile-lint lint-all test test-unit pytest-cov molecule molecule-all test-all clean workflow-lint workflow-dryrun workflow-check install-tools
.PHONY: all setup setup-ci setup-quality setup-molecule setup-release install-devx install update lint ansible-lint makefile-lint lint-all test test-unit pytest-cov molecule molecule-all test-all clean workflow-lint workflow-dryrun workflow-check install-tools
PYTHON := python3
VENV := .venv
@@ -7,32 +7,40 @@ CHECKMAKE := $(shell command -v checkmake 2>/dev/null || echo $(HOME)/go/bin/che
all: setup
install-devx: $(VENV)/bin/activate
@# REPO_TOKEN may come from .env (local) or environment (CI secrets)
@if [ -z "$$REPO_TOKEN" ]; then . .env 2>/dev/null; fi; \
if [ -z "$$REPO_TOKEN" ]; then echo "REPO_TOKEN not set (check .env or environment)"; exit 1; fi; \
$(BIN)/pip install "git+https://emil:$$REPO_TOKEN@git.oblachno.oblachno.fyi/oblachno-oss/devx.git@master"
# Full setup for local development (all deps, tools, collections, hooks)
setup: $(VENV)/bin/activate .env activate-scripts checkmake install-tools
# install-devx must run before install-tools (which uses devx modules)
setup: $(VENV)/bin/activate .env activate-scripts install-devx checkmake install-tools
@export PATH="$(HOME)/.local/bin:$$PATH"; \
$(PYTHON) scripts/setup.py --bin "$(BIN)"
$(BIN)/python -m devx.tools.setup --bin "$(BIN)"
# Lean setup for CI jobs that need pytest + lint tools + runtime deps
# (detect-changes, discover-runners, pr-review, sync-wiki, badges)
# badges job runs generate_badges.py which needs ruff, pyright, bandit
setup-ci: $(VENV)/bin/activate .env
@$(PYTHON) scripts/setup.py --bin "$(BIN)" --extras "ci,lint" --no-ansible-collections --no-pre-commit --no-tea-login
setup-ci: $(VENV)/bin/activate .env install-devx
@$(BIN)/python -m devx.tools.setup --bin "$(BIN)" --extras "ci,lint" --no-ansible-collections --no-pre-commit --no-tea-login
# Setup for the quality job (lint + test deps, actionlint tool)
setup-quality: $(VENV)/bin/activate .env install-tools
# install-devx must run before install-tools (which uses devx modules)
setup-quality: $(VENV)/bin/activate .env install-devx install-tools
@export PATH="$(HOME)/.local/bin:$$PATH"; \
$(PYTHON) scripts/setup.py --bin "$(BIN)" --extras "ci,lint" --no-ansible-collections --no-pre-commit --no-tea-login
$(BIN)/python -m devx.tools.setup --bin "$(BIN)" --extras "ci,lint" --no-ansible-collections --no-pre-commit --no-tea-login
# Full setup for molecule testing (needs ansible, molecule, collections)
setup-molecule: $(VENV)/bin/activate .env install-tools
setup-molecule: $(VENV)/bin/activate .env install-devx install-tools
@export PATH="$(HOME)/.local/bin:$$PATH"; \
$(PYTHON) scripts/setup.py --bin "$(BIN)" --extras "ci,molecule" --no-pre-commit --no-tea-login
$(BIN)/python -m devx.tools.setup --bin "$(BIN)" --extras "ci,molecule" --no-pre-commit --no-tea-login
# Setup for release jobs (needs git-cliff, tea, and lint tools for release.py)
setup-release: $(VENV)/bin/activate .env
@$(PYTHON) scripts/install_tools.py --tool git-cliff --tool tea
setup-release: $(VENV)/bin/activate .env install-devx
@$(BIN)/python -m devx.tools.install_tools --tool git-cliff --tool tea
@export PATH="$(HOME)/.local/bin:$$PATH"; \
$(PYTHON) scripts/setup.py --bin "$(BIN)" --extras "ci,lint" --no-ansible-collections --no-pre-commit
$(BIN)/python -m devx.tools.setup --bin "$(BIN)" --extras "ci,lint" --no-ansible-collections --no-pre-commit
.env:
@if [ ! -f .env ]; then \
@@ -55,11 +63,11 @@ install-hooks:
@cp hooks/pre-push .git/hooks/pre-push && chmod +x .git/hooks/pre-push
@echo "Git hooks installed."
checkmake:
@python3 scripts/install_checkmake.py
checkmake: install-devx
@$(BIN)/python -m devx.tools.install_checkmake
install-tools:
@$(PYTHON) scripts/install_tools.py
install-tools: install-devx
@$(BIN)/python -m devx.tools.install_tools
install:
@if [ -z "$(HOST)" ]; then echo "HOST is required. Example: make install HOST=192.168.1.10"; exit 1; fi
@@ -94,10 +102,10 @@ remove:
$(BIN)/grm remove $(NAME) $(if $(HOST),--host $(HOST),) $(if $(USER),--user $(USER),) $(if $(TOKEN),--token $(TOKEN),) $(if $(ASK_BECOME_PASS),--ask-become-pass,)
lint-ruff:
$(BIN)/ruff check src/ tests/ scripts/
$(BIN)/ruff check src/ tests/
lint-format:
$(BIN)/ruff format --check src/ tests/ scripts/
$(BIN)/ruff format --check src/ tests/
typecheck:
$(BIN)/pyright
@@ -105,7 +113,7 @@ typecheck:
lint: lint-ruff lint-format typecheck lint-bandit
lint-bandit:
$(BIN)/bandit -r src/ scripts/
$(BIN)/bandit -r src/
lint-deps:
@echo "Checking dependencies for known vulnerabilities..."
@@ -143,7 +151,7 @@ test-integration:
$(BIN)/pytest tests/integration/ -v --no-cov
pytest-cov:
$(BIN)/pytest tests/ -v --cov=src/gitea_runner_manager --cov=scripts --cov-report=term-missing --cov-fail-under=100
$(BIN)/pytest tests/ -v --cov=src/gitea_runner_manager --cov-report=term-missing --cov-fail-under=100
MOLECULE := $(realpath $(BIN))/molecule
MOLECULE_BASE := cd $(CURDIR)/ansible/roles/gitea-runner && ANSIBLE_ALLOW_BROKEN_CONDITIONALS=true ANSIBLE_INJECT_INVOCATION=1 $(MOLECULE)
@@ -154,7 +162,7 @@ molecule:
# All scenarios on all supported platforms (sequential; use CI matrix for parallel execution)
molecule-all:
@$(PYTHON) scripts/molecule_all.py --bin "$(BIN)"
@$(BIN)/python -m devx.molecule.molecule_all --bin "$(BIN)"
test: test-all