From f0075589ec670b96583daad6fa1843ab7b492587 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 4 Jun 2026 14:03:14 +0200 Subject: [PATCH 01/34] feat: add GitHub Actions workflow for Hello NexaCloud --- .github/workflows/hello.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/hello.yml diff --git a/.github/workflows/hello.yml b/.github/workflows/hello.yml new file mode 100644 index 0000000..9af02f1 --- /dev/null +++ b/.github/workflows/hello.yml @@ -0,0 +1,27 @@ +name: Hello NexaCloud + +on: + push: + branches: [main] + workflow_dispatch: # permet de déclencher manuellement depuis l'interface GitHub + +jobs: + salutation: + runs-on: ubuntu-latest + + steps: + - name: Checkout du code + uses: actions/checkout@v4 + + - name: Informations sur l'environnement + run: | + echo "Repo : ${{ github.repository }}" + echo "Branche : ${{ github.ref_name }}" + echo "Commit : ${{ github.sha }}" + echo "Acteur : ${{ github.actor }}" + + - name: Date + run: date + + - name: Lister les fichiers du repo + run: ls -la \ No newline at end of file From 583c0f499719f48ea00d331556379b3ef8ac7d0e Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 4 Jun 2026 14:27:04 +0200 Subject: [PATCH 02/34] =?UTF-8?q?feat:=20premier=20commit=20=E2=80=94=20ac?= =?UTF-8?q?tivation=20de=20la=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notes.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 notes.md diff --git a/notes.md b/notes.md new file mode 100644 index 0000000..2c821cd --- /dev/null +++ b/notes.md @@ -0,0 +1 @@ +# Mon TP GitHub Actions From 8726390581757b639092ef910e3aea81eb41a83e Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 4 Jun 2026 14:30:15 +0200 Subject: [PATCH 03/34] feat: add compiled Python files for app and test with CI/CD integration --- README.md | 2 +- ressources/__pycache__/app.cpython-314.pyc | Bin 0 -> 1673 bytes .../test_app.cpython-314-pytest-8.2.0.pyc | Bin 0 -> 10552 bytes 3 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 ressources/__pycache__/app.cpython-314.pyc create mode 100644 ressources/__pycache__/test_app.cpython-314-pytest-8.2.0.pyc diff --git a/README.md b/README.md index 4abe121..3d443b2 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ Dans VS Code, vous pouvez aussi faire `Ctrl+Shift+P` → taper `Git: Open Settin ### Étape E — Installer les dépendances et vérifier l'environnement -Ouvrez un **terminal intégré** dans VS Code : menu **Terminal → New Terminal** (ou `` Ctrl+` ``). +Ouvrez un **terminal intégré** dans VS Code : menu **Terminal → New Terminal** (olsu `` Ctrl+` ``). ```bash # Vérifier que vous êtes bien dans le bon dossier diff --git a/ressources/__pycache__/app.cpython-314.pyc b/ressources/__pycache__/app.cpython-314.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9c6bb8fbb623dd55e32759029b312973982207a7 GIT binary patch literal 1673 zcmZ`(%}*Og6rb4-+jwn5pa~_AvIL~ow84!UDd|@zg$9rcr4vAjWLPcs02|i3tC?LI zxYSW9#ko`*a^RRtrR3H>p;9kB^kB(tg+{&f;}0<6&}(OAZDJzvq7e zTs953{IEUpAW#ALM;zLcYHdy?AOKZ>KnT_Wg7a`r36(iDRENQuG6L4L8ypuB>PT7t z9;xd?NL$Y!eO)bRVPZ{R>W=YFjS_7yl3) zIknDqSQ~2^%H6sLK=~2?LxB4Zbn=h)s2la53pbVcGz?Jhs9gEJ$mQSCb`VSid*yt#-U+S9HdmD3B3=g3cYT$}EgQRui1{rM#}OMa!owX@-3vmBX$6JXczusJ9gcFHt`&9i|LpU zpRiPkIH6OrT?PxK&Xh#I`3!)QF|Mkh*y<|aoktKUNJSdb3u?PsqadGP2^!jAM4966 zuq4G~*D2xs>}j4NMV8#fgmRMm`t^zH6Ysx-MBMTcoNx`;r_&!5SGXrFevUor7H2Ts z3H_j0#=Cw%i(znW%L%umjca=qw@5Ihend)`7UR+~-SNu!A?f9z`uL)kxvGMHjoyQ~ z!}9a_7vKKW^~=qA-`$3>T-TOK4~O@Yg>7uR;r5yAHIB&ahh&7a*%x3()(R1Ch9%=5 zdnCtCM2xtMPA&*A5rgC+KfK8o6$IP7oO<6o4I^LI@-d%m!S%Ojfku^zP4>>P5{x7( zQ~JMRRcy^103FQWVqTHOWyY6Z&02R?78a(^{nxo=#BEmVHX_(v;frSF4ZL#CK5iJp zb!|8%my5}@hvp2s1b30_W~6VC>sSzYPc)(>0a)dKj$7XW5Wu3amxACbK*}mCC> z$n+nkf6t6ozc|YF9(?`ue)Z0uMsNL%vFG^3y&re$eYYFNWL=w->9dq&RcyzztYzmZ zA24xi8E-^eObdJxF6Of=X<22zWLZq#6mOXbCUFzEuV+^1`x z(y}#jq!~4Iq~#7^vrF$*sz$R1DEgCuM+3DF9=~<0K)3==RG{=U<(9j)&<`8%qJYN* zdP$(;ufWL$92B4_z###er(oR}Y``Hw>oXboN>gr|8K7lq`@g9JM_Tg9?4#L(vBTx+ P>>t|IV-;wZWu5;AKu%^_ literal 0 HcmV?d00001 diff --git a/ressources/__pycache__/test_app.cpython-314-pytest-8.2.0.pyc b/ressources/__pycache__/test_app.cpython-314-pytest-8.2.0.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b3576dfa74af7b212b02087efb60ef786e756c99 GIT binary patch literal 10552 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 Date: Thu, 4 Jun 2026 14:41:00 +0200 Subject: [PATCH 04/34] feat: update GitHub Actions workflow to include runner date and time --- .github/workflows/hello.yml | 10 +++++----- README.md | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/hello.yml b/.github/workflows/hello.yml index 9af02f1..2a00536 100644 --- a/.github/workflows/hello.yml +++ b/.github/workflows/hello.yml @@ -3,7 +3,7 @@ name: Hello NexaCloud on: push: branches: [main] - workflow_dispatch: # permet de déclencher manuellement depuis l'interface GitHub + workflow_dispatch: jobs: salutation: @@ -20,8 +20,8 @@ jobs: echo "Commit : ${{ github.sha }}" echo "Acteur : ${{ github.actor }}" - - name: Date - run: date - - name: Lister les fichiers du repo - run: ls -la \ No newline at end of file + run: ls -la + + - name: Date et heure du runner + run: date \ No newline at end of file diff --git a/README.md b/README.md index 3d443b2..4abe121 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ Dans VS Code, vous pouvez aussi faire `Ctrl+Shift+P` → taper `Git: Open Settin ### Étape E — Installer les dépendances et vérifier l'environnement -Ouvrez un **terminal intégré** dans VS Code : menu **Terminal → New Terminal** (olsu `` Ctrl+` ``). +Ouvrez un **terminal intégré** dans VS Code : menu **Terminal → New Terminal** (ou `` Ctrl+` ``). ```bash # Vérifier que vous êtes bien dans le bon dossier From 2ce421957a72f018ce83e652d442d8cc89adea71 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 4 Jun 2026 15:04:09 +0200 Subject: [PATCH 05/34] feat: update CI workflow name and refine job steps for NexaCloud API --- .github/workflows/ci.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a27357..8d14114 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,24 @@ -name: CI +name: CI — NexaCloud API on: push: - branches: [ "main" ] + branches: [main] pull_request: - branches: [ "main" ] + branches: [main] jobs: - build: + test: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Checkout uses: actions/checkout@v4 - - name: Example step - run: echo "Add your build/test steps here!" + # TODO: ajouter un step "Setup Python" avec actions/setup-python@v5 + # version : "3.11" + + # TODO: ajouter un step "Installer les dépendances" + # commande : pip install -r ressources/requirements.txt + + # TODO: ajouter un step "Lancer les tests" + # commande : pytest ressources/ -v \ No newline at end of file From 7027e9293f7ccc1da8862823fcfaaa7bec5a28e5 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 4 Jun 2026 15:10:21 +0200 Subject: [PATCH 06/34] feat: add steps for Python setup, dependency installation, and test execution in CI workflow --- .github/workflows/ci.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d14114..c7d6364 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,11 +14,13 @@ jobs: - name: Checkout uses: actions/checkout@v4 - # TODO: ajouter un step "Setup Python" avec actions/setup-python@v5 - # version : "3.11" + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" - # TODO: ajouter un step "Installer les dépendances" - # commande : pip install -r ressources/requirements.txt + - name: Installer les dépendances + run: pip install -r ressources/requirements.txt - # TODO: ajouter un step "Lancer les tests" - # commande : pytest ressources/ -v \ No newline at end of file + - name: Lancer les tests + run: pytest ressources/ -v \ No newline at end of file From 8b62d115292e19a8c84a432303f8b206d1035a63 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 4 Jun 2026 15:13:16 +0200 Subject: [PATCH 07/34] feat: add linter step and duplicate Python setup in CI workflow --- .github/workflows/ci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7d6364..ca66578 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,4 +23,14 @@ jobs: run: pip install -r ressources/requirements.txt - name: Lancer les tests - run: pytest ressources/ -v \ No newline at end of file + run: pytest ressources/ -v + - name: Linter + run: flake8 ressources/ + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Installer flake8 + run: pip install flake8 \ No newline at end of file From 8a5077b68f09f96f60da1b3c8bd28431a06f7785 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 4 Jun 2026 15:15:02 +0200 Subject: [PATCH 08/34] feat: reorganize CI workflow to separate linting and testing jobs --- .github/workflows/ci.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca66578..670787b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ on: branches: [main] jobs: - test: + lint: runs-on: ubuntu-latest steps: @@ -19,18 +19,26 @@ jobs: with: python-version: "3.11" - - name: Installer les dépendances - run: pip install -r ressources/requirements.txt + - name: Installer flake8 + run: pip install flake8 - - name: Lancer les tests - run: pytest ressources/ -v - - name: Linter - run: flake8 ressources/ + - name: Lint avec flake8 + run: flake8 ressources/ --config ressources/.flake8 + + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 with: python-version: "3.11" - - name: Installer flake8 - run: pip install flake8 \ No newline at end of file + - name: Installer les dépendances + run: pip install -r ressources/requirements.txt + + - name: Lancer les tests + run: pytest ressources/ -v \ No newline at end of file From e56c6cf08c1082f57815b92e12ef8be4325daa3f Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 4 Jun 2026 15:31:41 +0200 Subject: [PATCH 09/34] feat: add demo secrets workflow to utilize API key --- .github/workflows/secrets.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/secrets.yml diff --git a/.github/workflows/secrets.yml b/.github/workflows/secrets.yml new file mode 100644 index 0000000..dd307a5 --- /dev/null +++ b/.github/workflows/secrets.yml @@ -0,0 +1,15 @@ +name: Demo Secrets + +on: + workflow_dispatch: + +jobs: + demo: + runs-on: ubuntu-latest + + steps: + - name: Utiliser le secret + run: | + echo "La clé existe : ${{ secrets.API_KEY != '' }}" + # ⚠️ Cette ligne sera masquée dans les logs : + echo "Valeur : ${{ secrets.API_KEY }}" \ No newline at end of file From a3aff3e85aac39b8cf1a2224d0f4bebcd1a8eb0f Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 4 Jun 2026 16:16:28 +0200 Subject: [PATCH 10/34] feat: add validation step for API_KEY in demo secrets workflow --- .github/workflows/secrets.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/secrets.yml b/.github/workflows/secrets.yml index dd307a5..4a94882 100644 --- a/.github/workflows/secrets.yml +++ b/.github/workflows/secrets.yml @@ -7,9 +7,19 @@ jobs: demo: runs-on: ubuntu-latest + env: + API_KEY: ${{ secrets.API_KEY }} # injection du secret comme variable d'environnement + steps: - - name: Utiliser le secret + - name: Vérifier que le secret est défini + run: | + if [ -z "$API_KEY" ]; then + echo "❌ Le secret API_KEY n'est pas défini" + exit 1 + fi + echo "✅ Le secret API_KEY est défini (${#API_KEY} caractères)" + + - name: Simuler un appel API authentifié run: | - echo "La clé existe : ${{ secrets.API_KEY != '' }}" - # ⚠️ Cette ligne sera masquée dans les logs : - echo "Valeur : ${{ secrets.API_KEY }}" \ No newline at end of file + echo "Appel à l'API avec Authorization: Bearer ***" + # En vrai : curl -H "Authorization: Bearer $API_KEY" https://api.example.com \ No newline at end of file From 7af09118b706eb5b27015bb9b622e7a2eaa73dae Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 4 Jun 2026 16:49:03 +0200 Subject: [PATCH 11/34] feat: add deploy workflow for staging and production environments --- .github/workflows/deploy.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..e0f89a2 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,22 @@ +name: Deploy + +on: + workflow_dispatch: + +jobs: + deploy-staging: + runs-on: ubuntu-latest + environment: staging # utilise l'environnement staging + + steps: + - name: Déployer en staging + run: echo "Déploiement en staging..." + + deploy-production: + runs-on: ubuntu-latest + environment: production # TODO: ajouter la dépendance sur deploy-staging + needs: deploy-staging + + steps: + - name: Déployer en production + run: echo "Déploiement en production !" \ No newline at end of file From 43e72049d629e4cc832821182d1445a08b18d8ff Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Fri, 5 Jun 2026 09:29:57 +0200 Subject: [PATCH 12/34] feat: consolidate deployment jobs and add environment input options --- .github/workflows/deploy.yml | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e0f89a2..bdd3ce4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,21 +2,31 @@ name: Deploy on: workflow_dispatch: + inputs: + environment: + description: "Environnement cible" + required: true + default: "staging" + type: choice + options: + - staging + - production jobs: - deploy-staging: + deploy: runs-on: ubuntu-latest - environment: staging # utilise l'environnement staging + environment: ${{ inputs.environment }} # bloqué si production nécessite une approbation steps: - - name: Déployer en staging - run: echo "Déploiement en staging..." + - name: Checkout + uses: actions/checkout@v4 - deploy-production: - runs-on: ubuntu-latest - environment: production # TODO: ajouter la dépendance sur deploy-staging - needs: deploy-staging - - steps: - - name: Déployer en production - run: echo "Déploiement en production !" \ No newline at end of file + - name: Déployer sur ${{ inputs.environment }} + run: | + if [ "${{ inputs.environment }}" = "production" ]; then + echo "🚀 Déploiement en PRODUCTION" + echo "URL : https://nexacloud.example.com" + else + echo "✅ Déploiement en STAGING" + echo "URL : https://staging.nexacloud.example.com" + fi \ No newline at end of file From f6c0c58e06f0e7dc905bc4f3567ec0854871dbc0 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Fri, 5 Jun 2026 09:56:45 +0200 Subject: [PATCH 13/34] feat: restructure deploy workflow to include build job and output sharing --- .github/workflows/deploy.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bdd3ce4..8b3c02d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -29,4 +29,25 @@ jobs: else echo "✅ Déploiement en STAGING" echo "URL : https://staging.nexacloud.example.com" - fi \ No newline at end of file + fi +jobs: + build: + runs-on: ubuntu-latest + env: + APP_ENV: production + API_URL: ${{ vars.API_URL }} # variable non sensible + API_KEY: ${{ secrets.API_KEY }} # secret chiffré + +# Partager des outputs entre jobs +jobs: + build: + outputs: + version: ${{ steps.version.outputs.tag }} + steps: + - id: version + run: echo "tag=1.2.3" >> $GITHUB_OUTPUT + + deploy: + needs: build + steps: + - run: echo "Déploiement de la version ${{ needs.build.outputs.version }}" \ No newline at end of file From 1f90a64d2245ecab150808d29a0328fd52a1b381 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Fri, 5 Jun 2026 11:49:33 +0200 Subject: [PATCH 14/34] feat: add CI/CD workflow for NexaCloud API with staging and production deployments --- .github/workflows/cicd.yml | 73 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/cicd.yml diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..96bd9b6 --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,73 @@ +name: CI/CD — NexaCloud API + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + qualite: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Installer les dépendances + run: pip install -r ressources/requirements.txt + + - name: Lint + run: flake8 ressources/ --config ressources/.flake8 + + - name: Tests avec couverture + run: pytest ressources/ -v --cov=ressources --cov-report=term-missing + + staging: + runs-on: ubuntu-latest + needs: qualite + environment: staging + if: github.ref_name == 'main' + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Installer les dépendances + run: pip install -r ressources/requirements.txt + + - name: Déployer sur Azure App Service (staging) + uses: azure/webapps-deploy@v3 + with: + app-name: "nexacloud-api-staging" + publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_STAGING }} + package: ressources/ + + production: + runs-on: ubuntu-latest + needs: staging + environment: production + if: github.ref_name == 'main' + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Installer les dépendances + run: pip install -r ressources/requirements.txt + + - name: Déployer sur Azure App Service (production) + uses: azure/webapps-deploy@v3 + with: + app-name: "nexacloud-api" + publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} + package: ressources/ \ No newline at end of file From 913438ff9df487ffaf315fcc8b964bbb1e264e7e Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Fri, 5 Jun 2026 12:14:27 +0200 Subject: [PATCH 15/34] fix: correct syntax for staging publish profile in CI/CD workflow --- .github/workflows/cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 96bd9b6..a68ef9b 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -46,7 +46,7 @@ jobs: uses: azure/webapps-deploy@v3 with: app-name: "nexacloud-api-staging" - publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_STAGING }} + publish-profile: ${{ AZURE_WEBAPP_PUBLISH_PROFILE_STAGING }} package: ressources/ production: From 6d67dee2c058eb9c3ec6f420d23d5af008356198 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Fri, 5 Jun 2026 12:19:46 +0200 Subject: [PATCH 16/34] fix: update publish profile reference to use secrets in staging deployment --- .github/workflows/cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index a68ef9b..96bd9b6 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -46,7 +46,7 @@ jobs: uses: azure/webapps-deploy@v3 with: app-name: "nexacloud-api-staging" - publish-profile: ${{ AZURE_WEBAPP_PUBLISH_PROFILE_STAGING }} + publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_STAGING }} package: ressources/ production: From 0535f629c9694f2152688506f6376b968bd2a144 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Fri, 5 Jun 2026 14:19:28 +0200 Subject: [PATCH 17/34] feat: add pre-commit configuration for flake8 and common hooks --- .pre-commit-config.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..b7ef57d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +repos: + - repo: https://github.com/pycqa/flake8 + rev: 7.0.0 + hooks: + - id: flake8 + args: [--config, ressources/.flake8] + files: ressources/.*\.py$ + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-merge-conflict \ No newline at end of file From a6ddd43d27bdd3529430b38a4e344c05396ded2b Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Fri, 5 Jun 2026 14:23:40 +0200 Subject: [PATCH 18/34] fix: update staging app name in deployment workflow --- .github/workflows/cicd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 96bd9b6..f25acd9 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -45,7 +45,7 @@ jobs: - name: Déployer sur Azure App Service (staging) uses: azure/webapps-deploy@v3 with: - app-name: "nexacloud-api-staging" + app-name: "nexacloud-api-23990" publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_STAGING }} package: ressources/ @@ -68,6 +68,6 @@ jobs: - name: Déployer sur Azure App Service (production) uses: azure/webapps-deploy@v3 with: - app-name: "nexacloud-api" + app-name: "nexacloud" publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} package: ressources/ \ No newline at end of file From 0f2633e915f54ae3d1672311a0967c2ee43b9cca Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Fri, 5 Jun 2026 15:55:52 +0200 Subject: [PATCH 19/34] fix: ensure consistent formatting in workflow files and .gitignore --- .github/workflows/ci.yml | 2 +- .github/workflows/cicd.yml | 2 +- .github/workflows/deploy.yml | 49 +++++++---------------------------- .github/workflows/hello.yml | 2 +- .github/workflows/secrets.yml | 2 +- .gitignore | 2 +- .pre-commit-config.yaml | 2 +- 7 files changed, 15 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 670787b..ecb9a31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,4 +41,4 @@ jobs: run: pip install -r ressources/requirements.txt - name: Lancer les tests - run: pytest ressources/ -v \ No newline at end of file + run: pytest ressources/ -v diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index f25acd9..b50180b 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -70,4 +70,4 @@ jobs: with: app-name: "nexacloud" publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} - package: ressources/ \ No newline at end of file + package: ressources/ diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8b3c02d..1c264f9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,52 +2,21 @@ name: Deploy on: workflow_dispatch: - inputs: - environment: - description: "Environnement cible" - required: true - default: "staging" - type: choice - options: - - staging - - production jobs: - deploy: + deploy-staging: runs-on: ubuntu-latest - environment: ${{ inputs.environment }} # bloqué si production nécessite une approbation + environment: staging # utilise l'environnement staging steps: - - name: Checkout - uses: actions/checkout@v4 + - name: Déployer en staging + run: echo "Déploiement en staging..." - - name: Déployer sur ${{ inputs.environment }} - run: | - if [ "${{ inputs.environment }}" = "production" ]; then - echo "🚀 Déploiement en PRODUCTION" - echo "URL : https://nexacloud.example.com" - else - echo "✅ Déploiement en STAGING" - echo "URL : https://staging.nexacloud.example.com" - fi -jobs: - build: + deploy-production: runs-on: ubuntu-latest - env: - APP_ENV: production - API_URL: ${{ vars.API_URL }} # variable non sensible - API_KEY: ${{ secrets.API_KEY }} # secret chiffré - -# Partager des outputs entre jobs -jobs: - build: - outputs: - version: ${{ steps.version.outputs.tag }} - steps: - - id: version - run: echo "tag=1.2.3" >> $GITHUB_OUTPUT + environment: production # TODO: ajouter la dépendance sur deploy-staging + needs: deploy-staging - deploy: - needs: build steps: - - run: echo "Déploiement de la version ${{ needs.build.outputs.version }}" \ No newline at end of file + - name: Déployer en production + run: echo "Déploiement en production !" diff --git a/.github/workflows/hello.yml b/.github/workflows/hello.yml index 2a00536..2bcad31 100644 --- a/.github/workflows/hello.yml +++ b/.github/workflows/hello.yml @@ -24,4 +24,4 @@ jobs: run: ls -la - name: Date et heure du runner - run: date \ No newline at end of file + run: date diff --git a/.github/workflows/secrets.yml b/.github/workflows/secrets.yml index 4a94882..5bda96e 100644 --- a/.github/workflows/secrets.yml +++ b/.github/workflows/secrets.yml @@ -22,4 +22,4 @@ jobs: - name: Simuler un appel API authentifié run: | echo "Appel à l'API avec Authorization: Bearer ***" - # En vrai : curl -H "Authorization: Bearer $API_KEY" https://api.example.com \ No newline at end of file + # En vrai : curl -H "Authorization: Bearer $API_KEY" https://api.example.com diff --git a/.gitignore b/.gitignore index 78e7733..66ee655 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,4 @@ terraform.rc # Optional: ignore plan files saved before destroying Terraform configuration # Uncomment the line below if you want to ignore planout files. -# planout \ No newline at end of file +# planout diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b7ef57d..dcbcf44 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,4 +12,4 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - - id: check-merge-conflict \ No newline at end of file + - id: check-merge-conflict From da777653c0117a478e52e0a7ad6f837ecd8383a5 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Fri, 5 Jun 2026 15:57:15 +0200 Subject: [PATCH 20/34] fix: correct line breaks for consistency in README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4abe121..c264a77 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # TP GitHub Actions — CI/CD et automatisation -**Durée estimée :** 6h -**Prérequis :** Git, GitHub, bases Bash ou PowerShell (TPs précédents) +**Durée estimée :** 6h +**Prérequis :** Git, GitHub, bases Bash ou PowerShell (TPs précédents) **Environnement :** tout OS avec Git installé et un compte GitHub actif --- @@ -242,7 +242,7 @@ Commitez et pushez. Observez l'exécution dans l'onglet **Actions**. > ✏️ **À vous** > -> Ajoutez un step qui affiche la date et l'heure du runner avec `date`. +> Ajoutez un step qui affiche la date et l'heure du runner avec `date`. > Puis déclenchez le workflow **manuellement** depuis l'interface GitHub (bouton "Run workflow").
From fdcfdf817394993eb85b2a23501c23e537b6fadd Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Fri, 5 Jun 2026 16:06:50 +0200 Subject: [PATCH 21/34] feat: add pre-commit configuration for flake8 and common hooks --- .pre-commit-config.yaml => pre-commit-config.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .pre-commit-config.yaml => pre-commit-config.yaml (100%) diff --git a/.pre-commit-config.yaml b/pre-commit-config.yaml similarity index 100% rename from .pre-commit-config.yaml rename to pre-commit-config.yaml From 0bea5b3fe152e785e3fe53bb354c7c028ae34daa Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Fri, 5 Jun 2026 16:07:09 +0200 Subject: [PATCH 22/34] feat: add pre-commit configuration for flake8 and common hooks --- pre-commit-config.yaml => .pre-commit-config.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename pre-commit-config.yaml => .pre-commit-config.yaml (100%) diff --git a/pre-commit-config.yaml b/.pre-commit-config.yaml similarity index 100% rename from pre-commit-config.yaml rename to .pre-commit-config.yaml From a1da1d62c1b10b1b9168a1427de4f39db6a08fac Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Fri, 5 Jun 2026 16:10:47 +0200 Subject: [PATCH 23/34] fix: add missing hooks for check-added-large-files and isort in pre-commit configuration --- .pre-commit-config.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dcbcf44..ee3b50c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,4 @@ +# .pre-commit-config.yaml — version complète repos: - repo: https://github.com/pycqa/flake8 rev: 7.0.0 @@ -13,3 +14,11 @@ repos: - id: end-of-file-fixer - id: check-yaml - id: check-merge-conflict + - id: check-added-large-files + args: [--maxkb=500] + + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort # trie automatiquement les imports Python + files: ressources/.*\.py$ From 06e036566b486e1afbdf8c304c1c067f65f2a367 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 11 Jun 2026 10:59:56 +0200 Subject: [PATCH 24/34] fix: update app names for Azure App Service deployment in CI/CD workflow --- .github/workflows/cicd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index b50180b..934c867 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -45,7 +45,7 @@ jobs: - name: Déployer sur Azure App Service (staging) uses: azure/webapps-deploy@v3 with: - app-name: "nexacloud-api-23990" + app-name: "ABstaging" publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_STAGING }} package: ressources/ @@ -68,6 +68,6 @@ jobs: - name: Déployer sur Azure App Service (production) uses: azure/webapps-deploy@v3 with: - app-name: "nexacloud" + app-name: "ABproduction" publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} package: ressources/ From 1db876f0337cf5c1a58cb5a02eba42b32fab63f9 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 11 Jun 2026 11:45:35 +0200 Subject: [PATCH 25/34] fix: update dependencies for flake8, pre-commit-hooks, and isort in pre-commit configuration --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ee3b50c..7693d59 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,14 @@ # .pre-commit-config.yaml — version complète repos: - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 + rev: 7.3.0 hooks: - id: flake8 args: [--config, ressources/.flake8] files: ressources/.*\.py$ - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -18,7 +18,7 @@ repos: args: [--maxkb=500] - repo: https://github.com/pycqa/isort - rev: 5.13.2 + rev: 9.0.0a3 hooks: - id: isort # trie automatiquement les imports Python files: ressources/.*\.py$ From 744db87ffdd01ef33337a31e534f6e15bd174b11 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 11 Jun 2026 11:55:27 +0200 Subject: [PATCH 26/34] feat: add dependabot configuration for GitHub Actions and Python dependencies --- .github/dependabot.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..b29b864 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,21 @@ +version: 2 + +updates: + # ── Mettre à jour les actions GitHub ────────────────────────────── + - package-ecosystem: "github-actions" + directory: "/" # cherche dans .github/workflows/ + schedule: + interval: "weekly" # vérifie chaque semaine + labels: + - "dependencies" + - "github-actions" + + # ── Mettre à jour les dépendances Python ────────────────────────── + - package-ecosystem: "pip" + directory: "/ressources" # cherche requirements.txt ici + schedule: + interval: "weekly" + labels: + - "dependencies" + - "python" + open-pull-requests-limit: 5 # max 5 PRs ouvertes en même temps From 046a079da137aa8f0feccca715f0e89b794c1d7b Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 11 Jun 2026 12:17:48 +0200 Subject: [PATCH 27/34] fix: update commit message prefixes and comments in dependabot configuration --- .github/dependabot.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b29b864..991d7c0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,21 +1,25 @@ version: 2 updates: - # ── Mettre à jour les actions GitHub ────────────────────────────── + # GitHub Actions : surveille les "uses: action/nom@version" dans les workflows - package-ecosystem: "github-actions" - directory: "/" # cherche dans .github/workflows/ + directory: "/" schedule: - interval: "weekly" # vérifie chaque semaine + interval: "weekly" # "daily" ou "monthly" aussi possible labels: - "dependencies" - "github-actions" + commit-message: + prefix: "ci" # les commits Dependabot auront le préfixe "ci:" - # ── Mettre à jour les dépendances Python ────────────────────────── + # pip : surveille requirements.txt dans /ressources - package-ecosystem: "pip" - directory: "/ressources" # cherche requirements.txt ici + directory: "/ressources" schedule: interval: "weekly" labels: - "dependencies" - "python" - open-pull-requests-limit: 5 # max 5 PRs ouvertes en même temps + open-pull-requests-limit: 5 + commit-message: + prefix: "chore" From 22330b7c33991b72bc6db72c73c5803480a37ba2 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 11 Jun 2026 12:23:40 +0200 Subject: [PATCH 28/34] feat: add CODEOWNERS file to define review requirements for repository changes --- .github/CODEOWNERS | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..269a8af --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,14 @@ +# Syntaxe : <@utilisateur ou @org/équipe> + +# Par défaut : tout changement requiert une review de ces personnes +* @ + +# Les workflows CI/CD ne peuvent être modifiés que par le lead DevOps +.github/workflows/ @ + +# Le fichier de dépendances requiert une validation technique +ressources/requirements.txt @ + +# Les fichiers de sécurité requièrent une double validation +.github/dependabot.yml @ +.github/CODEOWNERS @ From 60272f27560eea5015afc390a43538d61663e766 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 11 Jun 2026 13:41:00 +0200 Subject: [PATCH 29/34] fix: update CODEOWNERS to specify correct GitHub account for reviews --- .github/CODEOWNERS | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 269a8af..7197fee 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,14 +1,14 @@ # Syntaxe : <@utilisateur ou @org/équipe> # Par défaut : tout changement requiert une review de ces personnes -* @ +* @ # Les workflows CI/CD ne peuvent être modifiés que par le lead DevOps -.github/workflows/ @ +.github/workflows/ @ # Le fichier de dépendances requiert une validation technique -ressources/requirements.txt @ +ressources/requirements.txt @ # Les fichiers de sécurité requièrent une double validation -.github/dependabot.yml @ -.github/CODEOWNERS @ +.github/dependabot.yml @ +.github/CODEOWNERS @ From 3f26ce0ec2002623f0f9c4a85726468b427146d5 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 11 Jun 2026 14:03:23 +0200 Subject: [PATCH 30/34] feat: add additional notes to the GitHub Actions documentation --- notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notes.md b/notes.md index 2c821cd..1f511cb 100644 --- a/notes.md +++ b/notes.md @@ -1 +1 @@ -# Mon TP GitHub Actions +# Mon TP GitHub Actions ! From 0e0bb3485c26adbf7c3049bc5b79f6ee87c3f9c9 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 11 Jun 2026 14:39:27 +0200 Subject: [PATCH 31/34] feat: add /logs/stats endpoint and corresponding unit test --- ressources/app.py | 9 +++++++++ ressources/test_app.py | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/ressources/app.py b/ressources/app.py index d7e75f2..eee358d 100644 --- a/ressources/app.py +++ b/ressources/app.py @@ -38,5 +38,14 @@ def logs_critical(): return jsonify({"critical_count": seuil, "alerte": alerte}) +@app.route("/logs/stats") +def logs_stats(): + total = sum(LOG_SUMMARY.values()) + return jsonify({ + "total": total, + "breakdown": LOG_SUMMARY + }) + + if __name__ == "__main__": app.run(debug=True, port=5001) diff --git a/ressources/test_app.py b/ressources/test_app.py index ce56a43..a886678 100644 --- a/ressources/test_app.py +++ b/ressources/test_app.py @@ -57,3 +57,13 @@ def test_logs_critical_alerte(client): assert "critical_count" in data assert "alerte" in data assert data["alerte"] is True + + +def test_logs_stats(client): + """La route /logs/stats retourne le total et le détail.""" + response = client.get("/logs/stats") + assert response.status_code == 200 + data = response.get_json() + assert "total" in data + assert "breakdown" in data + assert data["total"] == 185 # 142 + 28 + 12 + 3 From 1b3235cc8e922a541e1541a4424df974ea90661f Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 11 Jun 2026 14:39:50 +0200 Subject: [PATCH 32/34] chore: update compiled Python bytecode files in __pycache__ --- ressources/__pycache__/app.cpython-314.pyc | Bin 1673 -> 2033 bytes .../test_app.cpython-314-pytest-8.2.0.pyc | Bin 10552 -> 12753 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/ressources/__pycache__/app.cpython-314.pyc b/ressources/__pycache__/app.cpython-314.pyc index 9c6bb8fbb623dd55e32759029b312973982207a7..8a104e18b245ab298a3704c9f4e083497c5ee11f 100644 GIT binary patch delta 443 zcmeC={m9R!&Bx2d00drZw6c^~Ch|!z#!OWIHu0cXD4z)YOh+mw+1j1w};fZAl z60nG1U`P>TV31*mWet#qN+D4}f?`?`SAMFFMD0xFkzR2y9Ha0}hw z;GZCRgF|>q^aoaE5w_0^%slKL7?@evC(E#^G4f4zX7yw$Ql8w&s>G!WGzMf<@yp3u mSvSitv9?P#N_N;@W|aKM#LCG2nVEq}>H~=NL11z^n-Tz(X;OLs delta 126 zcmey!-^t6T&Bx2d00c`j6tfDLC-O-!>P=MtX3G-9XA!}`kRrywAj1&L8XyT$g9?K9 zg9L&E&6yyg@(e*j%3!Q1yt#w%IP>ImHbq9>$(?MTldrSMbEyNBF#>V%nMv%MCtqM! F1OOzt7G(ec diff --git a/ressources/__pycache__/test_app.cpython-314-pytest-8.2.0.pyc b/ressources/__pycache__/test_app.cpython-314-pytest-8.2.0.pyc index b3576dfa74af7b212b02087efb60ef786e756c99..8f93bd206a0b24af1a42295be79d6c889674c55b 100644 GIT binary patch delta 606 zcmdlHbTOGvn~#@^0SNNfXl4CipU5Y{*f3GOiknlMp+q2vQJF!LYvZy6RmNYF+11P# zS5CH5Gh&Shini<`VVpn#(arM}D;eP&d1XgNK~5bhm?;bl1sriZCp)rOateXfi-osL zUZ`l!$UpfZt0gOUkU)^&WOdbe5Ajk{pdOz@g`)h@l2ir#oc#1+{o<0ul46CT)RO$t zqP$dvoK%I9{F1~Rh13!dJLT}olElm$y((@b)ss)CDyXu8l@$pCO)Rnk5xOA414!KB zOe#uE%udNK&zmf-CMQ_r1(J~l5i%gcXYw93X&wHO)Z&tOkQ3s;PACcj%Gm*Nu^ljo z8WTZlX-=wLQ5291iuhum$uBir`9F!UGb()n I5(;3|0IZv#p#T5? delta 130 zcmcbZyd#KDn~#@^0SK06C}wS7o5&}@ST#|-ij`5BL6dXingmtGs>!@+W{jGXUDV8& zG Date: Thu, 11 Jun 2026 15:20:19 +0200 Subject: [PATCH 33/34] feat: update CODEOWNERS to clarify review requirements and approvals --- .github/CODEOWNERS | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7197fee..17d1891 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,14 +1,8 @@ -# Syntaxe : <@utilisateur ou @org/équipe> +# Tout changement requiert une approbation de votre binôme +* @benslimane-byte @bambstk -# Par défaut : tout changement requiert une review de ces personnes -* @ +# Les workflows ne peuvent être modifiés qu'avec validation des deux +.github/workflows/ @benslimane-byte @bambstk -# Les workflows CI/CD ne peuvent être modifiés que par le lead DevOps -.github/workflows/ @ - -# Le fichier de dépendances requiert une validation technique -ressources/requirements.txt @ - -# Les fichiers de sécurité requièrent une double validation -.github/dependabot.yml @ -.github/CODEOWNERS @ +# Le code applicatif +ressources/ @benslimane-byte @bambstk From 10deb9fd78c74253bfc27a1c80733c38eae61323 Mon Sep 17 00:00:00 2001 From: benslimane-byte Date: Thu, 11 Jun 2026 16:07:24 +0200 Subject: [PATCH 34/34] feat: update CODEOWNERS to enhance review and approval guidelines --- .github/CODEOWNERS | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 17d1891..18473c9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,3 +1,17 @@ +# Syntaxe : <@utilisateur ou @org/équipe> + +# Par défaut : tout changement requiert une review de ces personnes +* @benslimane-byte + +# Les workflows CI/CD ne peuvent être modifiés que par le lead DevOps +.github/workflows/ @benslimane-byte + +# Le fichier de dépendances requiert une validation technique +ressources/requirements.txt @benslimane-byte + +# Les fichiers de sécurité requièrent une double validation +.github/dependabot.yml @benslimane-byte +.github/CODEOWNERS @benslimane-byte # Tout changement requiert une approbation de votre binôme * @benslimane-byte @bambstk