You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2026/04/08 14:04:22 UTC

(pulsar) branch master updated: [improve][ci] Include XML test reports in CI artifacts and generate HTML index (#25484)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new d052de05eb6 [improve][ci] Include XML test reports in CI artifacts and generate HTML index (#25484)
d052de05eb6 is described below

commit d052de05eb67c4eadfcb4349f5b6da9ceb5ecd60
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Wed Apr 8 17:04:15 2026 +0300

    [improve][ci] Include XML test reports in CI artifacts and generate HTML index (#25484)
---
 .github/actions/copy-test-reports/action.yml |  3 +-
 .github/workflows/pulsar-ci-flaky.yaml       |  8 ++--
 .github/workflows/pulsar-ci.yaml             |  6 +++
 pulsar-build/pulsar_ci_tool.sh               | 59 ++++++++++++++++++++++++++++
 4 files changed, 72 insertions(+), 4 deletions(-)

diff --git a/.github/actions/copy-test-reports/action.yml b/.github/actions/copy-test-reports/action.yml
index c66e2000f5c..e043006eb4c 100644
--- a/.github/actions/copy-test-reports/action.yml
+++ b/.github/actions/copy-test-reports/action.yml
@@ -18,10 +18,11 @@
 #
 
 name: Copy test reports
-description: Aggregates all test reports to ./test-reports and ./surefire-reports directories
+description: Aggregates all test reports to ./test-reports directory and generates an HTML index
 runs:
   using: composite
   steps:
     - run: |
         $GITHUB_WORKSPACE/pulsar-build/pulsar_ci_tool.sh move_test_reports
+        $GITHUB_WORKSPACE/pulsar-build/pulsar_ci_tool.sh generate_test_report_index
       shell: bash
diff --git a/.github/workflows/pulsar-ci-flaky.yaml b/.github/workflows/pulsar-ci-flaky.yaml
index 0ee38264d1e..dd58a31b478 100644
--- a/.github/workflows/pulsar-ci-flaky.yaml
+++ b/.github/workflows/pulsar-ci-flaky.yaml
@@ -158,11 +158,11 @@ jobs:
       COLLECT_COVERAGE: "${{ needs.preconditions.outputs.collect_coverage }}"
       CI_JDK_MAJOR_VERSION: ${{ needs.preconditions.outputs.jdk_major_version }}
       TRACE_TEST_RESOURCE_CLEANUP: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.trace_test_resource_cleanup || 'off' }}
-      TRACE_TEST_RESOURCE_CLEANUP_DIR: ${{ github.workspace }}/target/trace-test-resource-cleanup
+      TRACE_TEST_RESOURCE_CLEANUP_DIR: ${{ github.workspace }}/build/trace-test-resource-cleanup
       THREAD_LEAK_DETECTOR_WAIT_MILLIS: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.thread_leak_detector_wait_millis || 10000 }}
-      THREAD_LEAK_DETECTOR_DIR: ${{ github.workspace }}/target/thread-leak-dumps
+      THREAD_LEAK_DETECTOR_DIR: ${{ github.workspace }}/build/thread-leak-dumps
       NETTY_LEAK_DETECTION: "${{ needs.preconditions.outputs.netty_leak_detection }}"
-      NETTY_LEAK_DUMP_DIR: ${{ github.workspace }}/target/netty-leak-dumps
+      NETTY_LEAK_DUMP_DIR: ${{ github.workspace }}/build/netty-leak-dumps
     runs-on: ubuntu-24.04
     timeout-minutes: 100
     if: ${{ needs.preconditions.outputs.docs_only != 'true' }}
@@ -227,6 +227,7 @@ jobs:
         with:
           name: Unit-BROKER_FLAKY-test-reports
           path: |
+            test-reports/
             **/build/reports/tests/
           retention-days: 7
           if-no-files-found: ignore
@@ -240,6 +241,7 @@ jobs:
             /tmp/*.hprof
             **/hs_err_*.log
             **/core.*
+            build/threaddumps/
             ${{ env.NETTY_LEAK_DUMP_DIR }}/*
             ${{ env.TRACE_TEST_RESOURCE_CLEANUP_DIR }}/*
             ${{ env.THREAD_LEAK_DETECTOR_DIR }}/*
diff --git a/.github/workflows/pulsar-ci.yaml b/.github/workflows/pulsar-ci.yaml
index 5bca41ace15..39e675ba7e1 100644
--- a/.github/workflows/pulsar-ci.yaml
+++ b/.github/workflows/pulsar-ci.yaml
@@ -335,6 +335,7 @@ jobs:
         with:
           name: Unit-${{ matrix.group }}-test-reports
           path: |
+            test-reports/
             **/build/reports/tests/
           retention-days: 7
           if-no-files-found: ignore
