From 08b49c522d19fefe2f798483c8717ebe1d48e228 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Thu, 26 Mar 2026 15:58:54 +0100 Subject: [PATCH 01/30] feat: add Gitea Actions workflow for automated testing --- .gitea/workflows/demo.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .gitea/workflows/demo.yml diff --git a/.gitea/workflows/demo.yml b/.gitea/workflows/demo.yml new file mode 100644 index 0000000..394c807 --- /dev/null +++ b/.gitea/workflows/demo.yml @@ -0,0 +1,19 @@ +name: Gitea Actions Demo +run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 +on: [push] + +jobs: + Explore-Gitea-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" + - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." + - name: Check out repository code + uses: actions/checkout@v4 + - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ gitea.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file From 175bd09270066ab0cfdc383e0b13c64eedddcd4f Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Thu, 26 Mar 2026 16:08:28 +0100 Subject: [PATCH 02/30] =?UTF-8?q?feat=C2=A0:=20activer=20le=20d=C3=A9clenc?= =?UTF-8?q?hement=20manuel=20du=20flux=20de=20travail=20de=20d=C3=A9ploiem?= =?UTF-8?q?ent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/deploy.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 4f45498..fd4727f 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,10 +1,11 @@ name: Deploy Webzine +run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} on: push: branches: - - main - workflow_dispatch: + - 'main' + workflow_dispatch jobs: # ───────────────────────────────────────────── From 9e8a059a2977a84e93427ef0308687106e210a76 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Thu, 26 Mar 2026 16:08:58 +0100 Subject: [PATCH 03/30] =?UTF-8?q?fix=C2=A0:=20mise=20=C3=A0=20jour=20les?= =?UTF-8?q?=20r=C3=A9f=C3=A9rences=20des=20variables=20de=20sortie=20de=20?= =?UTF-8?q?GITHUB=5FOUTPUT=20vers=20GITEA=5FOUTPUT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/deploy.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index fd4727f..6cba91b 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,6 +1,5 @@ name: Deploy Webzine run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} - on: push: branches: @@ -24,8 +23,8 @@ jobs: - name: Set image tag id: vars run: | - echo "IMAGE_TAG=latest" >> $GITHUB_OUTPUT - echo "ENV_LABEL=production" >> $GITHUB_OUTPUT + echo "IMAGE_TAG=latest" >> $GITEA_OUTPUT + echo "ENV_LABEL=production" >> $GITEA_OUTPUT - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 9ed0843fdbd1cdbf4351b044a658e324405d98f2 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Thu, 26 Mar 2026 16:11:02 +0100 Subject: [PATCH 04/30] =?UTF-8?q?feat=C2=A0:=20mettre=20=C3=A0=20jour=20le?= =?UTF-8?q?s=20d=C3=A9clencheurs=20du=20workflow=20pour=20les=20actions=20?= =?UTF-8?q?et=20le=20d=C3=A9ploiement=20de=20Gitea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/demo.yml | 2 +- .gitea/workflows/deploy.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/demo.yml b/.gitea/workflows/demo.yml index 394c807..21add6c 100644 --- a/.gitea/workflows/demo.yml +++ b/.gitea/workflows/demo.yml @@ -1,6 +1,6 @@ name: Gitea Actions Demo run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 -on: [push] +on: workflow_dispatch jobs: Explore-Gitea-Actions: diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 6cba91b..944eecb 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -4,6 +4,7 @@ on: push: branches: - 'main' + - 'j2/feat/git-action-time' workflow_dispatch jobs: From ffeb7893cf57d068f2e04262d91094001d45c725 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Thu, 26 Mar 2026 16:12:06 +0100 Subject: [PATCH 05/30] test: push global --- .gitea/workflows/deploy.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 944eecb..241de90 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,11 +1,6 @@ name: Deploy Webzine run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} -on: - push: - branches: - - 'main' - - 'j2/feat/git-action-time' - workflow_dispatch +on: [push] jobs: # ───────────────────────────────────────────── From 6f4c7e3964c7a7e0832c686c561c5e047c211bf1 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Thu, 26 Mar 2026 16:44:26 +0100 Subject: [PATCH 06/30] =?UTF-8?q?feat=C2=A0:=20mettre=20=C3=A0=20jour=20la?= =?UTF-8?q?=20configuration=20de=20Docker=20Buildx=20pour=20activer=20l?= =?UTF-8?q?=E2=80=99acc=C3=A8s=20HTTP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/deploy.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 241de90..0b4b72d 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -24,6 +24,11 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + with: + buildkitd-config-inline: | + [registry."${{ vars.REGISTRY_URL }}"] + http = true + insecure = true # Connexion au registry Gitea intégré - name: Log in to Gitea Container Registry From b381d024c7340d864586e855b3b61423ec9f97c9 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 09:16:33 +0100 Subject: [PATCH 07/30] =?UTF-8?q?feat:=20simplifie=20la=20configuration=20?= =?UTF-8?q?des=20workflows=20de=20d=C3=A9ploiement=20et=20am=C3=A9liorer?= =?UTF-8?q?=20le=20processus=20de=20d=C3=A9ploiement=20sur=20le=20serveur?= =?UTF-8?q?=20de=20production?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/deploy.yml | 106 +++++++++---------------- .gitea/workflows/pr-endpoint-check.yml | 7 +- 2 files changed, 38 insertions(+), 75 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 0b4b72d..3f064fd 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,83 +1,50 @@ name: Deploy Webzine -run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }} +run-name: Deploy to production by @${{ github.actor }} + on: [push] jobs: # ───────────────────────────────────────────── - # COMPILATION — commun aux deux branches - # ───────────────────────────────────────────── - build: - name: Build & Push Docker Image - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - # Le tag d'image dépend de la branche : - # main → webzine:latest - - name: Set image tag - id: vars - run: | - echo "IMAGE_TAG=latest" >> $GITEA_OUTPUT - echo "ENV_LABEL=production" >> $GITEA_OUTPUT - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - buildkitd-config-inline: | - [registry."${{ vars.REGISTRY_URL }}"] - http = true - insecure = true - - # Connexion au registry Gitea intégré - - name: Log in to Gitea Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ vars.REGISTRY_URL }} - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} - - # Construction et publication de l'image Docker - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: ./Webzine.WebApplication/Dockerfile - push: true - tags: ${{ vars.REGISTRY_URL }}/webzine/webzine:${{ steps.vars.outputs.IMAGE_TAG }} - cache-from: type=registry,ref=${{ vars.REGISTRY_URL }}/webzine/webzine:buildcache-${{ steps.vars.outputs.IMAGE_TAG }} - cache-to: type=registry,ref=${{ vars.REGISTRY_URL }}/webzine/webzine:buildcache-${{ steps.vars.outputs.IMAGE_TAG }},mode=max - - outputs: - image_tag: ${{ steps.vars.outputs.IMAGE_TAG }} - env_label: ${{ steps.vars.outputs.ENV_LABEL }} - - # ───────────────────────────────────────────── - # DÉPLOIEMENT — Serveur de PRODUCTION (branche main) + # DÉPLOIEMENT — Build et démarrage sur le serveur # ───────────────────────────────────────────── deploy-production: name: Deploy to Production - needs: build runs-on: ubuntu-latest steps: - - name: Deploy via SSH to PRODUCTION server - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.PROD_HOST }} - username: ${{ secrets.PROD_USER }} - key: ${{ secrets.PROD_SSH_KEY }} - port: ${{ secrets.PROD_SSH_PORT || 22 }} - script: | + # Écriture de la clé SSH dans un fichier temporaire + - name: Setup SSH key + run: | + mkdir -p ~/.ssh + echo "${{ secrets.PROD_SSH_KEY }}" > ~/.ssh/id_prod + chmod 600 ~/.ssh/id_prod + ssh-keyscan -p ${{ secrets.PROD_SSH_PORT || 22 }} ${{ secrets.PROD_HOST }} >> ~/.ssh/known_hosts 2>/dev/null + + # Transfert du code source sur le serveur + - name: Checkout code + uses: actions/checkout@v4 + + - name: Upload source to server + run: | + rsync -az --delete \ + -e "ssh -i ~/.ssh/id_prod -p ${{ secrets.PROD_SSH_PORT || 22 }} -o StrictHostKeyChecking=no" \ + ./ \ + ${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }}:/opt/webzine/prod/src/ + + # Build et redémarrage du conteneur directement sur le serveur + - name: Build and deploy on PRODUCTION server + run: | + ssh -i ~/.ssh/id_prod \ + -p ${{ secrets.PROD_SSH_PORT || 22 }} \ + -o StrictHostKeyChecking=no \ + ${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }} << 'ENDSSH' set -e - echo "=== [PROD] Récupération de l'image ===" - docker login ${{ vars.REGISTRY_URL }} \ - -u ${{ secrets.REGISTRY_USERNAME }} \ - -p ${{ secrets.REGISTRY_PASSWORD }} - - docker pull ${{ vars.REGISTRY_URL }}/webzine/webzine:latest + echo "=== [PROD] Construction de l'image ===" + docker build \ + -t webzine:latest \ + -f /opt/webzine/prod/src/Webzine.WebApplication/Dockerfile \ + /opt/webzine/prod/src/ echo "=== [PROD] Arrêt de l'ancien conteneur ===" docker stop webzine-prod 2>/dev/null || true @@ -92,9 +59,10 @@ jobs: -v /opt/webzine/prod/data:/app/Data \ -v /opt/webzine/prod/logs:/Logs \ -e ASPNETCORE_ENVIRONMENT=Production \ - ${{ vars.REGISTRY_URL }}/webzine/webzine:latest + webzine:latest echo "=== [PROD] Nettoyage des anciennes images ===" docker image prune -f - echo "=== [PROD] Déploiement terminé ===" \ No newline at end of file + echo "=== [PROD] Déploiement terminé ===" + ENDSSH \ No newline at end of file diff --git a/.gitea/workflows/pr-endpoint-check.yml b/.gitea/workflows/pr-endpoint-check.yml index c67fab3..0462093 100644 --- a/.gitea/workflows/pr-endpoint-check.yml +++ b/.gitea/workflows/pr-endpoint-check.yml @@ -1,11 +1,6 @@ name: PR Endpoint Performance Check -on: - pull_request: - branches: - - main - - master - - develop +on: [pull_request] jobs: endpoint-performance-check: From 5a7a37702fc2eba99438675f0121d1073cb024c2 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 09:18:20 +0100 Subject: [PATCH 08/30] =?UTF-8?q?feat:=20mettre=20=C3=A0=20jour=20le=20flu?= =?UTF-8?q?x=20de=20travail=20de=20d=C3=A9ploiement=20pour=20d=C3=A9clench?= =?UTF-8?q?er=20sur=20la=20branche=20principale=20et=20am=C3=A9liorer=20le?= =?UTF-8?q?=20processus=20de=20transfert=20de=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/deploy.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 3f064fd..54d4639 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,7 +1,10 @@ name: Deploy Webzine run-name: Deploy to production by @${{ github.actor }} -on: [push] +on: + push: + branches: + - main jobs: # ───────────────────────────────────────────── @@ -12,6 +15,9 @@ jobs: runs-on: ubuntu-latest steps: + - name: Checkout code + uses: actions/checkout@v4 + # Écriture de la clé SSH dans un fichier temporaire - name: Setup SSH key run: | @@ -20,16 +26,15 @@ jobs: chmod 600 ~/.ssh/id_prod ssh-keyscan -p ${{ secrets.PROD_SSH_PORT || 22 }} ${{ secrets.PROD_HOST }} >> ~/.ssh/known_hosts 2>/dev/null - # Transfert du code source sur le serveur - - name: Checkout code - uses: actions/checkout@v4 - + # Compression du code source et transfert vers le serveur - name: Upload source to server run: | - rsync -az --delete \ - -e "ssh -i ~/.ssh/id_prod -p ${{ secrets.PROD_SSH_PORT || 22 }} -o StrictHostKeyChecking=no" \ - ./ \ - ${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }}:/opt/webzine/prod/src/ + tar --exclude='.git' --exclude='*.user' -czf /tmp/webzine-src.tar.gz . + scp -i ~/.ssh/id_prod \ + -P ${{ secrets.PROD_SSH_PORT || 22 }} \ + -o StrictHostKeyChecking=no \ + /tmp/webzine-src.tar.gz \ + ${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }}:/tmp/webzine-src.tar.gz # Build et redémarrage du conteneur directement sur le serveur - name: Build and deploy on PRODUCTION server @@ -40,6 +45,11 @@ jobs: ${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }} << 'ENDSSH' set -e + echo "=== [PROD] Extraction des sources ===" + mkdir -p /opt/webzine/prod/src + tar -xzf /tmp/webzine-src.tar.gz -C /opt/webzine/prod/src/ + rm /tmp/webzine-src.tar.gz + echo "=== [PROD] Construction de l'image ===" docker build \ -t webzine:latest \ From 7580313bee78373b0960dda01b73bee2d8fed6d5 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 09:20:37 +0100 Subject: [PATCH 09/30] test: tentative 2 --- .gitea/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 54d4639..3558ffd 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -75,4 +75,4 @@ jobs: docker image prune -f echo "=== [PROD] Déploiement terminé ===" - ENDSSH \ No newline at end of file + ENDSSH From 99328d04b829428ac6ebe25ea71a3a7fedcf2856 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 09:21:12 +0100 Subject: [PATCH 10/30] =?UTF-8?q?test:=20mise=20=C3=A0=20jour=20trigger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/deploy.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 3558ffd..c587865 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,10 +1,7 @@ name: Deploy Webzine run-name: Deploy to production by @${{ github.actor }} -on: - push: - branches: - - main +on: [push] jobs: # ───────────────────────────────────────────── From bfc3f46cf8644612e3026faf0d8a9561240a3fa3 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 09:24:32 +0100 Subject: [PATCH 11/30] =?UTF-8?q?feat:=20am=C3=A9liorer=20la=20gestion=20d?= =?UTF-8?q?e=20la=20cl=C3=A9=20SSH=20dans=20le=20workflow=20de=20d=C3=A9pl?= =?UTF-8?q?oiement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index c587865..06193cc 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -15,11 +15,11 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - # Écriture de la clé SSH dans un fichier temporaire + # Écriture de la clé SSH - name: Setup SSH key run: | mkdir -p ~/.ssh - echo "${{ secrets.PROD_SSH_KEY }}" > ~/.ssh/id_prod + printf '%s\n' "${{ secrets.PROD_SSH_KEY }}" > ~/.ssh/id_prod chmod 600 ~/.ssh/id_prod ssh-keyscan -p ${{ secrets.PROD_SSH_PORT || 22 }} ${{ secrets.PROD_HOST }} >> ~/.ssh/known_hosts 2>/dev/null @@ -72,4 +72,4 @@ jobs: docker image prune -f echo "=== [PROD] Déploiement terminé ===" - ENDSSH + ENDSSH \ No newline at end of file From 951c1a862d3ddd54fe87f9b2444edd308657ea04 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 09:39:18 +0100 Subject: [PATCH 12/30] =?UTF-8?q?feat:=20ajouter=20un=20d=C3=A9lai=20avant?= =?UTF-8?q?=20la=20redirection=20en=20cas=20de=20nom=20d'artiste=20manquan?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Webzine.WebApplication/Controllers/ArtisteController.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Webzine.WebApplication/Controllers/ArtisteController.cs b/Webzine.WebApplication/Controllers/ArtisteController.cs index 35a2cbc..9f3f265 100644 --- a/Webzine.WebApplication/Controllers/ArtisteController.cs +++ b/Webzine.WebApplication/Controllers/ArtisteController.cs @@ -31,6 +31,10 @@ namespace Webzine.WebApplication.Controllers if (string.IsNullOrEmpty(nom)) { this._logger.LogWarning("Nom de l'artiste manquant dans la requête."); + + // Wait 1 second before redirecting to the home page to give the user a chance to see the warning message in the logs. + System.Threading.Thread.Sleep(1000); + return RedirectToAction("Index", "Accueil"); } From ca35f5766e9268b50b7da4ad90453573c2329852 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 09:39:30 +0100 Subject: [PATCH 13/30] =?UTF-8?q?feat:=20augmenter=20le=20d=C3=A9lai=20ava?= =?UTF-8?q?nt=20la=20redirection=20en=20cas=20de=20nom=20d'artiste=20manqu?= =?UTF-8?q?ant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Webzine.WebApplication/Controllers/ArtisteController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Webzine.WebApplication/Controllers/ArtisteController.cs b/Webzine.WebApplication/Controllers/ArtisteController.cs index 9f3f265..c998211 100644 --- a/Webzine.WebApplication/Controllers/ArtisteController.cs +++ b/Webzine.WebApplication/Controllers/ArtisteController.cs @@ -33,7 +33,7 @@ namespace Webzine.WebApplication.Controllers this._logger.LogWarning("Nom de l'artiste manquant dans la requête."); // Wait 1 second before redirecting to the home page to give the user a chance to see the warning message in the logs. - System.Threading.Thread.Sleep(1000); + System.Threading.Thread.Sleep(4000); return RedirectToAction("Index", "Accueil"); } From 6aa492e5f9e6728d20cb87328e2012c491ed9904 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 09:48:07 +0100 Subject: [PATCH 14/30] =?UTF-8?q?feat:=20augmenter=20le=20d=C3=A9lai=20ava?= =?UTF-8?q?nt=20la=20redirection=20en=20cas=20de=20nom=20d'artiste=20manqu?= =?UTF-8?q?ant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Webzine.WebApplication/Controllers/ArtisteController.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Webzine.WebApplication/Controllers/ArtisteController.cs b/Webzine.WebApplication/Controllers/ArtisteController.cs index c998211..ddc6bcb 100644 --- a/Webzine.WebApplication/Controllers/ArtisteController.cs +++ b/Webzine.WebApplication/Controllers/ArtisteController.cs @@ -32,12 +32,14 @@ namespace Webzine.WebApplication.Controllers { this._logger.LogWarning("Nom de l'artiste manquant dans la requête."); - // Wait 1 second before redirecting to the home page to give the user a chance to see the warning message in the logs. - System.Threading.Thread.Sleep(4000); + return RedirectToAction("Index", "Accueil"); } + // Wait 4 second before redirecting to the home page to give the user a chance to see the warning message in the logs. + Thread.Sleep(4000); + // On transforme "fatal-bazooka" en "Fatal Bazooka" pour la factory string nomPropre = System.Globalization.CultureInfo.CurrentCulture.TextInfo .ToTitleCase(nom.Replace("-", " ")); From 838da780a6787318ccac803915d54e3c98c255a1 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 10:08:42 +0100 Subject: [PATCH 15/30] =?UTF-8?q?feat:=20am=C3=A9liorer=20le=20workflow=20?= =?UTF-8?q?de=20test=20de=20performance=20des=20endpoints?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/pr-endpoint-check.yml | 75 ++++++++++++++------------ 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/.gitea/workflows/pr-endpoint-check.yml b/.gitea/workflows/pr-endpoint-check.yml index 0462093..0a91765 100644 --- a/.gitea/workflows/pr-endpoint-check.yml +++ b/.gitea/workflows/pr-endpoint-check.yml @@ -8,32 +8,20 @@ jobs: runs-on: ubuntu-latest steps: - # ───────────────────────────────────────────── - # Récupération du code source - # ───────────────────────────────────────────── - name: Checkout PR branch uses: actions/checkout@v4 - # ───────────────────────────────────────────── - # Installation de .NET 10 - # ───────────────────────────────────────────── - name: Setup .NET 10 uses: actions/setup-dotnet@v4 with: dotnet-version: "10.0.x" - # ───────────────────────────────────────────── - # Restauration des dépendances et compilation - # ───────────────────────────────────────────── - name: Restore dependencies run: dotnet restore Webzine.sln - name: Build solution run: dotnet build Webzine.sln --no-restore --configuration Release - # ───────────────────────────────────────────── - # Exécution des tests unitaires (entités) - # ───────────────────────────────────────────── - name: Run unit tests run: | dotnet test Webzine.Entity.Tests/Webzine.Entity.Tests.csproj \ @@ -41,9 +29,6 @@ jobs: --configuration Release \ --logger "console;verbosity=normal" - # ───────────────────────────────────────────── - # Démarrage de l'application web en arrière-plan - # ───────────────────────────────────────────── - name: Start Webzine application run: | dotnet run \ @@ -60,20 +45,21 @@ jobs: ' echo "Application prête !" - # ───────────────────────────────────────────── - # Exécution des tests de performance des endpoints - # ───────────────────────────────────────────── - name: Test endpoint response times id: perf_test run: | chmod +x scripts/test-endpoints.sh - bash scripts/test-endpoints.sh http://localhost:5038 1000 || true - FAIL_COUNT=$(grep -c "^\[FAIL\]\|^\[SLOW\]" /tmp/webzine_endpoint_report.txt || echo 0) + bash scripts/test-endpoints.sh http://localhost:5038 1000 2>&1 | tee /tmp/webzine_endpoint_output.txt + EXIT_CODE=${PIPESTATUS[0]} + + FAIL_COUNT=$(grep -c "^\[FAIL\]\|^\[SLOW\]" /tmp/webzine_endpoint_output.txt || echo 0) echo "failed=$FAIL_COUNT" >> "$GITHUB_OUTPUT" + echo "exit_code=$EXIT_CODE" >> "$GITHUB_OUTPUT" + + cat /tmp/webzine_endpoint_output.txt > /tmp/webzine_endpoint_report.txt + + exit $EXIT_CODE - # ───────────────────────────────────────────── - # Publication du rapport en commentaire de PR - # ───────────────────────────────────────────── - name: Post performance report as PR comment if: always() env: @@ -84,43 +70,64 @@ jobs: run: | REPORT_CONTENT=$(cat /tmp/webzine_endpoint_report.txt 2>/dev/null || echo "Aucun rapport généré.") FAILED_COUNT="${{ steps.perf_test.outputs.failed }}" - + + REPORT_CONTENT_ESCAPED=$(echo "$REPORT_CONTENT" | sed 's/`/\\`/g' | sed 's/\\/\\\\/g') + if [ "${FAILED_COUNT:-0}" -gt 0 ]; then HEADER="## ❌ Vérification des performances ÉCHOUÉE" INTRO="${FAILED_COUNT} endpoint(s) ont dépassé 1 seconde ou retourné une erreur serveur." + STATUS="ÉCHEC" else HEADER="## ✅ Vérification des performances RÉUSSIE" INTRO="Tous les endpoints ont répondu en moins d'une seconde." + STATUS="SUCCÈS" fi - + BODY=$(cat < Seuil : **1000ms** | Vérifié par le workflow **PR Endpoint Performance**. + + --- + **Statut**: $STATUS + **Seuil**: 1000ms + **Vérifié par**: Workflow PR Endpoint Performance EOF ) - + curl -s -X POST \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ -d "$(jq -n --arg body "$BODY" '{body: $body}')" \ "$GITEA_SERVER_URL/api/v1/repos/$REPO/issues/$PR_NUMBER/comments" + + mkdir -p /tmp/artifacts + cp /tmp/webzine_endpoint_report.txt /tmp/artifacts/performance-report.txt + + - name: Upload performance report + if: always() + uses: actions/upload-artifact@v4 + with: + name: performance-report + path: /tmp/artifacts/ + retention-days: 7 - # ───────────────────────────────────────────── - # Blocage de la PR si un endpoint a échoué - # ───────────────────────────────────────────── - name: Enforce performance gate + if: always() run: | FAILED="${{ steps.perf_test.outputs.failed }}" if [ "${FAILED:-0}" -gt 0 ]; then echo "❌ PR REJETÉE : ${FAILED} endpoint(s) n'ont pas respecté le seuil d'une seconde." echo " Corrigez les endpoints lents ou en erreur avant de fusionner." + echo "" + echo "Résumé des problèmes :" + grep -E "^\[(FAIL|SLOW)\]" /tmp/webzine_endpoint_report.txt || echo " (aucun détail disponible)" exit 1 else echo "✅ Tous les endpoints ont passé le contrôle de performance." From ae880af550d97aebccaccab5b605e39a55073aa9 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 10:17:35 +0100 Subject: [PATCH 16/30] =?UTF-8?q?feat:=20am=C3=A9liorer=20le=20rapport=20d?= =?UTF-8?q?e=20performance=20des=20endpoints=20en=20utilisant=20un=20fichi?= =?UTF-8?q?er=20de=20rapport=20g=C3=A9n=C3=A9r=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/pr-endpoint-check.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/pr-endpoint-check.yml b/.gitea/workflows/pr-endpoint-check.yml index 0a91765..f730a22 100644 --- a/.gitea/workflows/pr-endpoint-check.yml +++ b/.gitea/workflows/pr-endpoint-check.yml @@ -52,12 +52,10 @@ jobs: bash scripts/test-endpoints.sh http://localhost:5038 1000 2>&1 | tee /tmp/webzine_endpoint_output.txt EXIT_CODE=${PIPESTATUS[0]} - FAIL_COUNT=$(grep -c "^\[FAIL\]\|^\[SLOW\]" /tmp/webzine_endpoint_output.txt || echo 0) + FAIL_COUNT=$(grep -c "\[ÉCHEC\]\|\[LENT\]" /tmp/webzine_endpoint_output.txt || echo 0) echo "failed=$FAIL_COUNT" >> "$GITHUB_OUTPUT" echo "exit_code=$EXIT_CODE" >> "$GITHUB_OUTPUT" - cat /tmp/webzine_endpoint_output.txt > /tmp/webzine_endpoint_report.txt - exit $EXIT_CODE - name: Post performance report as PR comment @@ -68,9 +66,10 @@ jobs: REPO: ${{ gitea.repository }} PR_NUMBER: ${{ gitea.event.pull_request.number }} run: | - REPORT_CONTENT=$(cat /tmp/webzine_endpoint_report.txt 2>/dev/null || echo "Aucun rapport généré.") + REPORT_CONTENT=$(cat /tmp/webzine_endpoint_output.txt) FAILED_COUNT="${{ steps.perf_test.outputs.failed }}" + # Échapper le contenu pour JSON REPORT_CONTENT_ESCAPED=$(echo "$REPORT_CONTENT" | sed 's/`/\\`/g' | sed 's/\\/\\\\/g') if [ "${FAILED_COUNT:-0}" -gt 0 ]; then @@ -108,7 +107,7 @@ jobs: "$GITEA_SERVER_URL/api/v1/repos/$REPO/issues/$PR_NUMBER/comments" mkdir -p /tmp/artifacts - cp /tmp/webzine_endpoint_report.txt /tmp/artifacts/performance-report.txt + cp /tmp/webzine_endpoint_output.txt /tmp/artifacts/performance-report.txt - name: Upload performance report if: always() @@ -127,7 +126,11 @@ jobs: echo " Corrigez les endpoints lents ou en erreur avant de fusionner." echo "" echo "Résumé des problèmes :" - grep -E "^\[(FAIL|SLOW)\]" /tmp/webzine_endpoint_report.txt || echo " (aucun détail disponible)" + if [ -f /tmp/webzine_endpoint_output.txt ]; then + grep -E "\[ÉCHEC\]|\[LENT\]" /tmp/webzine_endpoint_output.txt || echo " (aucun détail disponible)" + else + echo " (fichier de rapport non disponible)" + fi exit 1 else echo "✅ Tous les endpoints ont passé le contrôle de performance." From 3e89693b085420fd17c8a6ff474a0dc9000edbb4 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 10:33:05 +0100 Subject: [PATCH 17/30] =?UTF-8?q?feat:=20am=C3=A9liorer=20le=20format=20du?= =?UTF-8?q?=20rapport=20de=20performance=20en=20convertissant=20le=20conte?= =?UTF-8?q?nu=20ANSI=20en=20Markdown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/pr-endpoint-check.yml | 33 +++++++++++++++++++------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/pr-endpoint-check.yml b/.gitea/workflows/pr-endpoint-check.yml index f730a22..e343c7f 100644 --- a/.gitea/workflows/pr-endpoint-check.yml +++ b/.gitea/workflows/pr-endpoint-check.yml @@ -66,20 +66,37 @@ jobs: REPO: ${{ gitea.repository }} PR_NUMBER: ${{ gitea.event.pull_request.number }} run: | - REPORT_CONTENT=$(cat /tmp/webzine_endpoint_output.txt) + # Lire le rapport original + RAW_REPORT=$(cat /tmp/webzine_endpoint_output.txt) FAILED_COUNT="${{ steps.perf_test.outputs.failed }}" - # Échapper le contenu pour JSON - REPORT_CONTENT_ESCAPED=$(echo "$REPORT_CONTENT" | sed 's/`/\\`/g' | sed 's/\\/\\\\/g') + # Convertir le rapport ANSI en Markdown avec couleurs + # Supprimer d'abord les codes ANSI pour le traitement + CLEAN_REPORT=$(echo "$RAW_REPORT" | sed 's/\x1b\[[0-9;]*m//g') + + # Générer le rapport formaté en Markdown avec couleurs + FORMATTED_REPORT=$(echo "$CLEAN_REPORT" | sed \ + -e 's/^\[OK\] /✅ /' \ + -e 's/^\[LENT\] /⚠️ /' \ + -e 's/^\[ÉCHEC\] /❌ /' \ + -e 's/^── \(.*\)$/\n### ── \1/' \ + -e 's/^→/ •/' \ + -e 's/^\(Total.*\)$/\n**\1**/' \ + -e 's/^\(Réussis.*\)$/**✅ \1**/' \ + -e 's/^\(Échecs.*\)$/**❌ \1**/' \ + -e 's/^\(❌ ENDPOINTS EN ÉCHEC.*\)$/\n### \1/' \ + -e 's/^\(La PR doit.*\)$/\n**❌ \1**/' \ + -e 's/^╔\(.*\)╗$/```\n╔\1╗/' \ + -e 's/^╚\(.*\)╝$/╚\1╝\n```/') if [ "${FAILED_COUNT:-0}" -gt 0 ]; then HEADER="## ❌ Vérification des performances ÉCHOUÉE" INTRO="${FAILED_COUNT} endpoint(s) ont dépassé 1 seconde ou retourné une erreur serveur." - STATUS="ÉCHEC" + STATUS="❌ ÉCHEC" else HEADER="## ✅ Vérification des performances RÉUSSIE" INTRO="Tous les endpoints ont répondu en moins d'une seconde." - STATUS="SUCCÈS" + STATUS="✅ SUCCÈS" fi BODY=$(cat < Date: Fri, 27 Mar 2026 10:44:03 +0100 Subject: [PATCH 18/30] =?UTF-8?q?feat:=20am=C3=A9liorer=20le=20rapport=20d?= =?UTF-8?q?e=20performance=20en=20simplifiant=20le=20traitement=20des=20r?= =?UTF-8?q?=C3=A9sultats=20et=20en=20ajustant=20le=20format=20Markdown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/pr-endpoint-check.yml | 124 ++++++++++--------------- 1 file changed, 50 insertions(+), 74 deletions(-) diff --git a/.gitea/workflows/pr-endpoint-check.yml b/.gitea/workflows/pr-endpoint-check.yml index e343c7f..11368f2 100644 --- a/.gitea/workflows/pr-endpoint-check.yml +++ b/.gitea/workflows/pr-endpoint-check.yml @@ -49,14 +49,11 @@ jobs: id: perf_test run: | chmod +x scripts/test-endpoints.sh - bash scripts/test-endpoints.sh http://localhost:5038 1000 2>&1 | tee /tmp/webzine_endpoint_output.txt - EXIT_CODE=${PIPESTATUS[0]} - - FAIL_COUNT=$(grep -c "\[ÉCHEC\]\|\[LENT\]" /tmp/webzine_endpoint_output.txt || echo 0) + bash scripts/test-endpoints.sh http://localhost:5038 1000 2>&1 \ + | tee /tmp/webzine_endpoint_output.txt || true + + FAIL_COUNT=$(grep -cE "^\[(LENT|ÉCHEC)\]" /tmp/webzine_rapport_endpoints.txt 2>/dev/null || echo 0) echo "failed=$FAIL_COUNT" >> "$GITHUB_OUTPUT" - echo "exit_code=$EXIT_CODE" >> "$GITHUB_OUTPUT" - - exit $EXIT_CODE - name: Post performance report as PR comment if: always() @@ -66,29 +63,27 @@ jobs: REPO: ${{ gitea.repository }} PR_NUMBER: ${{ gitea.event.pull_request.number }} run: | - # Lire le rapport original - RAW_REPORT=$(cat /tmp/webzine_endpoint_output.txt) + RAW_REPORT=$(cat /tmp/webzine_endpoint_output.txt 2>/dev/null || echo "Aucune sortie capturée.") FAILED_COUNT="${{ steps.perf_test.outputs.failed }}" - - # Convertir le rapport ANSI en Markdown avec couleurs - # Supprimer d'abord les codes ANSI pour le traitement + CLEAN_REPORT=$(echo "$RAW_REPORT" | sed 's/\x1b\[[0-9;]*m//g') - - # Générer le rapport formaté en Markdown avec couleurs + FORMATTED_REPORT=$(echo "$CLEAN_REPORT" | sed \ - -e 's/^\[OK\] /✅ /' \ - -e 's/^\[LENT\] /⚠️ /' \ - -e 's/^\[ÉCHEC\] /❌ /' \ - -e 's/^── \(.*\)$/\n### ── \1/' \ - -e 's/^→/ •/' \ - -e 's/^\(Total.*\)$/\n**\1**/' \ - -e 's/^\(Réussis.*\)$/**✅ \1**/' \ - -e 's/^\(Échecs.*\)$/**❌ \1**/' \ - -e 's/^\(❌ ENDPOINTS EN ÉCHEC.*\)$/\n### \1/' \ - -e 's/^\(La PR doit.*\)$/\n**❌ \1**/' \ - -e 's/^╔\(.*\)╗$/```\n╔\1╗/' \ - -e 's/^╚\(.*\)╝$/╚\1╝\n```/') - + -e 's/^\[OK\] /✅ /' \ + -e 's/^\[LENT\] /⚠️ /' \ + -e 's/^\[ÉCHEC\] /❌ /' \ + -e 's/^→ \[LENT\] / • ⚠️ /' \ + -e 's/^→ \[ÉCHEC\] / • ❌ /' \ + -e 's/^→ / • /' \ + -e 's/^── \(.*\)$/\n### ── \1/' \ + -e 's/^\(Total.*\)$/\n**\1**/' \ + -e 's/^\(Réussis.*\)$/**✅ \1**/' \ + -e 's/^\(Échecs.*\)$/**❌ \1**/' \ + -e 's/^\(❌ ENDPOINTS EN ÉCHEC.*\)$/\n### \1/' \ + -e 's/^\(La PR doit.*\)$/\n**❌ \1**/' \ + -e 's/^╔\(.*\)╗$/```\n╔\1╗/' \ + -e 's/^╚\(.*\)╝$/╚\1╝\n```/') + if [ "${FAILED_COUNT:-0}" -gt 0 ]; then HEADER="## ❌ Vérification des performances ÉCHOUÉE" INTRO="${FAILED_COUNT} endpoint(s) ont dépassé 1 seconde ou retourné une erreur serveur." @@ -98,55 +93,36 @@ jobs: INTRO="Tous les endpoints ont répondu en moins d'une seconde." STATUS="✅ SUCCÈS" fi - + BODY=$(cat < Date: Fri, 27 Mar 2026 10:53:07 +0100 Subject: [PATCH 19/30] =?UTF-8?q?feat:=20am=C3=A9liorer=20le=20format=20du?= =?UTF-8?q?=20rapport=20de=20performance=20en=20ajustant=20l'indentation?= =?UTF-8?q?=20et=20la=20structure=20du=20corps=20du=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/pr-endpoint-check.yml | 56 +++++++++++++------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.gitea/workflows/pr-endpoint-check.yml b/.gitea/workflows/pr-endpoint-check.yml index 11368f2..f7f292f 100644 --- a/.gitea/workflows/pr-endpoint-check.yml +++ b/.gitea/workflows/pr-endpoint-check.yml @@ -95,34 +95,34 @@ jobs: fi BODY=$(cat < Date: Fri, 27 Mar 2026 10:56:06 +0100 Subject: [PATCH 20/30] =?UTF-8?q?feat:=20am=C3=A9liorer=20le=20workflow=20?= =?UTF-8?q?de=20test=20de=20performance=20en=20capturant=20le=20code=20de?= =?UTF-8?q?=20sortie=20et=20en=20formatant=20le=20rapport=20Markdown?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/pr-endpoint-check.yml | 57 +++++++++++++++----------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/.gitea/workflows/pr-endpoint-check.yml b/.gitea/workflows/pr-endpoint-check.yml index f7f292f..4867683 100644 --- a/.gitea/workflows/pr-endpoint-check.yml +++ b/.gitea/workflows/pr-endpoint-check.yml @@ -49,11 +49,14 @@ jobs: id: perf_test run: | chmod +x scripts/test-endpoints.sh - bash scripts/test-endpoints.sh http://localhost:5038 1000 2>&1 \ - | tee /tmp/webzine_endpoint_output.txt || true - - FAIL_COUNT=$(grep -cE "^\[(LENT|ÉCHEC)\]" /tmp/webzine_rapport_endpoints.txt 2>/dev/null || echo 0) + bash scripts/test-endpoints.sh http://localhost:5038 1000 2>&1 | tee /tmp/webzine_endpoint_output.txt + EXIT_CODE=${PIPESTATUS[0]} + + FAIL_COUNT=$(grep -cE "^\[(LENT|ÉCHEC)\]" /tmp/webzine_endpoint_output.txt 2>/dev/null || echo 0) echo "failed=$FAIL_COUNT" >> "$GITHUB_OUTPUT" + echo "exit_code=$EXIT_CODE" >> "$GITHUB_OUTPUT" + + exit $EXIT_CODE - name: Post performance report as PR comment if: always() @@ -63,11 +66,15 @@ jobs: REPO: ${{ gitea.repository }} PR_NUMBER: ${{ gitea.event.pull_request.number }} run: | + # Lire le rapport original RAW_REPORT=$(cat /tmp/webzine_endpoint_output.txt 2>/dev/null || echo "Aucune sortie capturée.") FAILED_COUNT="${{ steps.perf_test.outputs.failed }}" - + + # Convertir le rapport ANSI en Markdown avec couleurs + # Supprimer d'abord les codes ANSI pour le traitement CLEAN_REPORT=$(echo "$RAW_REPORT" | sed 's/\x1b\[[0-9;]*m//g') - + + # Générer le rapport formaté en Markdown avec couleurs FORMATTED_REPORT=$(echo "$CLEAN_REPORT" | sed \ -e 's/^\[OK\] /✅ /' \ -e 's/^\[LENT\] /⚠️ /' \ @@ -83,7 +90,7 @@ jobs: -e 's/^\(La PR doit.*\)$/\n**❌ \1**/' \ -e 's/^╔\(.*\)╗$/```\n╔\1╗/' \ -e 's/^╚\(.*\)╝$/╚\1╝\n```/') - + if [ "${FAILED_COUNT:-0}" -gt 0 ]; then HEADER="## ❌ Vérification des performances ÉCHOUÉE" INTRO="${FAILED_COUNT} endpoint(s) ont dépassé 1 seconde ou retourné une erreur serveur." @@ -93,28 +100,28 @@ jobs: INTRO="Tous les endpoints ont répondu en moins d'une seconde." STATUS="✅ SUCCÈS" fi - - BODY=$(cat < Date: Fri, 27 Mar 2026 11:02:00 +0100 Subject: [PATCH 21/30] =?UTF-8?q?feat:=20am=C3=A9liorer=20le=20workflow=20?= =?UTF-8?q?de=20d=C3=A9ploiement=20en=20ajoutant=20des=20=C3=A9tapes=20de?= =?UTF-8?q?=20d=C3=A9bogage=20pour=20la=20connexion=20SSH=20et=20le=20tran?= =?UTF-8?q?sfert=20de=20fichiers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/deploy.yml | 55 ++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 06193cc..5c52537 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -4,9 +4,6 @@ run-name: Deploy to production by @${{ github.actor }} on: [push] jobs: - # ───────────────────────────────────────────── - # DÉPLOIEMENT — Build et démarrage sur le serveur - # ───────────────────────────────────────────── deploy-production: name: Deploy to Production runs-on: ubuntu-latest @@ -15,25 +12,63 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - # Écriture de la clé SSH - name: Setup SSH key + env: + PROD_SSH_KEY: ${{ secrets.PROD_SSH_KEY }} run: | mkdir -p ~/.ssh - printf '%s\n' "${{ secrets.PROD_SSH_KEY }}" > ~/.ssh/id_prod + echo "$PROD_SSH_KEY" > ~/.ssh/id_prod chmod 600 ~/.ssh/id_prod - ssh-keyscan -p ${{ secrets.PROD_SSH_PORT || 22 }} ${{ secrets.PROD_HOST }} >> ~/.ssh/known_hosts 2>/dev/null - # Compression du code source et transfert vers le serveur + echo "=== [DEBUG] Premiers caractères de la clé ===" + head -1 ~/.ssh/id_prod + tail -1 ~/.ssh/id_prod + + echo "=== [DEBUG] Nombre de lignes ===" + wc -l ~/.ssh/id_prod + + echo "=== [DEBUG] Vérification des caractères spéciaux ===" + cat -A ~/.ssh/id_prod | head -3 + cat -A ~/.ssh/id_prod | tail -3 + + echo "=== [DEBUG] Validation de la clé avec ssh-keygen ===" + ssh-keygen -y -f ~/.ssh/id_prod > /dev/null && echo "Clé valide ✅" || echo "Clé invalide ❌" + + echo "=== [DEBUG] ssh-keyscan sur le serveur ===" + ssh-keyscan -v -p ${{ secrets.PROD_SSH_PORT || 22 }} ${{ secrets.PROD_HOST }} >> ~/.ssh/known_hosts 2>&1 + echo "Exit code ssh-keyscan: $?" + + echo "=== [DEBUG] Contenu known_hosts ===" + cat ~/.ssh/known_hosts + + - name: Test SSH connection + run: | + echo "=== [DEBUG] Test de connexion SSH ===" + ssh -v \ + -i ~/.ssh/id_prod \ + -p ${{ secrets.PROD_SSH_PORT || 22 }} \ + -o StrictHostKeyChecking=no \ + -o ConnectTimeout=10 \ + ${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }} \ + "echo 'Connexion SSH OK ✅ — user: $(whoami), host: $(hostname)'" 2>&1 + echo "Exit code SSH: $?" + - name: Upload source to server run: | + echo "=== [DEBUG] Création de l'archive ===" tar --exclude='.git' --exclude='*.user' -czf /tmp/webzine-src.tar.gz . - scp -i ~/.ssh/id_prod \ + echo "Taille archive: $(du -sh /tmp/webzine-src.tar.gz | cut -f1)" + + echo "=== [DEBUG] Transfert SCP ===" + scp -v \ + -i ~/.ssh/id_prod \ -P ${{ secrets.PROD_SSH_PORT || 22 }} \ -o StrictHostKeyChecking=no \ + -o ConnectTimeout=10 \ /tmp/webzine-src.tar.gz \ - ${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }}:/tmp/webzine-src.tar.gz + ${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }}:/tmp/webzine-src.tar.gz 2>&1 + echo "Exit code SCP: $?" - # Build et redémarrage du conteneur directement sur le serveur - name: Build and deploy on PRODUCTION server run: | ssh -i ~/.ssh/id_prod \ From cba93edc62ab1c7f528bfa8180ad7aebaa4e2cb3 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:12:30 +0100 Subject: [PATCH 22/30] =?UTF-8?q?feat:=20supprimer=20la=20v=C3=A9rificatio?= =?UTF-8?q?n=20de=20performance=20dans=20le=20workflow=20de=20contr=C3=B4l?= =?UTF-8?q?e=20des=20PR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/pr-endpoint-check.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.gitea/workflows/pr-endpoint-check.yml b/.gitea/workflows/pr-endpoint-check.yml index 4867683..ee35d3c 100644 --- a/.gitea/workflows/pr-endpoint-check.yml +++ b/.gitea/workflows/pr-endpoint-check.yml @@ -121,15 +121,4 @@ jobs: -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ -d "$(jq -n --arg body "$BODY" '{body: $body}')" \ - "$GITEA_SERVER_URL/api/v1/repos/$REPO/issues/$PR_NUMBER/comments" - - - name: Enforce performance gate - if: always() - run: | - FAILED="${{ steps.perf_test.outputs.failed }}" - if [ "${FAILED:-0}" -gt 0 ]; then - echo "❌ PR REJETÉE : ${FAILED} endpoint(s) n'ont pas respecté le seuil d'une seconde." - exit 1 - else - echo "✅ Tous les endpoints ont passé le contrôle de performance." - fi \ No newline at end of file + "$GITEA_SERVER_URL/api/v1/repos/$REPO/issues/$PR_NUMBER/comments" \ No newline at end of file From 57e9cd4c79533e4a70edd718739b6749704bd4c0 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 11:20:28 +0100 Subject: [PATCH 23/30] =?UTF-8?q?feat:=20simplifier=20le=20workflow=20de?= =?UTF-8?q?=20v=C3=A9rification=20des=20performances=20en=20supprimant=20d?= =?UTF-8?q?es=20=C3=A9tapes=20inutiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/deploy.yml | 110 ------------------ .gitea/workflows/pr-endpoint-check.yml | 21 +--- .../Controllers/ArtisteController.cs | 3 - 3 files changed, 1 insertion(+), 133 deletions(-) delete mode 100644 .gitea/workflows/deploy.yml diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml deleted file mode 100644 index 5c52537..0000000 --- a/.gitea/workflows/deploy.yml +++ /dev/null @@ -1,110 +0,0 @@ -name: Deploy Webzine -run-name: Deploy to production by @${{ github.actor }} - -on: [push] - -jobs: - deploy-production: - name: Deploy to Production - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup SSH key - env: - PROD_SSH_KEY: ${{ secrets.PROD_SSH_KEY }} - run: | - mkdir -p ~/.ssh - echo "$PROD_SSH_KEY" > ~/.ssh/id_prod - chmod 600 ~/.ssh/id_prod - - echo "=== [DEBUG] Premiers caractères de la clé ===" - head -1 ~/.ssh/id_prod - tail -1 ~/.ssh/id_prod - - echo "=== [DEBUG] Nombre de lignes ===" - wc -l ~/.ssh/id_prod - - echo "=== [DEBUG] Vérification des caractères spéciaux ===" - cat -A ~/.ssh/id_prod | head -3 - cat -A ~/.ssh/id_prod | tail -3 - - echo "=== [DEBUG] Validation de la clé avec ssh-keygen ===" - ssh-keygen -y -f ~/.ssh/id_prod > /dev/null && echo "Clé valide ✅" || echo "Clé invalide ❌" - - echo "=== [DEBUG] ssh-keyscan sur le serveur ===" - ssh-keyscan -v -p ${{ secrets.PROD_SSH_PORT || 22 }} ${{ secrets.PROD_HOST }} >> ~/.ssh/known_hosts 2>&1 - echo "Exit code ssh-keyscan: $?" - - echo "=== [DEBUG] Contenu known_hosts ===" - cat ~/.ssh/known_hosts - - - name: Test SSH connection - run: | - echo "=== [DEBUG] Test de connexion SSH ===" - ssh -v \ - -i ~/.ssh/id_prod \ - -p ${{ secrets.PROD_SSH_PORT || 22 }} \ - -o StrictHostKeyChecking=no \ - -o ConnectTimeout=10 \ - ${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }} \ - "echo 'Connexion SSH OK ✅ — user: $(whoami), host: $(hostname)'" 2>&1 - echo "Exit code SSH: $?" - - - name: Upload source to server - run: | - echo "=== [DEBUG] Création de l'archive ===" - tar --exclude='.git' --exclude='*.user' -czf /tmp/webzine-src.tar.gz . - echo "Taille archive: $(du -sh /tmp/webzine-src.tar.gz | cut -f1)" - - echo "=== [DEBUG] Transfert SCP ===" - scp -v \ - -i ~/.ssh/id_prod \ - -P ${{ secrets.PROD_SSH_PORT || 22 }} \ - -o StrictHostKeyChecking=no \ - -o ConnectTimeout=10 \ - /tmp/webzine-src.tar.gz \ - ${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }}:/tmp/webzine-src.tar.gz 2>&1 - echo "Exit code SCP: $?" - - - name: Build and deploy on PRODUCTION server - run: | - ssh -i ~/.ssh/id_prod \ - -p ${{ secrets.PROD_SSH_PORT || 22 }} \ - -o StrictHostKeyChecking=no \ - ${{ secrets.PROD_USER }}@${{ secrets.PROD_HOST }} << 'ENDSSH' - set -e - - echo "=== [PROD] Extraction des sources ===" - mkdir -p /opt/webzine/prod/src - tar -xzf /tmp/webzine-src.tar.gz -C /opt/webzine/prod/src/ - rm /tmp/webzine-src.tar.gz - - echo "=== [PROD] Construction de l'image ===" - docker build \ - -t webzine:latest \ - -f /opt/webzine/prod/src/Webzine.WebApplication/Dockerfile \ - /opt/webzine/prod/src/ - - echo "=== [PROD] Arrêt de l'ancien conteneur ===" - docker stop webzine-prod 2>/dev/null || true - docker rm webzine-prod 2>/dev/null || true - - echo "=== [PROD] Démarrage du nouveau conteneur ===" - docker run -d \ - --name webzine-prod \ - --restart unless-stopped \ - -p 80:8080 \ - -p 443:8081 \ - -v /opt/webzine/prod/data:/app/Data \ - -v /opt/webzine/prod/logs:/Logs \ - -e ASPNETCORE_ENVIRONMENT=Production \ - webzine:latest - - echo "=== [PROD] Nettoyage des anciennes images ===" - docker image prune -f - - echo "=== [PROD] Déploiement terminé ===" - ENDSSH \ No newline at end of file diff --git a/.gitea/workflows/pr-endpoint-check.yml b/.gitea/workflows/pr-endpoint-check.yml index ee35d3c..cd56ec6 100644 --- a/.gitea/workflows/pr-endpoint-check.yml +++ b/.gitea/workflows/pr-endpoint-check.yml @@ -26,8 +26,7 @@ jobs: run: | dotnet test Webzine.Entity.Tests/Webzine.Entity.Tests.csproj \ --no-build \ - --configuration Release \ - --logger "console;verbosity=normal" + --configuration Release - name: Start Webzine application run: | @@ -66,7 +65,6 @@ jobs: REPO: ${{ gitea.repository }} PR_NUMBER: ${{ gitea.event.pull_request.number }} run: | - # Lire le rapport original RAW_REPORT=$(cat /tmp/webzine_endpoint_output.txt 2>/dev/null || echo "Aucune sortie capturée.") FAILED_COUNT="${{ steps.perf_test.outputs.failed }}" @@ -91,27 +89,10 @@ jobs: -e 's/^╔\(.*\)╗$/```\n╔\1╗/' \ -e 's/^╚\(.*\)╝$/╚\1╝\n```/') - if [ "${FAILED_COUNT:-0}" -gt 0 ]; then - HEADER="## ❌ Vérification des performances ÉCHOUÉE" - INTRO="${FAILED_COUNT} endpoint(s) ont dépassé 1 seconde ou retourné une erreur serveur." - STATUS="❌ ÉCHEC" - else - HEADER="## ✅ Vérification des performances RÉUSSIE" - INTRO="Tous les endpoints ont répondu en moins d'une seconde." - STATUS="✅ SUCCÈS" - fi - BODY=$(cat < Date: Fri, 27 Mar 2026 11:47:26 +0100 Subject: [PATCH 24/30] fix: enable database usage in appsettings.json --- Webzine.WebApplication/appsettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Webzine.WebApplication/appsettings.json b/Webzine.WebApplication/appsettings.json index de9ba91..135dde8 100644 --- a/Webzine.WebApplication/appsettings.json +++ b/Webzine.WebApplication/appsettings.json @@ -10,7 +10,7 @@ "NombreDerniereChronique": 3, "NombreDeTopTitres": 3 }, - "UseDatabase": false, + "UseDatabase": true, "ConnectionStrings": { "DefaultConnection": "Data Source=Data/webzine.sqlite" }, From 15d8176c97d9fb0063c4f5d34fbe3627cff4c28d Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 12:29:35 +0100 Subject: [PATCH 25/30] =?UTF-8?q?feat:=20mettre=20=C3=A0=20jour=20le=20flu?= =?UTF-8?q?x=20de=20travail=20de=20d=C3=A9ploiement=20pour=20d=C3=A9clench?= =?UTF-8?q?er=20sur=20la=20branche=20principale=20et=20am=C3=A9liorer=20le?= =?UTF-8?q?=20processus=20de=20transfert=20de=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Webzine.Repository/DbArtisteRepository.cs | 6 ------ .../Controllers/ArtisteController.cs | 17 +++++++---------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/Webzine.Repository/DbArtisteRepository.cs b/Webzine.Repository/DbArtisteRepository.cs index 5f298a3..b87a6b3 100644 --- a/Webzine.Repository/DbArtisteRepository.cs +++ b/Webzine.Repository/DbArtisteRepository.cs @@ -103,12 +103,6 @@ namespace Webzine.Repository .Include(a => a.Titres) .FirstOrDefault(a => a.Nom == nom); - if (artiste == null) - { - this.logger.LogWarning("Pas d'artiste au nom {Nom}", nom); - artiste = new Artiste(); - } - return artiste; } catch (Exception ex) diff --git a/Webzine.WebApplication/Controllers/ArtisteController.cs b/Webzine.WebApplication/Controllers/ArtisteController.cs index 6f395d2..74165a7 100644 --- a/Webzine.WebApplication/Controllers/ArtisteController.cs +++ b/Webzine.WebApplication/Controllers/ArtisteController.cs @@ -36,7 +36,7 @@ if (string.IsNullOrEmpty(nom)) { this.logger.LogWarning("Nom de l'artiste manquant dans la requête."); - return RedirectToAction("Index"); + return this.RedirectToAction("Index", "Accueil"); } // On transforme "fatal-bazooka" en "Fatal Bazooka" pour la factory @@ -46,26 +46,23 @@ // On appelle la factory pour obtenir l'artiste unique var artiste = this._artisteRepository.FindByName(nomPropre); + // Check if artiste was found if (artiste == null) { - this.logger.LogWarning("Artiste non trouvé pour le nom : {NomArtiste}", nomPropre); - return RedirectToAction("Index"); + this.logger.LogWarning("Artiste non trouvé avec le nom : {NomArtiste}", nomPropre); + return this.RedirectToAction("Index", "Accueil"); } + var viewModel = new ArtisteDetailsViewModel { IdArtiste = artiste.IdArtiste, Nom = artiste.Nom, Biographie = artiste.Biographie, - // On effectue le groupement ici une bonne fois pour toutes - AlbumsGroupes = artiste.Titres - .OrderBy(t => t.Libelle) - .GroupBy(t => t.Album) - .OrderBy(g => g.Key), + AlbumsGroupes = artiste.Titres.GroupBy(t => t.Album), }; this.logger.LogInformation("Artiste trouvé : {NomArtiste}", nom); - - return View(viewModel); + return this.View(viewModel); } } } From 54d656824226b5119ec9aaa9eef7809aa372dabb Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 13:13:54 +0100 Subject: [PATCH 26/30] fix: update endpoint check script to differentiate between failures and slow endpoints --- .gitea/workflows/pr-endpoint-check.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/pr-endpoint-check.yml b/.gitea/workflows/pr-endpoint-check.yml index cd56ec6..39d8249 100644 --- a/.gitea/workflows/pr-endpoint-check.yml +++ b/.gitea/workflows/pr-endpoint-check.yml @@ -51,11 +51,17 @@ jobs: bash scripts/test-endpoints.sh http://localhost:5038 1000 2>&1 | tee /tmp/webzine_endpoint_output.txt EXIT_CODE=${PIPESTATUS[0]} - FAIL_COUNT=$(grep -cE "^\[(LENT|ÉCHEC)\]" /tmp/webzine_endpoint_output.txt 2>/dev/null || echo 0) - echo "failed=$FAIL_COUNT" >> "$GITHUB_OUTPUT" - echo "exit_code=$EXIT_CODE" >> "$GITHUB_OUTPUT" + # Count failures (but not slow endpoints as failures) + FAIL_COUNT=$(grep -cE "^\[ÉCHEC\]" /tmp/webzine_endpoint_output.txt 2>/dev/null || echo 0) + SLOW_COUNT=$(grep -cE "^\[LENT\]" /tmp/webzine_endpoint_output.txt 2>/dev/null || echo 0) - exit $EXIT_CODE + echo "failed=$FAIL_COUNT" >> "$GITHUB_OUTPUT" + echo "slow=$SLOW_COUNT" >> "$GITHUB_OUTPUT" + + # Only fail if there are actual failures + if [ $FAIL_COUNT -gt 0 ]; then + exit 1 + fi - name: Post performance report as PR comment if: always() From 8bd17f628dce3a6ce868368a83b85ad18a7ef326 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 13:14:55 +0100 Subject: [PATCH 27/30] chore: supression du CI/CD Demo --- .gitea/workflows/demo.yml | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 .gitea/workflows/demo.yml diff --git a/.gitea/workflows/demo.yml b/.gitea/workflows/demo.yml deleted file mode 100644 index 21add6c..0000000 --- a/.gitea/workflows/demo.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Gitea Actions Demo -run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 -on: workflow_dispatch - -jobs: - Explore-Gitea-Actions: - runs-on: ubuntu-latest - steps: - - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - - name: Check out repository code - uses: actions/checkout@v4 - - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository - run: | - ls ${{ gitea.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." \ No newline at end of file From a18af7537ebf3252ac677590203b2f36a5f153b5 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 13:17:42 +0100 Subject: [PATCH 28/30] feat: configure appsettings for CI by enabling database usage and setting SQLite --- .gitea/workflows/pr-endpoint-check.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.gitea/workflows/pr-endpoint-check.yml b/.gitea/workflows/pr-endpoint-check.yml index 39d8249..1975e45 100644 --- a/.gitea/workflows/pr-endpoint-check.yml +++ b/.gitea/workflows/pr-endpoint-check.yml @@ -11,6 +11,21 @@ jobs: - name: Checkout PR branch uses: actions/checkout@v4 + - name: Configure appsettings for CI + run: | + # Find the appsettings.json file + APPSETTINGS_PATH="Webzine.WebApplication/appsettings.json" + + # Backup original file + cp $APPSETTINGS_PATH $APPSETTINGS_PATH.bak + + # Use jq to modify the JSON + jq '.UseDatabase = true | .IsSQLite = true' $APPSETTINGS_PATH > $APPSETTINGS_PATH.tmp + mv $APPSETTINGS_PATH.tmp $APPSETTINGS_PATH + + echo "Updated appsettings.json:" + cat $APPSETTINGS_PATH + - name: Setup .NET 10 uses: actions/setup-dotnet@v4 with: From b8efa61e08dace42f4cc022e59ab5e263b197815 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 13:29:18 +0100 Subject: [PATCH 29/30] fix: enhance performance check to account for slow endpoints and improve reporting --- .gitea/workflows/pr-endpoint-check.yml | 48 +++++++++++++++++++------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/pr-endpoint-check.yml b/.gitea/workflows/pr-endpoint-check.yml index 1975e45..427f687 100644 --- a/.gitea/workflows/pr-endpoint-check.yml +++ b/.gitea/workflows/pr-endpoint-check.yml @@ -57,7 +57,7 @@ jobs: sleep 1 done ' - echo "Application prête !" + echo "Application prête!" - name: Test endpoint response times id: perf_test @@ -66,20 +66,23 @@ jobs: bash scripts/test-endpoints.sh http://localhost:5038 1000 2>&1 | tee /tmp/webzine_endpoint_output.txt EXIT_CODE=${PIPESTATUS[0]} - # Count failures (but not slow endpoints as failures) + # Count failures FAIL_COUNT=$(grep -cE "^\[ÉCHEC\]" /tmp/webzine_endpoint_output.txt 2>/dev/null || echo 0) SLOW_COUNT=$(grep -cE "^\[LENT\]" /tmp/webzine_endpoint_output.txt 2>/dev/null || echo 0) echo "failed=$FAIL_COUNT" >> "$GITHUB_OUTPUT" echo "slow=$SLOW_COUNT" >> "$GITHUB_OUTPUT" - # Only fail if there are actual failures - if [ $FAIL_COUNT -gt 0 ]; then + # Échoue s’il y a DES problèmes (échecs OU lents) + if [ $FAIL_COUNT -gt 0 ] || [ $SLOW_COUNT -gt 0 ]; then + echo "❌ Performance check failed: $FAIL_COUNT endpoint(s) failed, $SLOW_COUNT endpoint(s) exceeded threshold (1000ms)" exit 1 fi + + echo "✅ All endpoints passed performance check (< 1000ms)" - name: Post performance report as PR comment - if: always() + if: always() # Always post comment, even on failure env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_SERVER_URL: ${{ gitea.server_url }} @@ -88,12 +91,21 @@ jobs: run: | RAW_REPORT=$(cat /tmp/webzine_endpoint_output.txt 2>/dev/null || echo "Aucune sortie capturée.") FAILED_COUNT="${{ steps.perf_test.outputs.failed }}" + SLOW_COUNT="${{ steps.perf_test.outputs.slow }}" - # Convertir le rapport ANSI en Markdown avec couleurs - # Supprimer d'abord les codes ANSI pour le traitement + # Determine if the check passed or failed + if [ "$FAILED_COUNT" -gt 0 ] || [ "$SLOW_COUNT" -gt 0 ]; then + STATUS_HEADER="❌ **PERFORMANCE CHECK FAILED**" + STATUS_ICON="❌" + else + STATUS_HEADER="✅ **PERFORMANCE CHECK PASSED**" + STATUS_ICON="✅" + fi + + # Convert report to Markdown with colors CLEAN_REPORT=$(echo "$RAW_REPORT" | sed 's/\x1b\[[0-9;]*m//g') - # Générer le rapport formaté en Markdown avec couleurs + # Generate formatted report FORMATTED_REPORT=$(echo "$CLEAN_REPORT" | sed \ -e 's/^\[OK\] /✅ /' \ -e 's/^\[LENT\] /⚠️ /' \ @@ -105,16 +117,22 @@ jobs: -e 's/^\(Total.*\)$/\n**\1**/' \ -e 's/^\(Réussis.*\)$/**✅ \1**/' \ -e 's/^\(Échecs.*\)$/**❌ \1**/' \ + -e 's/^\(⚠️ ENDPOINTS LENTS.*\)$/\n### \1/' \ -e 's/^\(❌ ENDPOINTS EN ÉCHEC.*\)$/\n### \1/' \ - -e 's/^\(La PR doit.*\)$/\n**❌ \1**/' \ - -e 's/^╔\(.*\)╗$/```\n╔\1╗/' \ - -e 's/^╚\(.*\)╝$/╚\1╝\n```/') + -e 's/^\(La PR doit.*\)$/\n**❌ \1**/') BODY=$(cat </dev/null || echo 0) + - ⚠️ Endpoints lents (>1000ms): $SLOW_COUNT + - ❌ Endpoints en échec: $FAILED_COUNT + **Vérifié par**: Workflow PR Endpoint Performance EOF ) @@ -123,4 +141,10 @@ jobs: -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ -d "$(jq -n --arg body "$BODY" '{body: $body}')" \ - "$GITEA_SERVER_URL/api/v1/repos/$REPO/issues/$PR_NUMBER/comments" \ No newline at end of file + "$GITEA_SERVER_URL/api/v1/repos/$REPO/issues/$PR_NUMBER/comments" + + - name: Fail job if performance issues detected + if: steps.perf_test.outputs.failed > 0 || steps.perf_test.outputs.slow > 0 + run: | + echo "❌ Job failed due to performance issues" + exit 1 \ No newline at end of file From bc18311155f89da73b8d563395fdf55cc4794448 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 13:34:53 +0100 Subject: [PATCH 30/30] fix: trie les titres par label avant de regrouper par album dans ArtisteController --- Webzine.WebApplication/Controllers/ArtisteController.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Webzine.WebApplication/Controllers/ArtisteController.cs b/Webzine.WebApplication/Controllers/ArtisteController.cs index 74165a7..900ec19 100644 --- a/Webzine.WebApplication/Controllers/ArtisteController.cs +++ b/Webzine.WebApplication/Controllers/ArtisteController.cs @@ -58,7 +58,10 @@ IdArtiste = artiste.IdArtiste, Nom = artiste.Nom, Biographie = artiste.Biographie, - AlbumsGroupes = artiste.Titres.GroupBy(t => t.Album), + AlbumsGroupes = artiste.Titres + .OrderBy(t => t.Libelle) + .GroupBy(t => t.Album) + .OrderBy(g => g.Key), }; this.logger.LogInformation("Artiste trouvé : {NomArtiste}", nom);