Files
Kevin Veen-Birkenbach ccac936015 feat: port to Python and package as pip-installable distribution
Replaces main.sh with the 'cli-gnome-extension-manager' distribution in a src layout, shipping both the cli-gnome-extension-manager and the older goexma command.

sync_repository keeps the three states of the shell original apart: clone when the folder is missing, pull when it is a checkout, leave it alone otherwise, so a manually installed extension is never overwritten. build_extension still moves the checkout away before make install, but into a TemporaryDirectory instead of a fixed /tmp/<name>, which removes the collision between parallel runs and cleans up on abort.

Every step passes through the exit code of the failing tool, replacing the shell chain of || exit 1; a missing gnome-extensions aborts with exit 127. The e2e suite builds a real git repository, clones it with real git and runs real make install.

Adds --extensions-dir, unit, integration and container-based e2e tests, ruff and markdown/mermaid linting, CodeQL and Dependabot, and pins the core metadata to 2.4 so twine accepts the artifacts.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 14:41:17 +02:00

51 lines
1.6 KiB
Makefile

SHELL := /usr/bin/env bash
.PHONY: help lint lint-docs format test test-unit test-integration test-e2e clean
PY ?= python3
E2E_IMAGE ?= cli-gnome-extension-manager-e2e
MD_LINT_IMAGE ?= davidanson/markdownlint-cli2:latest
MERMAID_IMAGE ?= minlag/mermaid-cli:latest
export PYTHONPATH := $(CURDIR)/src
help:
@echo "Targets:"
@echo " make lint - ruff check + ruff format --check"
@echo " make lint-docs - markdownlint + mermaid diagram validation"
@echo " make format - apply ruff format"
@echo " make test - unit + integration tests"
@echo " make test-unit - unit tests only"
@echo " make test-integration - integration tests only"
@echo " make test-e2e - install and exercise the CLI in a container"
@echo " make clean - remove caches"
lint:
ruff check .
ruff format --check .
# The repository is mounted read-only: mermaid-cli writes its SVGs next to the
# output file, which must never land in the working tree.
lint-docs:
docker run --rm -v "$(CURDIR)":/workdir $(MD_LINT_IMAGE) "**/*.md"
docker run --rm -v "$(CURDIR)":/data:ro -w /tmp $(MERMAID_IMAGE) -i /data/README.md -o /tmp/out.md
format:
ruff format .
test: test-unit test-integration
test-unit:
$(PY) -m unittest discover -s tests/unit -t . -p "test_*.py"
test-integration:
$(PY) -m unittest discover -s tests/integration -t . -p "test_*.py"
test-e2e:
docker build -f tests/e2e/Dockerfile -t $(E2E_IMAGE) .
docker run --rm $(E2E_IMAGE)
clean:
rm -rf .pytest_cache .ruff_cache .mypy_cache
find . -type d -name "__pycache__" -print0 | xargs -0 -r rm -rf