#!/usr/bin/env bash # Run tests, then push CarsRUS to Hugging Face (run from CarsRUS directory). # Usage: cd CarsRUS && ./deploy.sh set -e cd "$(dirname "$0")" echo "=== 1. Running tests ===" python test_business_logic.py python test_rag.py echo "" echo "=== 2. Git add / commit / push ===" GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || true) if [ -z "$GIT_ROOT" ]; then echo "Not in a git repo. Commit and push manually from your repo root." exit 1 fi # Path from repo root to this folder (e.g. Desktop/carsRUS/CarsRUS) REL_PATH=$(git rev-parse --show-prefix 2>/dev/null | sed 's|/$||') if [ -z "$REL_PATH" ]; then REL_PATH="." fi cd "$GIT_ROOT" git add "${REL_PATH}/DEPLOY.md" "${REL_PATH}/README.md" "${REL_PATH}/run_tests.sh" "${REL_PATH}/test_business_logic.py" "${REL_PATH}/deploy.sh" 2>/dev/null || true git add "${REL_PATH}/app.py" "${REL_PATH}/agent.py" "${REL_PATH}/rag_engine.py" "${REL_PATH}/requirements.txt" "${REL_PATH}/test_agent.py" "${REL_PATH}/test_rag.py" 2>/dev/null || true git status --short "${REL_PATH}" | head -20 git commit -m "CarsRUS: deploy with DevOps/QA tests and DEPLOY.md" || true git push origin main echo "Done. Space: https://huggingface.co/spaces/galbendavids/CarsRUS"