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] =?UTF-8?q?feat:=20am=C3=A9liorer=20le=20rapport=20de=20pe?= =?UTF-8?q?rformance=20des=20endpoints=20en=20utilisant=20un=20fichier=20d?= =?UTF-8?q?e=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."