feat: améliorer le rapport de performance des endpoints en utilisant un fichier de rapport généré
This commit is contained in:
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user