]> OCCT Git - occt.git/commitdiff
Testing - Add performance summary posting to PR (#612)
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Sun, 13 Jul 2025 11:55:30 +0000 (12:55 +0100)
committerGitHub <noreply@github.com>
Sun, 13 Jul 2025 11:55:30 +0000 (12:55 +0100)
.github/actions/test-summary/action.yml

index 119479d6cc740e8e506399d45b94e92a3aa592e4..26bf0cfed6c4f8669eeacfc397ebef5f12801826 100644 (file)
@@ -99,3 +99,36 @@ runs:
           install/bin/results/**/summary.html
           install/bin/results/**/tests.log
           install/bin/results/**/*.png
+
+    - name: Post performance summary to PR
+      if: github.repository == 'Open-Cascade-SAS/OCCT' && github.head_ref == 'IR' && github.base_ref == 'master'
+      env:
+        GH_TOKEN: ${{ github.token }}
+        PR_NUMBER: ${{ github.event.pull_request.number }}
+      run: |
+        COMMENT_FILE=$(mktemp)
+        
+        # Get commit ID and commit header
+        COMMIT_ID=$(git rev-parse HEAD)
+        COMMIT_HEADER=$(git log -1 --pretty=%s)
+        
+        echo -e "**Performance Test Summary**\n" > "$COMMENT_FILE"
+        echo -e "**Commit**: \`${COMMIT_ID}\`\n" >> "$COMMENT_FILE"
+        echo -e "**Title**: ${COMMIT_HEADER}\n" >> "$COMMENT_FILE"
+        
+        LOG_FILES=$(find install/bin/results/current -name "diff-*.log")
+        if [ -z "$LOG_FILES" ]; then
+          echo "No diff logs found." >> "$COMMENT_FILE"
+        else
+          for log_file in $LOG_FILES; do
+            PLATFORM=$(basename $(dirname "$log_file"))
+            echo "**Platform: ${PLATFORM}**" >> "$COMMENT_FILE"
+            echo '```' >> "$COMMENT_FILE"
+            grep -E "Total (MEMORY|CPU|IMAGE) difference:" "$log_file" >> "$COMMENT_FILE" || echo "No performance summary found." >> "$COMMENT_FILE"
+            echo '```' >> "$COMMENT_FILE"
+            echo "" >> "$COMMENT_FILE"
+          done
+        fi
+        gh pr comment ${PR_NUMBER} --body-file "$COMMENT_FILE"
+        rm "$COMMENT_FILE"
+      shell: bash