Skip to content

Commit ac43736

Browse files
authored
Update readme.md
1 parent 7147419 commit ac43736

1 file changed

Lines changed: 199 additions & 1 deletion

File tree

readme.md

Lines changed: 199 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,199 @@
1-
## TEST
1+
# react-app-pipeline-example
2+
3+
Repositorio de ejemplo **React + Vite** pensado para mostrar un flujo completo de **CI/CD con GitHub Actions**, incluyendo **lint**, **tests unitarios (Jest)** y **tests end-to-end (Cypress)**, con build estático listo para despliegue.
4+
5+
Repo: https://github.com/atxpaul/react-app-pipeline-example
6+
7+
---
8+
9+
## Objetivo del proyecto
10+
11+
Este repo sirve como ejemplo práctico para:
12+
13+
- Construir una app frontend moderna con React
14+
- Validar calidad con linting y tests
15+
- Ejecutar tests end-to-end en pipeline
16+
- Generar un artefacto estático (`dist/`)
17+
- Integrarlo todo en un flujo de GitHub Actions
18+
19+
Está pensado para **demos, formaciones y ejemplos de pipelines**.
20+
21+
---
22+
23+
## Features
24+
25+
- React + Vite
26+
- ESLint
27+
- Unit tests con Jest
28+
- End-to-End tests con Cypress
29+
- CI/CD con GitHub Actions
30+
- Build estático
31+
- Configuración opcional para Azure Static Web Apps
32+
33+
---
34+
35+
## Requisitos
36+
37+
- Node.js 18+ (recomendado)
38+
- npm
39+
40+
---
41+
42+
## Estructura del proyecto (alto nivel)
43+
44+
- `.github/` → workflows de GitHub Actions
45+
- `src/` → código fuente
46+
- `public/` → assets estáticos
47+
- `tests/` → unit tests (Jest)
48+
- `cypress/` → e2e tests (Cypress)
49+
- `dist/` → salida del build (generada)
50+
- `mocks/` → mocks/fixtures (si aplica)
51+
- `staticwebapp.config.json` → reglas de routing/rewrites (si aplica)
52+
53+
---
54+
55+
## Uso en local
56+
57+
### Instalar dependencias
58+
59+
npm ci
60+
61+
### Arrancar en modo desarrollo
62+
63+
npm run dev
64+
65+
La app suele quedar en:
66+
67+
http://localhost:5173
68+
69+
---
70+
71+
## Scripts habituales
72+
73+
> Los nombres exactos dependen del `package.json`. Esto es orientativo.
74+
75+
### Desarrollo / Build
76+
77+
- Dev server:
78+
79+
npm run dev
80+
81+
- Build de producción:
82+
83+
npm run build
84+
85+
- Preview del build:
86+
87+
npm run preview
88+
89+
### Lint
90+
91+
- Ejecutar ESLint:
92+
93+
npm run lint
94+
95+
### Unit tests (Jest)
96+
97+
- Ejecutar tests:
98+
99+
npm test
100+
101+
o
102+
103+
npm run test
104+
105+
### E2E (Cypress)
106+
107+
- Abrir Cypress (UI):
108+
109+
npm run cy:open
110+
111+
- Ejecutar Cypress (headless):
112+
113+
npm run cy:run
114+
115+
---
116+
117+
## Testing
118+
119+
### Unit tests
120+
121+
- Ubicación típica: `tests/`
122+
- Config habitual: `jest.config.mjs`
123+
124+
### End-to-End (Cypress)
125+
126+
- Specs: `cypress/e2e/`
127+
- Config habitual: `cypress.config.js`
128+
129+
---
130+
131+
## CI/CD con GitHub Actions
132+
133+
Los workflows en `.github/workflows/` suelen seguir este flujo:
134+
135+
1. Checkout del repo
136+
2. Setup de Node
137+
3. Instalación de dependencias (`npm ci`)
138+
4. Lint
139+
5. Unit tests
140+
6. Build (`npm run build`)
141+
7. E2E (Cypress)
142+
8. (Opcional) Deploy
143+
144+
Estrategia típica (si aplica a tu repo):
145+
146+
- Pull Requests → validación (lint + unit + e2e)
147+
- Rama `main` → despliegue a `staging`
148+
- Ramas `release/*` → despliegue a `production`
149+
150+
---
151+
152+
## Variables de entorno
153+
154+
Si el proyecto usa variables de entorno:
155+
156+
- En local: `.env`
157+
- En CI/CD: GitHub Secrets / Variables o GitHub Environments
158+
159+
En Vite, las variables expuestas al frontend suelen empezar por `VITE_`.
160+
161+
Ejemplo:
162+
163+
VITE_API_URL=https://example.com
164+
165+
---
166+
167+
## Deploy
168+
169+
### Azure Static Web Apps (opcional)
170+
171+
Configuración típica:
172+
173+
- Build command: `npm run build`
174+
- Output folder: `dist`
175+
176+
Si es una SPA, revisa `staticwebapp.config.json` para rutas/rewrites.
177+
178+
### Hosting estático genérico
179+
180+
1. Construir:
181+
182+
npm run build
183+
184+
2. Publicar el contenido de `dist/` (Netlify, GitHub Pages, S3, etc.)
185+
186+
---
187+
188+
## Contribuir
189+
190+
1. Fork
191+
2. Rama (`feat/*` o `fix/*`)
192+
3. Verificar lint + tests
193+
4. PR a `main`
194+
195+
---
196+
197+
## Licencia
198+
199+
Pendiente de definir (añade un `LICENSE` si quieres publicarlo como OSS).

0 commit comments

Comments
 (0)