name: CI Health Check & Quality Gate on: push: branches: - main - dev pull_request: workflow_dispatch: jobs: healthcheck: runs-on: ubuntu-latest name: Compose Templates Health Check steps: - name: Checkout Code uses: actions/checkout@v4 - name: Install System Dependencies run: | apt-get update && apt-get install -y python3 python3-yaml git ca-certificates - name: Validate Compose Templates & Workflows run: | echo "==> Validating all docker-compose.yml files..." python3 - <<'PY' import pathlib, sys try: import yaml except ImportError: print("pyyaml missing"); sys.exit(1) failures = [] files = sorted(pathlib.Path(".").glob("*/docker-compose.yml")) assert files, "no */docker-compose.yml found" for f in files: try: doc = yaml.safe_load(f.read_text()) except Exception as e: failures.append(f"{f}: YAML parse error: {e}") continue if not isinstance(doc, dict) or "services" not in doc: failures.append(f"{f}: missing top-level 'services' key") continue for svc, cfg in doc["services"].items(): if not isinstance(cfg, dict) or "image" not in cfg: failures.append(f"{f}: service '{svc}' missing 'image'") print(f"OK {f} services={list(doc['services'].keys())}") for f in sorted(pathlib.Path(".gitea/workflows").glob("*.y*ml")): try: yaml.safe_load(f.read_text()) print(f"OK {f}") except Exception as e: failures.append(f"{f}: YAML parse error: {e}") if failures: print("FAILURES:"); [print(" -", x) for x in failures]; sys.exit(1) print("All templates validated") PY - name: Live Production App Health Probe run: | echo "==> Probing production endpoint https://streamlit.turbo-data.com/_stcore/health..." HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://streamlit.turbo-data.com/_stcore/health || echo "000") if [ "$HTTP_STATUS" = "200" ]; then echo "✓ Production Streamlit dashboard is healthy (HTTP $HTTP_STATUS)" else echo "⚠️ Production health check returned HTTP $HTTP_STATUS (may still be starting or initializing)" fi