Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
# ─────────────────────────────────────────────────────────────────────────
# CI — Moteur Multi-Agents
# Lint (ruff, informatif) + tests (pytest). Config : pyproject.toml
# CI — vromvrom-engine (miroir public)
# Lint (ruff, informatif) + scan anti-fuite (bloquant) + pytest.
# Branche par défaut : main. Les mises à jour passent par PR.
# ─────────────────────────────────────────────────────────────────────────
name: CI

on:
push:
branches: [master] # post-merge uniquement (les branches passent via pull_request)
branches: [main]
pull_request:
branches: [main]

# Annule les runs précédents encore en cours sur la même réf.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
oss-secrets-scan:
name: 🔒 OSS secrets scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Scan IP LAN / tokens / clés
run: python scripts/oss_secrets_scan.py

lint:
name: 🔍 Ruff (informatif)
runs-on: ubuntu-latest
Expand All @@ -25,8 +40,7 @@ jobs:
python-version: "3.11"
- name: Installer ruff
run: pip install "ruff>=0.6.0"
# NON bloquant : dette ruff legacy (~320 violations). Voir plan de remédiation
# (item nettoyage lint). Retirer les `continue-on-error` une fois résorbée.
# NON bloquant : dette ruff legacy. Retirer continue-on-error une fois résorbée.
- name: ruff check
run: ruff check . --output-format=github
continue-on-error: true
Expand All @@ -37,6 +51,7 @@ jobs:
tests:
name: 🧪 Pytest
runs-on: ubuntu-latest
needs: [oss-secrets-scan]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
Expand All @@ -48,6 +63,9 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt -r requirements-dev.txt
- name: Seed des bases (modèles)
run: python seed_models_db.py
run: |
cp ha_commands.json.example ha_commands.json
cp pricing_strategy.json.example pricing_strategy.json
python seed_models_db.py
- name: pytest
run: pytest --tb=short -q
17 changes: 11 additions & 6 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ name: Python CI & Security

on:
pull_request:
branches: [ master ]
branches: [main]
push:
branches: [main]

permissions:
contents: read

jobs:
test-and-scan:
name: test-and-scan
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -24,18 +27,20 @@ jobs:
python -m pip install --upgrade pip
pip install bandit flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# requirements-dev.txt : pytest, pytest-asyncio, paramiko (requis par test_failover), etc.
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi

- name: Security Scan (Bandit)
run: |
bandit -r . -f custom -c pyproject.toml || true
# On ne bloque pas la CI pour Bandit au début, juste un warning

- name: OSS secrets / LAN IP scan (bloquant)
run: python scripts/oss_secrets_scan.py

- name: Seed models registry DB
# Peuple models_registry.db à partir du catalogue statique (aucun secret/réseau requis).
# Requis par tests/test_models_db.py qui asserte l'existence et le contenu de la base.
run: python seed_models_db.py
run: |
cp ha_commands.json.example ha_commands.json
cp pricing_strategy.json.example pricing_strategy.json
python seed_models_db.py

- name: Run Pytest
run: |
Expand Down
19 changes: 16 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contribuer à vromvrom-engine
# Contribuer à vromvrom-engine

Merci de vouloir contribuer ! Ce projet est né d'un besoin personnel en domotique et a évolué vers quelque chose de potentiellement utile pour la communauté. Toute aide est bienvenue.

Expand All @@ -9,6 +9,9 @@ Merci de vouloir contribuer ! Ce projet est né d'un besoin personnel en domotiq

## Workflow

**Toute mise à jour de `main` passe par une Pull Request** (branche protégée) :
CI obligatoire = scan anti-fuite OSS + pytest (+ Bandit informatif).

```bash
# Forker le repo, puis :
git clone https://github.com/<votre-username>/vromvrom-engine.git
Expand All @@ -22,15 +25,25 @@ git checkout -b fix/nom-du-bug
# Installer les dépendances de dev
pip install -r requirements-dev.txt

# Travailler, puis lancer les tests
# Travailler, puis lancer les vérifs locales
python scripts/oss_secrets_scan.py
pytest

# Committer (convention Conventional Commits)
git commit -m "feat(router): add OpenAI-compatible provider"

# Ouvrir une PR sur GitHub
# Pousser la branche et ouvrir une PR → attendre le CI vert → merge
```

### Mainteneurs — sync depuis le miroir privé

Ne **jamais** pousser directement sur `main`. Flux :

1. Exporter / anonymiser (IP `192.168.0.x` → placeholders, aucun token/clé).
2. Branche `sync/…` + PR.
3. CI vert (`🔒 OSS secrets scan`, `🧪 Pytest`, `test-and-scan`).
4. Merge de la PR uniquement.

## Conventions de code

- **Python 3.11+** — typage strict avec annotations
Expand Down
Loading
Loading