✅🧱 add tests & ci changes
This commit is contained in:
80
Makefile
80
Makefile
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user