Spaces:
Sleeping
Sleeping
| name: RAG CI/CD | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| - name: Run unit tests only | |
| env: | |
| GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} | |
| run: pytest -v -m "not integration" | |
| # π DEPLOY BACKEND | |
| - name: Deploy Backend to HF | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| set -e | |
| pip install huggingface_hub | |
| sudo apt-get update | |
| sudo apt-get install -y rsync | |
| git config --global user.email "you@example.com" | |
| git config --global user.name "github-actions" | |
| git clone https://huggingface.co/spaces/Hitan2004/agentic-corrective-rag hf_backend | |
| cd hf_backend | |
| git remote set-url origin https://user:${HF_TOKEN}@huggingface.co/spaces/Hitan2004/agentic-corrective-rag | |
| rsync -av --exclude='.git' --exclude='ui' ../ ./ | |
| cat > README.md << 'EOF' | |
| --- | |
| title: Agentic Corrective RAG API | |
| emoji: π§ | |
| colorFrom: blue | |
| colorTo: purple | |
| sdk: docker | |
| pinned: false | |
| --- | |
| # Agentic Corrective RAG β Backend API | |
| Production-grade document Q&A with self-correcting agent reasoning. | |
| EOF | |
| git add . | |
| git commit -m "Auto deploy backend" || echo "No changes to commit" | |
| git push | |
| # π¨ DEPLOY UI | |
| - name: Deploy UI to HF | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| set -e | |
| git clone https://huggingface.co/spaces/Hitan2004/agentic-corrective-rag-ui hf_ui | |
| cd hf_ui | |
| git remote set-url origin https://user:${HF_TOKEN}@huggingface.co/spaces/Hitan2004/agentic-corrective-rag-ui | |
| rsync -av ../ui/ ./ | |
| cat > README.md << 'EOF' | |
| --- | |
| title: Agentic Corrective RAG UI | |
| emoji: π€ | |
| colorFrom: indigo | |
| colorTo: blue | |
| sdk: static | |
| pinned: false | |
| --- | |
| # Agentic Corrective RAG β Frontend UI | |
| Upload documents, ask questions, get grounded answers. | |
| EOF | |
| git add . | |
| git commit -m "Auto deploy UI" || echo "No changes to commit" | |
| git push | |