CI / ruff · mypy · pytest (pull_request) Successful in 26m33s
- README: цели и задачи, что реализовано, развёртывание (локально за 5 минут и полный стек), переменные, команды и данные, используемые API, ограничения и лимиты, что не сделано, структура репозитория - examples/: hello (healthy + материал для grep/агента), crash (💥 и 🔁), cpu_hog (🔥), unhealthy (🩺), syntax_error/lint_fail для коммита, вопросы агенту и атаки; make demo-up / demo-down в том же Compose-проекте - make local-proxy: read-only Docker API для `make run` - ARCHITECTURE: краш при restart-политике и гистерезис алертов Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
2.0 KiB
Makefile
62 lines
2.0 KiB
Makefile
.PHONY: install lint fmt typecheck test cov up down logs ps run demo-repo demo-up demo-down local-proxy
|
|
|
|
install:
|
|
uv sync
|
|
|
|
lint:
|
|
uv run ruff check .
|
|
uv run ruff format --check .
|
|
uv run mypy
|
|
|
|
fmt:
|
|
uv run ruff check --fix .
|
|
uv run ruff format .
|
|
|
|
test:
|
|
uv run pytest -q
|
|
|
|
cov:
|
|
uv run pytest -q --cov --cov-report=term
|
|
|
|
up:
|
|
@test -f .env || { cp .env.example .env; echo "created .env from .env.example — fill in the secrets"; }
|
|
docker compose up -d --build
|
|
|
|
down:
|
|
docker compose down
|
|
|
|
logs:
|
|
docker compose logs -f --tail=100 bot
|
|
|
|
ps:
|
|
docker compose ps
|
|
|
|
# Run the bot on this machine without Docker: SQLite (./tgit.db) and the settings from .env
|
|
run:
|
|
uv run python -m app
|
|
|
|
# A local uploads repo seeded from the template — try the bot without SourceCraft:
|
|
# make demo-repo → put the printed GIT_UPLOADS_URL into .env → make run
|
|
DEMO_REPO := $(CURDIR)/data/demo-uploads.git
|
|
demo-repo:
|
|
@test ! -e $(DEMO_REPO) || { echo "$(DEMO_REPO) already exists"; exit 1; }
|
|
@rm -rf data/demo-seed && mkdir -p data && cp -r infra/uploads-template data/demo-seed
|
|
@cd data/demo-seed && git init -q -b main && git add -A \
|
|
&& git -c user.name=tgit-bot -c user.email=tgit-bot@users.noreply.tgit commit -qm "init: uploads template"
|
|
@git clone -q --bare data/demo-seed $(DEMO_REPO) && rm -rf data/demo-seed
|
|
@echo "GIT_UPLOADS_URL=$(DEMO_REPO)"
|
|
|
|
# Demo services (examples/) next to the bot: they show up in «Статус», «Логи» and raise alerts
|
|
DEMO := docker compose -f docker-compose.yml -f examples/docker-compose.yml
|
|
demo-up:
|
|
$(DEMO) up -d demo-hello demo-crash demo-cpu-hog demo-unhealthy
|
|
|
|
demo-down:
|
|
$(DEMO) rm -sf demo-hello demo-crash demo-cpu-hog demo-unhealthy
|
|
|
|
# Docker API for `make run` (bot outside Docker): the same read-only proxy, on localhost only.
|
|
# Then DOCKER_URL=http://127.0.0.1:23750 in .env — «Статус», «Логи» and alerts see this machine's containers.
|
|
local-proxy:
|
|
docker run -d --rm --name tgit-local-proxy -e CONTAINERS=1 \
|
|
-v /var/run/docker.sock:/var/run/docker.sock:ro -p 127.0.0.1:23750:2375 tecnativa/docker-socket-proxy:0.3.0
|