Tbruand commited on
Commit ·
6584b56
1
Parent(s): c1a4737
refactor(ci-cd): fusion des workflows CI et CD dans un seul fichier avec contrôle sur la branche main
Browse files
.github/workflows/ci.yml
DELETED
|
@@ -1,31 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
name: CI
|
| 4 |
-
|
| 5 |
-
on:
|
| 6 |
-
push:
|
| 7 |
-
branches: [main, dev]
|
| 8 |
-
pull_request:
|
| 9 |
-
branches: [main, dev]
|
| 10 |
-
|
| 11 |
-
jobs:
|
| 12 |
-
test:
|
| 13 |
-
runs-on: ubuntu-latest
|
| 14 |
-
|
| 15 |
-
steps:
|
| 16 |
-
- name: Checkout code
|
| 17 |
-
uses: actions/checkout@v3
|
| 18 |
-
|
| 19 |
-
- name: Set up Python
|
| 20 |
-
uses: actions/setup-python@v4
|
| 21 |
-
with:
|
| 22 |
-
python-version: '3.10'
|
| 23 |
-
|
| 24 |
-
- name: Install dependencies
|
| 25 |
-
run: |
|
| 26 |
-
python -m pip install --upgrade pip
|
| 27 |
-
pip install -r requirements.txt
|
| 28 |
-
|
| 29 |
-
- name: Run tests
|
| 30 |
-
run: |
|
| 31 |
-
pytest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.github/workflows/{cd.yml → ci_cd.yml}
RENAMED
|
@@ -1,22 +1,45 @@
|
|
| 1 |
-
name: CD - Déploiement Hugging Face Space
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
-
branches:
|
| 6 |
-
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
jobs:
|
| 10 |
-
|
| 11 |
-
|
| 12 |
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
|
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
steps:
|
| 15 |
- name: Checkout repository
|
| 16 |
uses: actions/checkout@v3
|
| 17 |
with:
|
| 18 |
fetch-depth: 0
|
| 19 |
-
lfs: true
|
| 20 |
|
| 21 |
- name: Push to Hugging Face Space
|
| 22 |
env:
|
|
|
|
| 1 |
+
name: CI/CD - Tests + Déploiement Hugging Face Space
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
+
branches: [main, dev]
|
| 6 |
+
pull_request:
|
| 7 |
+
branches: [main, dev]
|
| 8 |
+
workflow_dispatch:
|
| 9 |
|
| 10 |
jobs:
|
| 11 |
+
ci:
|
| 12 |
+
name: Run tests
|
| 13 |
runs-on: ubuntu-latest
|
| 14 |
+
steps:
|
| 15 |
+
- name: Checkout code
|
| 16 |
+
uses: actions/checkout@v3
|
| 17 |
|
| 18 |
+
- name: Set up Python
|
| 19 |
+
uses: actions/setup-python@v4
|
| 20 |
+
with:
|
| 21 |
+
python-version: '3.10'
|
| 22 |
+
|
| 23 |
+
- name: Install dependencies
|
| 24 |
+
run: |
|
| 25 |
+
python -m pip install --upgrade pip
|
| 26 |
+
pip install -r requirements.txt
|
| 27 |
+
|
| 28 |
+
- name: Run tests
|
| 29 |
+
run: |
|
| 30 |
+
pytest
|
| 31 |
+
|
| 32 |
+
deploy:
|
| 33 |
+
name: Deploy to Hugging Face Space
|
| 34 |
+
needs: ci # ✅ Lance le CD seulement si les tests passent
|
| 35 |
+
if: github.ref == 'refs/heads/main' # ✅ Ne déploie que si on est sur main
|
| 36 |
+
runs-on: ubuntu-latest
|
| 37 |
steps:
|
| 38 |
- name: Checkout repository
|
| 39 |
uses: actions/checkout@v3
|
| 40 |
with:
|
| 41 |
fetch-depth: 0
|
| 42 |
+
lfs: true
|
| 43 |
|
| 44 |
- name: Push to Hugging Face Space
|
| 45 |
env:
|