Claude commited on
Commit
8a9d482
·
unverified ·
1 Parent(s): 27355ae

feat(ci): tests CI + deploy bloqué sur tests verts

Browse files

- tests.yml : pytest sur tous les push et PR vers main
(Python 3.11, pip cache, pip install -e backend/[dev])
- deploy-hf.yml : needs: tests — le deploy n'est lancé
que si les tests passent ; réutilise tests.yml via workflow_call

https://claude.ai/code/session_018woyEHc8HG2th7V4ewJ4Kg

.github/workflows/deploy-hf.yml CHANGED
@@ -1,4 +1,5 @@
1
  # Déploiement automatique sur HuggingFace Spaces à chaque push sur main.
 
2
  #
3
  # Prérequis GitHub :
4
  # Settings → Secrets and variables → Actions → New repository secret
@@ -13,8 +14,12 @@ on:
13
  - main
14
 
15
  jobs:
 
 
 
16
  deploy:
17
  runs-on: ubuntu-latest
 
18
  env:
19
  FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true # opt-in Node.js 24 (requis dès juin 2026)
20
 
 
1
  # Déploiement automatique sur HuggingFace Spaces à chaque push sur main.
2
+ # Bloqué si le job tests échoue (needs: tests).
3
  #
4
  # Prérequis GitHub :
5
  # Settings → Secrets and variables → Actions → New repository secret
 
14
  - main
15
 
16
  jobs:
17
+ tests:
18
+ uses: ./.github/workflows/tests.yml
19
+
20
  deploy:
21
  runs-on: ubuntu-latest
22
+ needs: tests
23
  env:
24
  FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true # opt-in Node.js 24 (requis dès juin 2026)
25
 
.github/workflows/tests.yml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Tests CI — déclenché sur tous les push et les PR vers main.
2
+ #
3
+ # Aucun secret requis : tous les tests sont mockés (pas d'appel Google AI réel).
4
+
5
+ name: Tests
6
+
7
+ on:
8
+ push:
9
+ pull_request:
10
+ branches:
11
+ - main
12
+
13
+ jobs:
14
+ tests:
15
+ runs-on: ubuntu-latest
16
+ env:
17
+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true # opt-in Node.js 24 (requis dès juin 2026)
18
+
19
+ steps:
20
+ - name: Checkout repository
21
+ uses: actions/checkout@v4
22
+
23
+ - name: Setup Python 3.11
24
+ uses: actions/setup-python@v5
25
+ with:
26
+ python-version: "3.11"
27
+ cache: "pip"
28
+ cache-dependency-path: "backend/pyproject.toml"
29
+
30
+ - name: Install backend with dev dependencies
31
+ run: pip install -e "backend/[dev]"
32
+
33
+ - name: Run tests
34
+ run: pytest backend/tests/ --tb=short -q