Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c58a848e7 |
+44
-30
@@ -6,44 +6,58 @@ on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
lint-test:
|
||||
lint-test-leaks:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16
|
||||
env:
|
||||
POSTGRES_USER: cayce
|
||||
POSTGRES_PASSWORD: ci-only-not-a-secret
|
||||
POSTGRES_DB: cayce_ops
|
||||
ports:
|
||||
- 5433:5432
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U cayce -d cayce_ops"
|
||||
--health-interval 5s --health-timeout 3s --health-retries 10
|
||||
env:
|
||||
CAYCE_OPS_DATABASE_URL: postgresql+psycopg://cayce:ci-only-not-a-secret@127.0.0.1:5433/cayce_ops
|
||||
PGPASSWORD: ci-only-not-a-secret
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
fetch-depth: 0 # gitleaks needs full history
|
||||
|
||||
- name: Setup
|
||||
run: |
|
||||
python3 -m pip install --user ruff pytest --quiet 2>/dev/null || true
|
||||
- uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Lint (ruff, advisory)
|
||||
run: |
|
||||
if [ -d cayceops ]; then
|
||||
ruff check cayceops/ --exit-zero || true
|
||||
else
|
||||
echo "no python package — OK"
|
||||
fi
|
||||
- name: Install (locked)
|
||||
run: uv sync --frozen
|
||||
|
||||
- name: Tests
|
||||
run: |
|
||||
if [ -d cayceops/tests ]; then
|
||||
python3 -m pytest cayceops/tests/ -v --tb=short 2>&1 | tail -5
|
||||
else
|
||||
echo "no tests dir — OK"
|
||||
fi
|
||||
- name: Lint (ruff)
|
||||
run: uv run ruff check .
|
||||
|
||||
- name: Guard tests
|
||||
- name: Migrations upgrade/downgrade round-trip (Postgres 16)
|
||||
run: |
|
||||
if [ -f runtime/guard.test.mjs ]; then
|
||||
cd runtime && node --test guard.test.mjs 2>&1 | tail -3 && cd ..
|
||||
else
|
||||
echo "no guard tests — OK"
|
||||
fi
|
||||
uv run alembic upgrade head
|
||||
uv run alembic downgrade 0001
|
||||
uv run alembic upgrade head
|
||||
uv run alembic downgrade base
|
||||
uv run alembic upgrade head
|
||||
|
||||
- name: Syntax check (runtime)
|
||||
- name: Alembic smoke (SQLite)
|
||||
run: uv run alembic upgrade head
|
||||
|
||||
- name: Unit tests (pytest)
|
||||
run: uv run pytest -m "not integration"
|
||||
|
||||
- name: Integration tests — roles.sql + daemon cycles (Postgres 16)
|
||||
run: |
|
||||
for f in runtime/*.mjs; do
|
||||
[ -f "$f" ] && node --check "$f" || true
|
||||
done
|
||||
echo "syntax check OK"
|
||||
sudo apt-get update && sudo apt-get install -y postgresql-client
|
||||
uv run pytest -m integration -v
|
||||
|
||||
- name: Secret scan (gitleaks, full history)
|
||||
run: |
|
||||
curl -sSfL https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz | tar -xz gitleaks
|
||||
./gitleaks detect --source . --log-opts="--all" -v
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Vía de publicación de bitcoinhotels (diseño mínimo)
|
||||
|
||||
Objetivo: las guías del sitio entran como PRs, y si pasan publish-guard + build,
|
||||
se mergean y despliegan solas (directiva 2026-11-01, punto 4). El código del
|
||||
sitio NO entra aquí: sigue siendo PR con merge humano.
|
||||
|
||||
## Piezas
|
||||
|
||||
1. **Repo `cayce/bitcoinhotels-content`** (privado): SOLO `content/guides/*.md`
|
||||
+ `manifest.json` (orden, títulos). Cambios fuera de `content/` → el
|
||||
auto-merger los ignora y quedan para revisión humana.
|
||||
2. **Auto-merger** (`cayce-ops/cayceops/plugins/bitcoinhotels_prague.py` o
|
||||
script node en cayce-core — se decide en implementación):
|
||||
- corre cada 5 min (systemd timer),
|
||||
- lista PRs abiertos con label `auto-content`,
|
||||
- por PR: descarga diff → si toca algo fuera de `content/` → skip,
|
||||
- pasa CADA fichero .md nuevo/modificado por el mismo `guard.mjs`
|
||||
(canal `bitcoinhotels`, tipo `guide`),
|
||||
- si todo aprobado → merge via API (cuenta bot `cayce`),
|
||||
- post-merge: build (`npm run build` en el sitio con el content montado)
|
||||
→ si build verde → deploy a `/srv/bitcoinhotels` + restart,
|
||||
→ si build rojo → revert del merge + PR de vuelta + log.
|
||||
3. **Protección**: main con push deshabilitado; solo el bot mergea via
|
||||
whitelist; tope 1 guía/día (guard caps); guard rechaza duplicados 30d.
|
||||
4. **Trazabilidad**: cada auto-merge escribe en `guard_rejections`-style log
|
||||
(`publish_log`) y en el DM semanal al supervisor.
|
||||
|
||||
## Lo que NO hace la V1
|
||||
- No publica sin PR (no hay escritura directa al sitio).
|
||||
- No toca código/diseño del sitio (eso es PR humano).
|
||||
- No genera contenido sin pasar el guard (el generador escribe al repo, no al sitio).
|
||||
|
||||
## Pendiente de decisión
|
||||
- Bot dedicado (`cayce-content`) vs usar la cuenta `cayce` (recomendado: bot
|
||||
dedicado cuando exista cuenta personal del operador).
|
||||
Reference in New Issue
Block a user