Run backend tests with pytest after Dev deploy.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6ea36f7d1f
commit
9d79e3e92f
33 files changed
+188
-150
No files matched your search
+32
-20
@@ -2,29 +2,33 @@ name: Test Suite
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [develop, main]
|
||||
pull_request:
|
||||
branches: [develop]
|
||||
workflow_run:
|
||||
workflows: ["Deploy Development"]
|
||||
types: [completed]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
backend-postgres:
|
||||
pytest-backend:
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Backend tests against Dev Postgres (kansho_test)
|
||||
- name: pytest against Dev Postgres (kansho_test)
|
||||
run: |
|
||||
set -e
|
||||
APP_DIR="/home/lars/docker/kansho-dev"
|
||||
COMPOSE_FILE="docker-compose.dev-env.yml"
|
||||
echo "backend tests always use Dev Postgres (${APP_DIR})"
|
||||
echo "pytest uses Dev Postgres (${APP_DIR}); event=${{ github.event_name }}"
|
||||
cd "$APP_DIR"
|
||||
for i in $(seq 1 60); do
|
||||
if docker compose -f "$COMPOSE_FILE" exec -T backend true 2>/dev/null; then
|
||||
echo "backend ready (attempt $i)"
|
||||
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 backend"
|
||||
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
|
||||
@@ -51,24 +55,32 @@ jobs:
|
||||
backend sh -lc '
|
||||
set -e
|
||||
unset KANSHO_DB_PATH
|
||||
for test in tests/test_*.py; do
|
||||
echo "=== $test ==="
|
||||
python "$test"
|
||||
done
|
||||
pip install -q -r requirements-dev.txt
|
||||
python -m pytest tests -m "not slow" -ra -vv --tb=short
|
||||
'
|
||||
|
||||
frontend-build:
|
||||
smoke-dev:
|
||||
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Frontend production build on deploy checkout
|
||||
- name: Non-destructive smoke against the running Dev app
|
||||
run: |
|
||||
set -e
|
||||
EVENT_REF="${{ github.ref_name }}"
|
||||
BASE_REF="${{ github.base_ref }}"
|
||||
APP_DIR="/home/lars/docker/kansho"
|
||||
if [ "$EVENT_REF" = "develop" ] || [ "$BASE_REF" = "develop" ]; then
|
||||
APP_DIR="/home/lars/docker/kansho-dev"
|
||||
fi
|
||||
echo "live Dev API (kansho_dev), read-only health"
|
||||
curl -sf http://localhost:8096/api/health
|
||||
echo
|
||||
curl -sf http://localhost:3096/api/health
|
||||
echo
|
||||
echo "LAN smoke OK. Public URL after TLS: https://dev.kansho.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/kansho-dev"
|
||||
cd "$APP_DIR/frontend"
|
||||
npm ci
|
||||
npm run build
|
||||
Reference in new issue
Block a user