From c4ea476795410556c57c1b948805caf5ff26a656 Mon Sep 17 00:00:00 2001 From: mirage <119869686+ClementBobin@users.noreply.github.com> Date: Fri, 27 Mar 2026 10:56:06 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20am=C3=A9liorer=20le=20workflow=20de=20t?= =?UTF-8?q?est=20de=20performance=20en=20capturant=20le=20code=20de=20sort?= =?UTF-8?q?ie=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 <