RSCE / .github /workflows /test.yml
LP1205's picture
Deploy RSCE backend to Hugging Face Space
5e952bb
Raw
History Blame Contribute Delete
1.65 kB
name: Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: write
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 -e ".[dev]" --extra-index-url https://download.pytorch.org/whl/cpu
- name: Run tests
env:
GEMINI_API_KEY: "test-key-ci"
run: |
python -m pytest tests/ -v > pytest_output.log 2>&1
STATUS=$?
cat pytest_output.log
if [ $STATUS -ne 0 ]; then
echo "### Pytest Failure Details" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat pytest_output.log >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fi
exit $STATUS
- name: Commit and push debug logs
if: failure()
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b debug-logs || git checkout debug-logs
git add -f pytest_output.log
git commit -m "Upload debug log"
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/Laaksh1205/RSCE.git debug-logs --force
- name: Upload Pytest Log
if: always()
uses: actions/upload-artifact@v4
with:
name: pytest-log
path: pytest_output.log