Spaces:
Sleeping
Sleeping
Reem commited on
Commit ·
f00f88d
1
Parent(s): 137c887
test-old-push_to_hf_space.yml
Browse files
.github/workflows/push_to_hf_space.yml
CHANGED
|
@@ -1,81 +1,20 @@
|
|
| 1 |
name: Sync to Hugging Face hub
|
| 2 |
-
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
branches: [main]
|
| 6 |
|
|
|
|
| 7 |
workflow_dispatch:
|
| 8 |
|
| 9 |
jobs:
|
| 10 |
sync-to-hub:
|
| 11 |
runs-on: ubuntu-latest
|
| 12 |
-
|
| 13 |
steps:
|
| 14 |
- uses: actions/checkout@v3
|
| 15 |
with:
|
| 16 |
fetch-depth: 0
|
| 17 |
lfs: true
|
| 18 |
-
|
| 19 |
-
# -------------------------
|
| 20 |
-
# 1. Set up Python
|
| 21 |
-
# -------------------------
|
| 22 |
-
- name: Set up Python
|
| 23 |
-
uses: actions/setup-python@v4
|
| 24 |
-
with:
|
| 25 |
-
python-version: '3.10'
|
| 26 |
-
|
| 27 |
-
# -------------------------
|
| 28 |
-
# 2. Install dependencies
|
| 29 |
-
# -------------------------
|
| 30 |
-
- name: Install dependencies
|
| 31 |
-
run: |
|
| 32 |
-
pip install --upgrade pip
|
| 33 |
-
pip install flake8 nbqa
|
| 34 |
-
|
| 35 |
-
# -------------------------
|
| 36 |
-
# 3. Lint Python files
|
| 37 |
-
# -------------------------
|
| 38 |
-
- name: Lint .py files
|
| 39 |
-
run: |
|
| 40 |
-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
| 41 |
-
|
| 42 |
-
# -------------------------
|
| 43 |
-
# 4. Lint notebooks with nbQA
|
| 44 |
-
# This checks .ipynb files
|
| 45 |
-
# -------------------------
|
| 46 |
-
- name: Lint notebooks
|
| 47 |
-
run: |
|
| 48 |
-
nbqa flake8 .
|
| 49 |
-
|
| 50 |
-
# -------------------------
|
| 51 |
-
# 5. Block problematic files
|
| 52 |
-
# -------------------------
|
| 53 |
-
- name: Check for restricted file types
|
| 54 |
-
run: |
|
| 55 |
-
if git diff --name-only HEAD~1 | grep -E '\.(pdf|xlsx)$'; then
|
| 56 |
-
echo "❌ PDF/XLSX files detected. These break HuggingFace sync."
|
| 57 |
-
exit 1
|
| 58 |
-
fi
|
| 59 |
-
|
| 60 |
-
# -------------------------
|
| 61 |
-
# 6. Placeholder for unit tests
|
| 62 |
-
# -------------------------
|
| 63 |
-
# - name: Run unit tests (placeholder)
|
| 64 |
-
# run: |
|
| 65 |
-
# echo "No tests implemented yet — placeholder step."
|
| 66 |
-
# echo "This will later run pytest."
|
| 67 |
-
|
| 68 |
-
# this is the completed test step
|
| 69 |
-
- name: Run unit tests
|
| 70 |
-
run: |
|
| 71 |
-
pip install pytest
|
| 72 |
-
pytest A4/ -v --tb=short
|
| 73 |
-
|
| 74 |
-
# -------------------------
|
| 75 |
-
# 7. Push to HuggingFace
|
| 76 |
-
# -------------------------
|
| 77 |
- name: Push to hub
|
| 78 |
env:
|
| 79 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 80 |
-
run:
|
| 81 |
-
git push -f https://Bachstelze:$HF_TOKEN@huggingface.co/spaces/Bachstelze/github_sync main
|
|
|
|
| 1 |
name: Sync to Hugging Face hub
|
|
|
|
| 2 |
on:
|
| 3 |
push:
|
| 4 |
branches: [main]
|
| 5 |
|
| 6 |
+
# to run this workflow manually from the Actions tab
|
| 7 |
workflow_dispatch:
|
| 8 |
|
| 9 |
jobs:
|
| 10 |
sync-to-hub:
|
| 11 |
runs-on: ubuntu-latest
|
|
|
|
| 12 |
steps:
|
| 13 |
- uses: actions/checkout@v3
|
| 14 |
with:
|
| 15 |
fetch-depth: 0
|
| 16 |
lfs: true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
- name: Push to hub
|
| 18 |
env:
|
| 19 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 20 |
+
run: git push -f https://Bachstelze:$HF_TOKEN@huggingface.co/spaces/Bachstelze/github_sync main
|
|
|