Spaces:
Sleeping
Sleeping
| name: Sync to Hugging Face Hub | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| sync-to-hub: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| lfs: true | |
| - name: Configure Git identity | |
| run: | | |
| git config --global user.name "Andrchest" | |
| git config --global user.email "andreipolevoi220@gmail.com" | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r app/requirements.txt # Adjust to app/requirements.txt if needed | |
| - name: Push to HF1 | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| git checkout -b hf1-single-commit | |
| git reset --soft $(git rev-list --max-parents=0 HEAD) | |
| git commit -m "Single commit for HF1" | |
| git remote add hf1 https://Andrchest:$HF_TOKEN@huggingface.co/spaces/Andrchest/RAG-Integration-test | |
| git push --force hf1 hf1-single-commit:main | |
| - name: Wait for HF1 deployment | |
| run: sleep 300 # Adjust based on deployment time | |
| - name: Run integration tests on HF1 | |
| env: | |
| HF1_URL: https://andrchest-rag-integration-test.hf.space # Replace with actual HF1 URL | |
| run: | | |
| pytest app/tests/integration/test.py -v | |
| - name: Push to HF2 if tests pass | |
| if: success() | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| git checkout -b hf2-single-commit | |
| git reset --soft $(git rev-list --max-parents=0 HEAD) | |
| git commit -m "Single commit for HF2" | |
| git remote add hf2 https://Andrchest:$HF_TOKEN@huggingface.co/spaces/Andrchest/The-Ultimate-RAG | |
| git push --force hf2 hf2-single-commit:main |