Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
79 lines
2.8 KiB
YAML
79 lines
2.8 KiB
YAML
# CI para Gitea Actions (act_runner). Sintaxis compatible con GitHub Actions;
|
|
# Gitea descarga las acciones `uses:` de github.com (DEFAULT_ACTIONS_URL).
|
|
# Requisitos del runner: etiqueta `ubuntu-latest` y, para el job `imagen`,
|
|
# acceso a Docker (socket montado o Docker-in-Docker).
|
|
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
|
|
# Las imágenes del runner de Gitea no traen Chrome: Lighthouse usa el
|
|
# Chromium que Playwright instaló en el paso anterior.
|
|
- name: Lighthouse CI (móvil, umbral 95)
|
|
run: |
|
|
export CHROME_PATH="$(node -e "console.log(require('playwright').chromium.executablePath())")"
|
|
npx lhci autorun
|
|
# upload-artifact v4 usa una API que Gitea no implementa; v3 sí funciona.
|
|
- uses: actions/upload-artifact@v3
|
|
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
|
|
for h in collinasystems.com.mx www.collinasystems.com.mx www.collinasystems.com; do
|
|
curl -sSI -H "Host: $h" http://localhost:8080/proyectos | grep -qi "^location: https://collinasystems.com/proyectos"
|
|
done
|
|
curl -sSI -H "Host: collinasystems.com" http://localhost:8080/Productos.html | grep -qi "^location: /proyectos"
|
|
docker stop sitio
|