- Dockerfile multi-etapa: build con Playwright (sitio, PDF, precompresión) y nginx sin privilegios en 8080 con healthcheck - nginx: CSP sin unsafe-inline, HSTS, nosniff, Referrer-Policy, caché inmutable para assets con hash, gzip_static, página 404 y /salud - scripts: verificar-prohibidas (falla con PLD, Odoo, lavado, CHM, 115/2026 en dist/), verificar-metricas (falla con resultado sin método), comprimir - Lighthouse CI con umbral 95 en móvil y presupuesto de 1.5 MB / 50 KB de JS - GitHub Actions: check, build, verificaciones, PDF, Lighthouse e imagen Docker Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
66 lines
1.8 KiB
YAML
66 lines
1.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
jobs:
|
|
verificar:
|
|
name: Tipos, build, contenido y Lighthouse
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
ASTRO_TELEMETRY_DISABLED: 1
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
- run: npm ci
|
|
- name: astro check
|
|
run: npm run check
|
|
- name: Build
|
|
run: npm run build
|
|
- name: Palabras prohibidas en dist/
|
|
run: npm run verificar:prohibidas
|
|
- name: Métricas sin método
|
|
run: npm run verificar:metricas
|
|
- name: Currículum en PDF
|
|
run: |
|
|
npx playwright install --with-deps chromium
|
|
npm run cv:pdf
|
|
- name: Lighthouse CI (móvil, umbral 95)
|
|
run: npx lhci autorun
|
|
- uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: lighthouse
|
|
path: .lighthouseci
|
|
retention-days: 14
|
|
|
|
imagen:
|
|
name: Imagen Docker
|
|
runs-on: ubuntu-latest
|
|
needs: verificar
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: docker/setup-buildx-action@v3
|
|
- name: Construir (sin publicar)
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: false
|
|
load: true
|
|
tags: collina-sitio:ci
|
|
- name: Arrancar y comprobar cabeceras
|
|
run: |
|
|
docker run -d --rm -p 8080:8080 --name sitio collina-sitio:ci
|
|
sleep 3
|
|
curl -sSfI http://localhost:8080/ | tee cabeceras.txt
|
|
grep -qi "content-security-policy" cabeceras.txt
|
|
grep -qi "strict-transport-security" cabeceras.txt
|
|
grep -qi "x-content-type-options: nosniff" cabeceras.txt
|
|
curl -sSf -o /dev/null http://localhost:8080/curriculum/collina-systems-curriculum.pdf
|
|
docker stop sitio
|