Spaces:
Running
Running
chaton59
commited on
Commit
·
06ab9e0
1
Parent(s):
b240f2b
Fix: Appliquer formatage Black, mise à jour deps Poetry et YAML CI/CD
Browse files- .github/workflows/ci-cd.yml +32 -30
- app.py +3 -1
- poetry.lock +11 -11
- pyproject.toml +3 -1
- tests/test_basic.py +1 -1
.github/workflows/ci-cd.yml
CHANGED
|
@@ -1,38 +1,40 @@
|
|
| 1 |
-
name: CI/CD Pipeline
|
| 2 |
-
|
| 3 |
-
on: # Triggers du plan : push/PR pour isolation envs
|
| 4 |
push:
|
| 5 |
-
branches: [
|
| 6 |
pull_request:
|
| 7 |
-
branches: [main]
|
| 8 |
|
| 9 |
jobs:
|
| 10 |
-
test:
|
| 11 |
-
runs-on: ubuntu-latest
|
| 12 |
steps:
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
deploy: # Job CD : Déploiement (après test OK, conditionnel)
|
| 38 |
needs: test # Dépend CI (séquentiel plan)
|
|
|
|
| 1 |
+
name: CI/CD Pipeline
|
| 2 |
+
on:
|
|
|
|
| 3 |
push:
|
| 4 |
+
branches: [ main, dev ]
|
| 5 |
pull_request:
|
| 6 |
+
branches: [ main ]
|
| 7 |
|
| 8 |
jobs:
|
| 9 |
+
test:
|
| 10 |
+
runs-on: ubuntu-latest
|
| 11 |
steps:
|
| 12 |
+
- uses: actions/checkout@v4 # Mise à jour pour v4, plus récente
|
| 13 |
+
- name: Set up Python
|
| 14 |
+
uses: actions/setup-python@v5 # v5 pour compatibilité
|
| 15 |
+
with:
|
| 16 |
+
python-version: '3.10' # Adapte à ton projet (ex. pour FastAPI)
|
| 17 |
+
- name: Install Poetry
|
| 18 |
+
uses: snok/install-poetry@v1
|
| 19 |
+
with:
|
| 20 |
+
version: 1.8.3 # Dernière stable (vérifie poetry.io pour update)
|
| 21 |
+
virtualenvs-create: true
|
| 22 |
+
virtualenvs-in-project: true # Crée .venv dans repo pour cache
|
| 23 |
+
- name: Cache Poetry virtualenv
|
| 24 |
+
uses: actions/cache@v4
|
| 25 |
+
id: cache
|
| 26 |
+
with:
|
| 27 |
+
path: .venv
|
| 28 |
+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} # Cache basé sur lockfile
|
| 29 |
+
- name: Install dependencies
|
| 30 |
+
if: steps.cache.outputs.cache-hit != 'true' # Installe si pas cached
|
| 31 |
+
run: poetry install --no-interaction --no-root # --no-root évite install package principal si besoin
|
| 32 |
+
- name: Lint code
|
| 33 |
+
run: |
|
| 34 |
+
poetry run black --check .
|
| 35 |
+
poetry run flake8 . # Si utilisé
|
| 36 |
+
- name: Run tests
|
| 37 |
+
run: poetry run pytest --cov # Avec couverture, lien étape 5
|
| 38 |
|
| 39 |
deploy: # Job CD : Déploiement (après test OK, conditionnel)
|
| 40 |
needs: test # Dépend CI (séquentiel plan)
|
app.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
from fastapi import FastAPI
|
|
|
|
| 2 |
app = FastAPI()
|
| 3 |
|
|
|
|
| 4 |
@app.get("/")
|
| 5 |
def root():
|
| 6 |
-
return {"status": "Hello World"}
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
|
| 3 |
app = FastAPI()
|
| 4 |
|
| 5 |
+
|
| 6 |
@app.get("/")
|
| 7 |
def root():
|
| 8 |
+
return {"status": "Hello World"}
|
poetry.lock
CHANGED
|
@@ -49,7 +49,7 @@ version = "25.11.0"
|
|
| 49 |
description = "The uncompromising code formatter."
|
| 50 |
optional = false
|
| 51 |
python-versions = ">=3.9"
|
| 52 |
-
groups = ["main"]
|
| 53 |
files = [
|
| 54 |
{file = "black-25.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ec311e22458eec32a807f029b2646f661e6859c3f61bc6d9ffb67958779f392e"},
|
| 55 |
{file = "black-25.11.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1032639c90208c15711334d681de2e24821af0575573db2810b0763bcd62e0f0"},
|
|
@@ -99,7 +99,7 @@ version = "8.3.1"
|
|
| 99 |
description = "Composable command line interface toolkit"
|
| 100 |
optional = false
|
| 101 |
python-versions = ">=3.10"
|
| 102 |
-
groups = ["main"]
|
| 103 |
files = [
|
| 104 |
{file = "click-8.3.1-py3-none-any.whl", hash = "sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6"},
|
| 105 |
{file = "click-8.3.1.tar.gz", hash = "sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a"},
|
|
@@ -115,11 +115,11 @@ description = "Cross-platform colored terminal text."
|
|
| 115 |
optional = false
|
| 116 |
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
|
| 117 |
groups = ["main", "dev"]
|
|
|
|
| 118 |
files = [
|
| 119 |
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
|
| 120 |
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
|
| 121 |
]
|
| 122 |
-
markers = {main = "platform_system == \"Windows\" or sys_platform == \"win32\"", dev = "sys_platform == \"win32\""}
|
| 123 |
|
| 124 |
[[package]]
|
| 125 |
name = "coverage"
|
|
@@ -255,7 +255,7 @@ version = "7.3.0"
|
|
| 255 |
description = "the modular source code checker: pep8 pyflakes and co"
|
| 256 |
optional = false
|
| 257 |
python-versions = ">=3.9"
|
| 258 |
-
groups = ["main"]
|
| 259 |
files = [
|
| 260 |
{file = "flake8-7.3.0-py2.py3-none-any.whl", hash = "sha256:b9696257b9ce8beb888cdbe31cf885c90d31928fe202be0889a7cdafad32f01e"},
|
| 261 |
{file = "flake8-7.3.0.tar.gz", hash = "sha256:fe044858146b9fc69b551a4b490d69cf960fcb78ad1edcb84e7fbb1b4a8e3872"},
|
|
@@ -445,7 +445,7 @@ version = "0.7.0"
|
|
| 445 |
description = "McCabe checker, plugin for flake8"
|
| 446 |
optional = false
|
| 447 |
python-versions = ">=3.6"
|
| 448 |
-
groups = ["main"]
|
| 449 |
files = [
|
| 450 |
{file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"},
|
| 451 |
{file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"},
|
|
@@ -457,7 +457,7 @@ version = "1.1.0"
|
|
| 457 |
description = "Type system extensions for programs checked with the mypy type checker."
|
| 458 |
optional = false
|
| 459 |
python-versions = ">=3.8"
|
| 460 |
-
groups = ["main"]
|
| 461 |
files = [
|
| 462 |
{file = "mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505"},
|
| 463 |
{file = "mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558"},
|
|
@@ -481,7 +481,7 @@ version = "0.12.1"
|
|
| 481 |
description = "Utility library for gitignore style pattern matching of file paths."
|
| 482 |
optional = false
|
| 483 |
python-versions = ">=3.8"
|
| 484 |
-
groups = ["main"]
|
| 485 |
files = [
|
| 486 |
{file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"},
|
| 487 |
{file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"},
|
|
@@ -493,7 +493,7 @@ version = "4.5.0"
|
|
| 493 |
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."
|
| 494 |
optional = false
|
| 495 |
python-versions = ">=3.10"
|
| 496 |
-
groups = ["main"]
|
| 497 |
files = [
|
| 498 |
{file = "platformdirs-4.5.0-py3-none-any.whl", hash = "sha256:e578a81bb873cbb89a41fcc904c7ef523cc18284b7e3b3ccf06aca1403b7ebd3"},
|
| 499 |
{file = "platformdirs-4.5.0.tar.gz", hash = "sha256:70ddccdd7c99fc5942e9fc25636a8b34d04c24b335100223152c2803e4063312"},
|
|
@@ -526,7 +526,7 @@ version = "2.14.0"
|
|
| 526 |
description = "Python style guide checker"
|
| 527 |
optional = false
|
| 528 |
python-versions = ">=3.9"
|
| 529 |
-
groups = ["main"]
|
| 530 |
files = [
|
| 531 |
{file = "pycodestyle-2.14.0-py2.py3-none-any.whl", hash = "sha256:dd6bf7cb4ee77f8e016f9c8e74a35ddd9f67e1d5fd4184d86c3b98e07099f42d"},
|
| 532 |
{file = "pycodestyle-2.14.0.tar.gz", hash = "sha256:c4b5b517d278089ff9d0abdec919cd97262a3367449ea1c8b49b91529167b783"},
|
|
@@ -694,7 +694,7 @@ version = "3.4.0"
|
|
| 694 |
description = "passive checker of Python programs"
|
| 695 |
optional = false
|
| 696 |
python-versions = ">=3.9"
|
| 697 |
-
groups = ["main"]
|
| 698 |
files = [
|
| 699 |
{file = "pyflakes-3.4.0-py2.py3-none-any.whl", hash = "sha256:f742a7dbd0d9cb9ea41e9a24a918996e8170c799fa528688d40dd582c8265f4f"},
|
| 700 |
{file = "pyflakes-3.4.0.tar.gz", hash = "sha256:b24f96fafb7d2ab0ec5075b7350b3d2d2218eab42003821c06344973d3ea2f58"},
|
|
@@ -778,7 +778,7 @@ version = "0.3.0"
|
|
| 778 |
description = "A Fast, spec compliant Python 3.14+ tokenizer that runs on older Pythons."
|
| 779 |
optional = false
|
| 780 |
python-versions = ">=3.8"
|
| 781 |
-
groups = ["main"]
|
| 782 |
files = [
|
| 783 |
{file = "pytokens-0.3.0-py3-none-any.whl", hash = "sha256:95b2b5eaf832e469d141a378872480ede3f251a5a5041b8ec6e581d3ac71bbf3"},
|
| 784 |
{file = "pytokens-0.3.0.tar.gz", hash = "sha256:2f932b14ed08de5fcf0b391ace2642f858f1394c0857202959000b68ed7a458a"},
|
|
|
|
| 49 |
description = "The uncompromising code formatter."
|
| 50 |
optional = false
|
| 51 |
python-versions = ">=3.9"
|
| 52 |
+
groups = ["main", "dev"]
|
| 53 |
files = [
|
| 54 |
{file = "black-25.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ec311e22458eec32a807f029b2646f661e6859c3f61bc6d9ffb67958779f392e"},
|
| 55 |
{file = "black-25.11.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1032639c90208c15711334d681de2e24821af0575573db2810b0763bcd62e0f0"},
|
|
|
|
| 99 |
description = "Composable command line interface toolkit"
|
| 100 |
optional = false
|
| 101 |
python-versions = ">=3.10"
|
| 102 |
+
groups = ["main", "dev"]
|
| 103 |
files = [
|
| 104 |
{file = "click-8.3.1-py3-none-any.whl", hash = "sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6"},
|
| 105 |
{file = "click-8.3.1.tar.gz", hash = "sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a"},
|
|
|
|
| 115 |
optional = false
|
| 116 |
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
|
| 117 |
groups = ["main", "dev"]
|
| 118 |
+
markers = "platform_system == \"Windows\" or sys_platform == \"win32\""
|
| 119 |
files = [
|
| 120 |
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
|
| 121 |
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
|
| 122 |
]
|
|
|
|
| 123 |
|
| 124 |
[[package]]
|
| 125 |
name = "coverage"
|
|
|
|
| 255 |
description = "the modular source code checker: pep8 pyflakes and co"
|
| 256 |
optional = false
|
| 257 |
python-versions = ">=3.9"
|
| 258 |
+
groups = ["main", "dev"]
|
| 259 |
files = [
|
| 260 |
{file = "flake8-7.3.0-py2.py3-none-any.whl", hash = "sha256:b9696257b9ce8beb888cdbe31cf885c90d31928fe202be0889a7cdafad32f01e"},
|
| 261 |
{file = "flake8-7.3.0.tar.gz", hash = "sha256:fe044858146b9fc69b551a4b490d69cf960fcb78ad1edcb84e7fbb1b4a8e3872"},
|
|
|
|
| 445 |
description = "McCabe checker, plugin for flake8"
|
| 446 |
optional = false
|
| 447 |
python-versions = ">=3.6"
|
| 448 |
+
groups = ["main", "dev"]
|
| 449 |
files = [
|
| 450 |
{file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"},
|
| 451 |
{file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"},
|
|
|
|
| 457 |
description = "Type system extensions for programs checked with the mypy type checker."
|
| 458 |
optional = false
|
| 459 |
python-versions = ">=3.8"
|
| 460 |
+
groups = ["main", "dev"]
|
| 461 |
files = [
|
| 462 |
{file = "mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505"},
|
| 463 |
{file = "mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558"},
|
|
|
|
| 481 |
description = "Utility library for gitignore style pattern matching of file paths."
|
| 482 |
optional = false
|
| 483 |
python-versions = ">=3.8"
|
| 484 |
+
groups = ["main", "dev"]
|
| 485 |
files = [
|
| 486 |
{file = "pathspec-0.12.1-py3-none-any.whl", hash = "sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08"},
|
| 487 |
{file = "pathspec-0.12.1.tar.gz", hash = "sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712"},
|
|
|
|
| 493 |
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."
|
| 494 |
optional = false
|
| 495 |
python-versions = ">=3.10"
|
| 496 |
+
groups = ["main", "dev"]
|
| 497 |
files = [
|
| 498 |
{file = "platformdirs-4.5.0-py3-none-any.whl", hash = "sha256:e578a81bb873cbb89a41fcc904c7ef523cc18284b7e3b3ccf06aca1403b7ebd3"},
|
| 499 |
{file = "platformdirs-4.5.0.tar.gz", hash = "sha256:70ddccdd7c99fc5942e9fc25636a8b34d04c24b335100223152c2803e4063312"},
|
|
|
|
| 526 |
description = "Python style guide checker"
|
| 527 |
optional = false
|
| 528 |
python-versions = ">=3.9"
|
| 529 |
+
groups = ["main", "dev"]
|
| 530 |
files = [
|
| 531 |
{file = "pycodestyle-2.14.0-py2.py3-none-any.whl", hash = "sha256:dd6bf7cb4ee77f8e016f9c8e74a35ddd9f67e1d5fd4184d86c3b98e07099f42d"},
|
| 532 |
{file = "pycodestyle-2.14.0.tar.gz", hash = "sha256:c4b5b517d278089ff9d0abdec919cd97262a3367449ea1c8b49b91529167b783"},
|
|
|
|
| 694 |
description = "passive checker of Python programs"
|
| 695 |
optional = false
|
| 696 |
python-versions = ">=3.9"
|
| 697 |
+
groups = ["main", "dev"]
|
| 698 |
files = [
|
| 699 |
{file = "pyflakes-3.4.0-py2.py3-none-any.whl", hash = "sha256:f742a7dbd0d9cb9ea41e9a24a918996e8170c799fa528688d40dd582c8265f4f"},
|
| 700 |
{file = "pyflakes-3.4.0.tar.gz", hash = "sha256:b24f96fafb7d2ab0ec5075b7350b3d2d2218eab42003821c06344973d3ea2f58"},
|
|
|
|
| 778 |
description = "A Fast, spec compliant Python 3.14+ tokenizer that runs on older Pythons."
|
| 779 |
optional = false
|
| 780 |
python-versions = ">=3.8"
|
| 781 |
+
groups = ["main", "dev"]
|
| 782 |
files = [
|
| 783 |
{file = "pytokens-0.3.0-py3-none-any.whl", hash = "sha256:95b2b5eaf832e469d141a378872480ede3f251a5a5041b8ec6e581d3ac71bbf3"},
|
| 784 |
{file = "pytokens-0.3.0.tar.gz", hash = "sha256:2f932b14ed08de5fcf0b391ace2642f858f1394c0857202959000b68ed7a458a"},
|
pyproject.toml
CHANGED
|
@@ -28,5 +28,7 @@ packages = [{include = "src"}]
|
|
| 28 |
|
| 29 |
[dependency-groups]
|
| 30 |
dev = [
|
| 31 |
-
"pytest (>=9.0.1,<10.0.0)"
|
|
|
|
|
|
|
| 32 |
]
|
|
|
|
| 28 |
|
| 29 |
[dependency-groups]
|
| 30 |
dev = [
|
| 31 |
+
"pytest (>=9.0.1,<10.0.0)",
|
| 32 |
+
"black (>=25.11.0,<26.0.0)",
|
| 33 |
+
"flake8 (>=7.3.0,<8.0.0)"
|
| 34 |
]
|
tests/test_basic.py
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
def test_pipeline_placeholder():
|
| 2 |
"""Test basique pour CI/CD (POC étape 2 ; évolutif étape 5)."""
|
| 3 |
-
assert True # Succès simple ; ajoute cas ML (Pydantic/validation) plus tard
|
|
|
|
| 1 |
def test_pipeline_placeholder():
|
| 2 |
"""Test basique pour CI/CD (POC étape 2 ; évolutif étape 5)."""
|
| 3 |
+
assert True # Succès simple ; ajoute cas ML (Pydantic/validation) plus tard
|