🧱 add tests & ci changes
All checks were successful
CI / Lint (push) Successful in 21s
CI / Helm Lint (push) Successful in 6s
CI / Build (push) Successful in 1m48s
CI / Test (push) Successful in 44s

This commit is contained in:
Christian van Dijk
2026-02-23 22:52:54 +01:00
parent dbbe991a3d
commit 59ddc66a8e
10 changed files with 309 additions and 72 deletions

View File

@@ -1,9 +1,75 @@
.PHONY: generate
.PHONY: dev up down build test lint install-deps logs logs-api logs-worker logs-all \
init-db shell-postgres shell-api shell-worker status clean help
install-requirements:
brew install protobuf lua luarocks && luarocks install protobuf && luarocks install grpc
# Default target
help:
@echo "Handheld Devices - Makefile targets"
@echo ""
@echo " install-deps Install all deps for local dev (LuaRocks, Deno cache)"
@echo " dev, up Start all services (Postgres, Redis, API, worker, frontend)"
@echo " down Stop all services"
@echo " build Build Docker images"
@echo " test Run unit tests (devices-api)"
@echo " lint Run Luacheck and Deno check"
@echo ""
@echo " logs Follow API logs"
@echo " logs-worker Follow worker logs"
@echo " logs-all Follow all service logs"
@echo ""
@echo " init-db Run DB migrations (requires services up)"
@echo " shell-postgres Open psql in Postgres container"
@echo " shell-api Open shell in API container"
@echo " shell-worker Open shell in worker container"
@echo ""
@echo " status Show container status"
@echo " clean Stop and remove volumes"
verify-install:
protoc --version
lua -v
luarocks list | grep protobuf
install-deps:
luarocks install lua-cjson && luarocks install luasocket && luarocks install pgmoon && \
luarocks install redis-lua && luarocks install luaossl && luarocks install busted && \
luarocks install luacheck
cd frontend && deno cache main.ts
dev up:
docker-compose up -d
down:
docker-compose down
build:
docker-compose build
test:
$(MAKE) -C devices-api test
lint:
luacheck devices-api devices-worker --codes
cd frontend && deno check
logs:
docker-compose logs -f api
logs-worker:
docker-compose logs -f worker
logs-all:
docker-compose logs -f
init-db:
docker-compose exec postgres psql -U devices_user -d handheld_devices \
-f /docker-entrypoint-initdb.d/001_create_devices.sql
shell-postgres:
docker-compose exec postgres psql -U devices_user -d handheld_devices
shell-api:
docker-compose exec api sh
shell-worker:
docker-compose exec worker sh
status:
docker-compose ps
clean: down
docker-compose down -v