Skip to content

docs: README completo (arquitectura, metodologias, diagramas) y runbo… #40

docs: README completo (arquitectura, metodologias, diagramas) y runbo…

docs: README completo (arquitectura, metodologias, diagramas) y runbo… #40

Workflow file for this run

# ---------------------------------------------------------------------------
# CI de CertReady.
#
# Dos trabajos:
# - go: formato, análisis estático y pruebas de todos los módulos Go, con
# PostgreSQL para las pruebas de integración del repositorio.
# - web: typecheck, lint, formato, pruebas y build de la aplicación web.
#
# El despliegue (empaquetado a Lambda y publicación) está pospuesto hasta
# disponer de una cuenta de AWS; ver infra/README.md.
# ---------------------------------------------------------------------------
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
go:
name: go
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: certready_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
mongo:
image: mongo:7
ports:
- 27017:27017
options: >-
--health-cmd "mongosh --quiet --eval 'db.runCommand({ping:1})'"
--health-interval 10s
--health-timeout 5s
--health-retries 10
env:
# Conexiones a las bases de pruebas. Las pruebas de integración del
# repositorio se ejecutan solo si estas variables están definidas.
CATALOG_TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/certready_test?sslmode=disable
USERS_TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/certready_test?sslmode=disable
ENROLLMENTS_TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/certready_test?sslmode=disable
EXAMS_TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/certready_test?sslmode=disable
JUDGE_TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/certready_test?sslmode=disable
CONTENT_TEST_MONGO_URI: mongodb://localhost:27017
EXAMS_TEST_MONGO_URI: mongodb://localhost:27017
PROBLEMS_TEST_MONGO_URI: mongodb://localhost:27017
steps:
- uses: actions/checkout@v4
- name: Configurar Go
uses: actions/setup-go@v5
with:
go-version: "1.25"
- name: Formato gofmt
run: |
unformatted=$(gofmt -l ./libs ./services ./tools)
if [ -n "$unformatted" ]; then
echo "::error::Archivos sin formatear con gofmt:"
echo "$unformatted"
exit 1
fi
- name: Vet y pruebas por módulo
run: |
set -e
for dir in libs/platform services/health services/catalog services/users services/enrollments services/content services/exams services/problems services/progress tools/oidc-mock judge; do
echo "===== $dir ====="
(cd "$dir" && go vet ./... && go test -cover ./...)
done
sandbox:
name: sandbox
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configurar Go
uses: actions/setup-go@v5
with:
go-version: "1.25"
- name: Construir la imagen del sandbox de Python
run: docker build -t certready/judge-python:latest judge/runners/python
- name: Suite de escape del sandbox
# La "prueba estrella": exige contención de red, FS, fork-bomb, memoria y
# tiempo. Requiere Docker (disponible en los runners de GitHub).
env:
JUDGE_DOCKER_TESTS: "1"
run: cd judge && go test ./internal/runner/...
data:
name: data
runs-on: ubuntu-latest
defaults:
run:
working-directory: data
steps:
- uses: actions/checkout@v4
- name: Configurar Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Instalar dependencias
run: pip install -e ".[dev]"
- name: Formato y lint
run: |
ruff check .
black --check .
- name: Pruebas
# Unitarias (puras). La integración con ClickHouse va gated por DATA_ETL_IT.
run: pytest
web:
name: web
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v4
- name: Configurar Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: web/package-lock.json
- name: Instalar dependencias
# npm install (no npm ci): tolera el desfase del lockfile por versiones
# de npm distintas (local vs runner) y por dependencias opcionales de
# plataforma (p. ej. @emnapi/*) que se resuelven distinto en Linux.
run: npm install --no-audit --no-fund
- name: Verificación
run: npm run check
- name: Build
run: npm run build