@@ -348,6 +349,7 @@ jobs:
             /tmp/*.hprof
             **/hs_err_*.log
             **/core.*
+            build/threaddumps/
             ${{ env.NETTY_LEAK_DUMP_DIR }}/*
             ${{ env.TRACE_TEST_RESOURCE_CLEANUP_DIR }}/*
             ${{ env.THREAD_LEAK_DETECTOR_DIR }}/*
@@ -577,6 +579,7 @@ jobs:
         with:
           name: Integration-${{ matrix.upload_name || matrix.group }}-test-reports
           path: |
+            test-reports/
             **/build/reports/tests/
           retention-days: 7
           if-no-files-found: ignore
@@ -590,6 +593,7 @@ jobs:
             /tmp/*.hprof
             **/hs_err_*.log
             **/core.*
+            build/threaddumps/
           retention-days: 7
           if-no-files-found: ignore
 
@@ -793,6 +797,7 @@ jobs:
         with:
           name: System-${{ matrix.group }}-test-reports
           path: |
+            test-reports/
             **/build/reports/tests/
           retention-days: 7
           if-no-files-found: ignore
@@ -806,6 +811,7 @@ jobs:
             /tmp/*.hprof
             **/hs_err_*.log
             **/core.*
+            build/threaddumps/
           retention-days: 7
           if-no-files-found: ignore
 
diff --git a/pulsar-build/pulsar_ci_tool.sh b/pulsar-build/pulsar_ci_tool.sh
index 5c2d8c62049..16a760f37e7 100755
--- a/pulsar-build/pulsar_ci_tool.sh
+++ b/pulsar-build/pulsar_ci_tool.sh
@@ -35,11 +35,21 @@ function ci_list_functions() {
 # prints thread dumps for all running JVMs
 # used in CI when a job gets cancelled because of a job timeout
 function ci_print_thread_dumps() {
+  local dump_dir=""
+  if [[ "$GITHUB_ACTIONS" == "true" ]]; then
+    dump_dir="${GITHUB_WORKSPACE}/build/threaddumps"
+    mkdir -p "$dump_dir"
+  fi
   for java_pid in $(jps -q -J-XX:+PerfDisableSharedMem); do
     echo "----------------------- pid $java_pid -----------------------"
     cat /proc/$java_pid/cmdline | xargs -0 echo
     jcmd $java_pid Thread.print -l
     jcmd $java_pid GC.heap_info
+    if [ -n "$dump_dir" ]; then
+      cat /proc/$java_pid/cmdline | xargs -0 echo > "$dump_dir/cmdline_$java_pid.txt"
+      jcmd $java_pid Thread.print -l > "$dump_dir/threaddump_$java_pid.txt"
+      jcmd $java_pid GC.heap_info > "$dump_dir/heapinfo_$java_pid.txt"
+    fi
   done
   return 0
 }
@@ -110,6 +120,55 @@ function ci_move_test_reports() {
   )
 }
 
+# generates a top-level index.html that links to each module's HTML test report
+function ci_generate_test_report_index() {
+  (
+    if [ -n "${GITHUB_WORKSPACE}" ]; then
+      cd "${GITHUB_WORKSPACE}"
+    fi
+    local index_file="test-reports/index.html"
+    mkdir -p "$(dirname "$index_file")"
+    local found_reports=()
+    while IFS= read -r -d '' report; do
+      found_reports+=("$report")
+    done < <(find . -path '*/build/reports/tests/test/index.html' -not -path './build/*' -print0 | sort -z)
+    if [ ${#found_reports[@]} -eq 0 ]; then
+      echo "No HTML test reports found."
+      return 0
+    fi
+    cat > "$index_file" <<'HEADER'
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>Test Reports Index</title>
+<style>
+body { font-family: sans-serif; margin: 2em; }
+a { text-decoration: none; color: #0366d6; }
+a:hover { text-decoration: underline; }
+li { margin: 0.3em 0; }
+</style>
+</head>
+<body>
+<h1>Test Reports</h1>
+<ul>
+HEADER
+    for report in "${found_reports[@]}"; do
+      # strip leading ./
+      local rel_path="${report#./}"
+      # extract module name (everything before /build/reports/tests/test/index.html)
+      local module_name="${rel_path%%/build/reports/tests/test/index.html}"
+      echo "  <li><a href=\"../${rel_path}\">${module_name}</a></li>" >> "$index_file"
+    done
+    cat >> "$index_file" <<'FOOTER'
+</ul>
+</body>
+</html>
+FOOTER
+    echo "Generated test report index at $index_file with ${#found_reports[@]} module(s)."
+  )
+}
+
 ci_report_netty_leaks() {
   if [ -z "$NETTY_LEAK_DUMP_DIR" ]; then
     echo "NETTY_LEAK_DUMP_DIR isn't set"