From 9af64b805402b97442c7b04021cea84b9b362a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Garc=C3=ADa=20M=C3=A9ndez?= Date: Mon, 16 Feb 2026 10:35:25 -0500 Subject: [PATCH] ci: add GitHub Actions workflow and adopt PR workflow Add CI with lint, format check, test, and build jobs. Update AGENTS.md with PR-based workflow documentation. --- .github/workflows/ci.yml | 65 ++++++++++++++++++++++++++++++++++++++++ AGENTS.md | 44 +++++++++++++++++++++++---- 2 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..684a824 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,65 @@ +name: CI + +on: + pull_request: + push: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: ESLint + run: npm run lint + + - name: Prettier + run: npm run format:check + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm run test:ci + + build: + runs-on: ubuntu-latest + needs: [lint, test] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build diff --git a/AGENTS.md b/AGENTS.md index abb353e..99e974a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -31,6 +31,9 @@ Si algo no está claro o hay más de una opción válida, el agente DEBE pregunt ```text winbit-app/ +├── .github/ +│ └── workflows/ +│ └── ci.yml # GitHub Actions CI (lint, test, build) ├── src/ │ ├── components/ │ │ ├── ui/ # Button, Card, EmptyState, ErrorMessage, Input, Modal, Select, Spinner, Toast @@ -216,15 +219,46 @@ npm run build && firebase deploy - Headers: `Cross-Origin-Opener-Policy: same-origin-allow-popups` (requerido para Google Sign-In popup). - Producción: https://winbit-6579c.web.app -## 12) Protocolo Git +### CI (GitHub Actions) -### Commits +Jobs: + +1. `lint` — ESLint + Prettier check. +2. `test` — Vitest (single run). +3. `build` — Production build (depende de lint y test). + +Se ejecuta en push a `main` y en pull requests. + +## 12) Protocolo Git y PRs + +### Reglas de branches + +- Un branch por cambio puntual y atómico. +- Nombres de branch: `feature/` o `fix/`. +- Base siempre: `main`. + +### Reglas de commits - Mensaje conciso (1-2 líneas). - NUNCA mencionar Cursor, Claude, AI, LLM, copilot ni herramientas de IA. - PROHIBIDO cualquier trailer `Co-authored-by` que mencione IA. +- Usar `git -c commit.cleanup=verbatim` para evitar trailers automáticos. + +### Flujo de trabajo (PR obligatorio) + +1. `git checkout main && git pull origin main` +2. `git checkout -b feature/` +3. Implementar cambio + tests +4. Verificar: `npm run lint && npm run format:check && npm run test:ci` +5. `git add` (solo archivos relevantes, nunca secretos) +6. `git commit` (mensaje conciso) +7. `git push -u origin feature/` +8. `gh pr create` (título descriptivo, body con summary y test plan) +9. Esperar que CI pase (lint, test, build) +10. `gh pr merge --squash --delete-branch` +11. Volver a paso 1 para siguiente cambio -### Pre-push +### Pre-push (hook local) - `npm run lint` (sin errores) - `npm run format:check` (sin errores) @@ -233,12 +267,12 @@ npm run build && firebase deploy ### Permisos operativos -El agente tiene autorización para: `git add`, `commit`, `push`. +El agente tiene autorización para: `git add`, `commit`, `push`, `gh pr create`, `gh pr merge`. Condiciones: - Cambios atómicos y trazables. -- Quality gates en verde. +- Quality gates en verde (local + CI). - Sin secretos versionados. - No comandos destructivos salvo solicitud explícita.