Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI - Run Tests

on:
push:

jobs:
tests:
name: Run Tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup docker
uses: docker/setup-docker-action@v4

- name: Start containers
run: |
set -eu
cp .env.example .env
make up

- name: Run tests
run: make test-all
29 changes: 19 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
SHELL ?= /bin/zsh
DEMO_PORT ?= 3000

.PHONY: help install build test lint migrate ingest ingest-docker sitekey dev setup up down logs clean demo
.PHONY: help install build lint test test-all migrate ingest ingest-docker sitekey dev setup setup-docker up down logs clean demo

help:
@echo "Targets disponibles:"
@echo " make install - Instala dependencias npm"
@echo " make build - Build de todos los paquetes"
@echo " make test - Ejecuta tests"
@echo " make lint - Ejecuta checks de TypeScript"
@echo " make test - Ejecuta tests"
@echo " make test-all - Ejecuta lint + tests (docker)"
@echo " make migrate - Ejecuta migraciones de DB"
@echo " make ingest - Carga casos desde Missing Children (local)"
@echo " make ingest-docker - Carga casos desde Missing Children (docker)"
@echo " make sitekey - Crea site key (DOMAINS=localhost,foo.gob)"
@echo " make dev - Inicia API en modo desarrollo"
@echo " make setup - Flujo local completo (install + build + migrate + ingest + sitekey + widget)"
@echo " make setup-docker - Igual que `setup` pero usando docker compose"
@echo " make up - Levanta docker compose (postgres + migrator + api)"
@echo " make down - Baja docker compose"
@echo " make logs - Logs de docker compose"
Expand All @@ -27,18 +29,19 @@ install:
build:
@npm run --workspaces build

lint:
@npm run --workspaces lint

test:
@npm run --workspaces test

lint:
@npm run --workspaces lint
test-all:
@docker compose run --rm api npm run --workspaces lint
@docker compose run --rm api npm run --workspaces test

migrate:
@npm run -w @missing-captcha/api migrate

ingest:
@npm run -w @missing-captcha/api ingest:missing

sitekey:
@npm run -w @missing-captcha/api seed:sitekey "$(or $(DOMAINS),localhost)"

Expand All @@ -52,8 +55,15 @@ setup: install up
@npm run -w @missing-captcha/api seed:sitekey "$(or $(DOMAINS),localhost)"
@npm run -w @missing-captcha/widget build

setup-docker: up ingest-docker
@docker compose exec -T api npm run -w @missing-captcha/api seed:sitekey "$(or $(DOMAINS),localhost)"
@docker compose exec -T api npm run -w @missing-captcha/widget build

ingest:
@npm run -w @missing-captcha/api ingest:missing

ingest-docker:
@docker compose exec -T api npm run -w @missing-captcha/api ingest:missing
@docker compose run --rm api npm run -w @missing-captcha/api ingest:missing

up:
@docker compose up -d --build
Expand All @@ -68,8 +78,7 @@ clean:
@rm -rf node_modules apps/api/dist packages/shared/dist
@rm -f packages/widget/dist/widget.js packages/widget/dist/widget.css

demo:
@$(MAKE) up
demo: up
@PUBLIC_KEY=$$(docker compose exec -T api npm run -w @missing-captcha/api seed:sitekey "localhost" | grep -Eo 'rc_pk_[a-f0-9]+' | tail -n 1); \
if [ -z "$$PUBLIC_KEY" ]; then echo "No se pudo generar publicKey"; exit 1; fi; \
npm run -w @missing-captcha/widget build; \
Expand Down
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,21 @@ make setup DOMAINS="localhost,tu-dominio.gob"
make dev
```

## Setup con Docker
## Setup docker

```sh
make up
```

Luego (fuera del contenedor API o con `docker compose exec api ...`):

```sh
npm run -w @missing-captcha/api ingest:missing
npm run -w @missing-captcha/api seed:sitekey "localhost,tu-dominio.gob"
npm run -w @missing-captcha/widget build
make setup-docker DOMAINS="localhost,tu-dominio.gob"
```

Alternativa con Makefile (docker):
Esto ya corre todos los pasos necesarios para que funcione, incluyendo el ingest.

## Ingest de casos (local y docker)
```sh
make ingest
o
make ingest-docker
```

## Ingest de casos (manual)

- El ingest consume datos públicos desde:
- `https://www.missingchildren.org.ar/listado.php?categoria=perdidos`
Expand Down
Loading