🧱 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

@@ -77,32 +77,7 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
needs: build
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_DB: handheld_devices
POSTGRES_USER: devices_user
POSTGRES_PASSWORD: devices_password
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U devices_user -d handheld_devices"
--health-interval 5s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 5
needs: lint
steps:
- uses: actions/checkout@v4
@@ -112,25 +87,15 @@ jobs:
- name: Setup LuaRocks
uses: leafo/gh-actions-luarocks@v6
- name: Install dependencies
- name: Install test dependencies
run: |
luarocks install busted
luarocks install lua-cjson
luarocks install luasocket
luarocks install pgmoon
luarocks install redis-lua
luarocks install luaossl
- name: Run API
run: |
cd devices-api
export DB_HOST=localhost DB_PORT=5432 DB_NAME=handheld_devices DB_USER=devices_user DB_PASSWORD=devices_password
export REDIS_HOST=localhost REDIS_PORT=6379
lua app-standalone.lua &
API_PID=$!
sleep 15
curl -f http://localhost:8080/health/ready || (kill $API_PID 2>/dev/null; exit 1)
curl -f http://localhost:8080/health/live || (kill $API_PID 2>/dev/null; exit 1)
kill $API_PID 2>/dev/null || true
- name: Run unit tests
run: make test
helm-lint:
name: Helm Lint