Tbruand commited on
Commit
45bb1f7
·
1 Parent(s): c1a4737

wip(ci-cd): version locale du workflow unifié

Browse files
Files changed (1) hide show
  1. .github/workflows/ci_cd.yml +49 -0
.github/workflows/ci_cd.yml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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:
46
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
47
+ run: |
48
+ git remote add space https://Tbruand:$HF_TOKEN@huggingface.co/spaces/Tbruand/toxicheck || true
49
+ git push space main --force