Spaces:
Sleeping
Sleeping
LorenzoBioinfo commited on
Commit ·
0362599
1
Parent(s): d03c48d
Update ci
Browse files- .github/workflows/ci.yml +18 -6
.github/workflows/ci.yml
CHANGED
|
@@ -13,6 +13,8 @@ jobs:
|
|
| 13 |
steps:
|
| 14 |
- name: Checkout repository
|
| 15 |
uses: actions/checkout@v4
|
|
|
|
|
|
|
| 16 |
|
| 17 |
- name: Set up Python
|
| 18 |
uses: actions/setup-python@v5
|
|
@@ -23,7 +25,8 @@ jobs:
|
|
| 23 |
run: |
|
| 24 |
python -m pip install --upgrade pip
|
| 25 |
pip install -r requirements.txt
|
| 26 |
-
pip install flake8 pytest
|
|
|
|
| 27 |
- name: Set HuggingFace token
|
| 28 |
run: echo "${{ secrets.HFREPO }}" > ~/.hf_token
|
| 29 |
|
|
@@ -42,7 +45,7 @@ jobs:
|
|
| 42 |
python src/data_preparation.py youtube
|
| 43 |
env:
|
| 44 |
HF_TOKEN: ${{ secrets.HFREPO }}
|
| 45 |
-
|
| 46 |
- name: Format code with Black
|
| 47 |
run: |
|
| 48 |
black --line-length 100 src tests
|
|
@@ -58,14 +61,23 @@ jobs:
|
|
| 58 |
pytest --maxfail=1 --disable-warnings -q
|
| 59 |
env:
|
| 60 |
HF_TOKEN: ${{ secrets.HFREPO }}
|
|
|
|
| 61 |
- name: Configure Git identity for CI
|
| 62 |
run: |
|
| 63 |
git config --global user.email "ci-bot@users.noreply.github.com"
|
| 64 |
git config --global user.name "GitHub Actions"
|
|
|
|
| 65 |
- name: Push app update to Hugging Face Space
|
| 66 |
run: |
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
env:
|
| 71 |
-
HF_TOKEN: ${{ secrets.HFREPO }}
|
|
|
|
| 13 |
steps:
|
| 14 |
- name: Checkout repository
|
| 15 |
uses: actions/checkout@v4
|
| 16 |
+
with:
|
| 17 |
+
fetch-depth: 0 # Necessario per permettere il push completo
|
| 18 |
|
| 19 |
- name: Set up Python
|
| 20 |
uses: actions/setup-python@v5
|
|
|
|
| 25 |
run: |
|
| 26 |
python -m pip install --upgrade pip
|
| 27 |
pip install -r requirements.txt
|
| 28 |
+
pip install flake8 pytest black
|
| 29 |
+
|
| 30 |
- name: Set HuggingFace token
|
| 31 |
run: echo "${{ secrets.HFREPO }}" > ~/.hf_token
|
| 32 |
|
|
|
|
| 45 |
python src/data_preparation.py youtube
|
| 46 |
env:
|
| 47 |
HF_TOKEN: ${{ secrets.HFREPO }}
|
| 48 |
+
|
| 49 |
- name: Format code with Black
|
| 50 |
run: |
|
| 51 |
black --line-length 100 src tests
|
|
|
|
| 61 |
pytest --maxfail=1 --disable-warnings -q
|
| 62 |
env:
|
| 63 |
HF_TOKEN: ${{ secrets.HFREPO }}
|
| 64 |
+
|
| 65 |
- name: Configure Git identity for CI
|
| 66 |
run: |
|
| 67 |
git config --global user.email "ci-bot@users.noreply.github.com"
|
| 68 |
git config --global user.name "GitHub Actions"
|
| 69 |
+
|
| 70 |
- name: Push app update to Hugging Face Space
|
| 71 |
run: |
|
| 72 |
+
echo "Checking for changes before pushing..."
|
| 73 |
+
if [ -n "$(git status --porcelain)" ]; then
|
| 74 |
+
echo "Changes detected — committing and pushing to Hugging Face "
|
| 75 |
+
git add .
|
| 76 |
+
git commit -m "Auto-deploy new version [skip ci]" || echo "No commit needed"
|
| 77 |
+
git pull https://user:${HF_TOKEN}@huggingface.co/spaces/Lordemarco/sentiment-fastapi main --rebase || true
|
| 78 |
+
git push https://user:${HF_TOKEN}@huggingface.co/spaces/Lordemarco/sentiment-fastapi main --force
|
| 79 |
+
else
|
| 80 |
+
echo "No changes to push "
|
| 81 |
+
fi
|
| 82 |
env:
|
| 83 |
+
HF_TOKEN: ${{ secrets.HFREPO }}
|