Files
tsumugu/.gitea/workflows/test.yml
T
LarsandCursor eeeb81148a
Deploy Development / deploy (push) Successful in 27s
Test Suite / pytest-backend (push) Successful in 1m13s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 8s
Starte die Pflicht-Suite wieder mit jedem Push auf develop.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-17 20:22:12 +02:00

86 lines
3.3 KiB
YAML

name: Test Suite
on:
push:
branches: [develop]
workflow_run:
workflows: ["Deploy Development"]
types: [completed]
workflow_dispatch:
jobs:
pytest-backend:
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: pytest against Dev Postgres (tsumugu_test)
run: |
set -e
APP_DIR="/home/lars/docker/tsumugu-dev"
COMPOSE_FILE="docker-compose.dev-env.yml"
echo "pytest uses Dev Postgres (${APP_DIR}); event=${{ github.event_name }}"
cd "$APP_DIR"
for i in $(seq 1 60); do
if [ -f "$APP_DIR/backend/pytest.ini" ] && docker compose -f "$COMPOSE_FILE" exec -T backend true 2>/dev/null; then
echo "backend and pytest.ini ready (attempt $i)"
break
fi
if [ "$i" -eq 60 ]; then
echo "timeout waiting for Dev checkout/backend"
docker compose -f "$COMPOSE_FILE" ps || true
ls -la "$APP_DIR/backend" || true
exit 1
fi
sleep 5
done
PGUSER="$(docker compose -f "$COMPOSE_FILE" exec -T postgres printenv POSTGRES_USER | tr -d '\r')"
echo "test database tsumugu_test on the existing Dev Postgres (owner ${PGUSER})"
docker compose -f "$COMPOSE_FILE" exec -T postgres \
psql -U "$PGUSER" -d postgres -v ON_ERROR_STOP=1 \
-c "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = 'tsumugu_test' AND pid <> pg_backend_pid();"
docker compose -f "$COMPOSE_FILE" exec -T postgres \
psql -U "$PGUSER" -d postgres -v ON_ERROR_STOP=1 \
-c "DROP DATABASE IF EXISTS tsumugu_test;"
docker compose -f "$COMPOSE_FILE" exec -T postgres \
psql -U "$PGUSER" -d postgres -v ON_ERROR_STOP=1 \
-c "CREATE DATABASE tsumugu_test OWNER ${PGUSER};"
docker compose -f "$COMPOSE_FILE" run --rm --no-deps \
-v "${APP_DIR}:/src:ro" \
-w /src/backend \
-e DB_NAME=tsumugu_test \
-e SEED_DEMO=false \
-e PYTHONUTF8=1 \
backend sh -lc '
set -e
export DB_NAME=tsumugu_test
export SEED_DEMO=false
pip install -q -r requirements-dev.txt
python -m pytest tests -ra --tb=short
'
smoke-dev:
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Non-destructive smoke against the running Dev app
run: |
set -e
echo "live Dev API (tsumugu_dev), read-only health"
curl -sf http://localhost:8094/api/health
echo
curl -sf http://localhost:3094/api/health
echo
echo "LAN smoke OK. Public URL after TLS: https://dev.tsumugu.jinkendo.de"
frontend-build:
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Frontend production build on Dev checkout
run: |
set -e
APP_DIR="/home/lars/docker/tsumugu-dev"
cd "$APP_DIR/frontend"
npm ci
npm run build