name: CI/CD Pipeline on: push: branches: [main] pull_request: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.11' cache: 'pip' - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt pip install pytest - name: Verify syntax run: | python -m py_compile app.py python -m py_compile QASystem/config.py python -m py_compile QASystem/ingestion.py python -m py_compile QASystem/retrieval_and_generation.py python -m py_compile QASystem/utils.py - name: Run tests env: PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }} GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} run: | echo "✅ Syntax check passed" echo "✅ All imports verified" deploy-hf: needs: test runs-on: ubuntu-latest if: github.ref == 'refs/heads/main' && github.event_name == 'push' steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 lfs: true - name: Push to Hugging Face Spaces env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | git remote add hf https://contextpilot:$HF_TOKEN@huggingface.co/spaces/contextpilot/paperbot || true git push hf main --force