✅🧱 add tests & ci changes
This commit is contained in:
45
.github/workflows/ci.yml
vendored
45
.github/workflows/ci.yml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user