You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ni...@apache.org on 2022/09/09 07:53:24 UTC

[pulsar] 05/08: [improve][CI] Replace test reporting with less verbose solution (#17319)

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

nicoloboschi pushed a commit to branch branch-2.11
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit 3f17dd6e4972041bfc7803ec3e6458ed9c673b83
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Tue Aug 30 13:29:39 2022 +0300

    [improve][CI] Replace test reporting with less verbose solution (#17319)
    
    Fixes #16736
    
    * [improve][CI] Replace test reporting with less verbose solution
    
    - uses https://github.com/mikepenz/action-junit-report which has been
      copied to https://github.com/apache/pulsar-test-infra/tree/master/action-junit-report
    
    * Address review comment: remove merge-test-reports action
    
    (cherry picked from commit cb881d47f7e5c561ac0e2c76e525b8b5a8a9aaef)
---
 .github/actions/merge-test-reports/action.yml | 44 -----------------------
 .github/workflows/pulsar-ci-test-report.yaml  | 39 --------------------
 .github/workflows/pulsar-ci.yaml              | 51 ++++++++-------------------
 3 files changed, 15 insertions(+), 119 deletions(-)

diff --git a/.github/actions/merge-test-reports/action.yml b/.github/actions/merge-test-reports/action.yml
deleted file mode 100644
index 154e834383c..00000000000
--- a/.github/actions/merge-test-reports/action.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-name: Merge test reports to a single file
-description: Merges junit test reports to a single file
-inputs:
-  summary_title:
-    description: 'The title for the summary'
-    required: false
-runs:
-  using: composite
-  steps:
-    - run: |
-        if ls test-reports/*.xml 2>/dev/null; then
-          echo '::group::Installing tooling...'
-          # this requires "runs-on: ubuntu-20.04" since junitparser package is not available in previous Ubuntu version
-          sudo apt-get -y install xmlstarlet junitparser >/dev/null
-          echo '::endgroup::'
-          echo '::group::Parsing and merging test reports...'
-          junitparser merge test-reports/*.xml merged-test-report.xml || true
-          echo '::endgroup::'
-          if [[ -f merged-test-report.xml && -n "${{ inputs.summary_title }}" ]]; then
-            xmlstarlet sel -T -t -m /testsuites -o "::warning::${{ inputs.summary_title }} " -v '@tests' -o ' tests, ' -v '@failures' -o ' failures, ' -v '@errors' -o ' errors, ' -v '@skipped' -o ' skipped, duration ' -v 'number(@time)' -o 's'  merged-test-report.xml
-          fi
-        else
-          echo 'No test-reports/*.xml files found.'
-        fi
-      shell: bash
diff --git a/.github/workflows/pulsar-ci-test-report.yaml b/.github/workflows/pulsar-ci-test-report.yaml
deleted file mode 100644
index 47feb949166..00000000000
--- a/.github/workflows/pulsar-ci-test-report.yaml
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-name: 'Pulsar CI Test Report'
-on:
-  workflow_run:
-    workflows: ['Pulsar CI']    # runs after Pulsar CI workflow
-    types:
-      - completed
-jobs:
-  report:
-    runs-on: ubuntu-20.04
-    steps:
-      - uses: apache/pulsar-test-infra/test-reporter@master
-        with:
-          artifact: /(.*)-test-report/
-          name: '$1 Tests'
-          path: '*.xml'
-          reporter: java-junit
-          max-annotations: 50
-          token: ${{ secrets.GITHUB_TOKEN }}
-          fail-on-error: false
-          only-summary: true
diff --git a/.github/workflows/pulsar-ci.yaml b/.github/workflows/pulsar-ci.yaml
index f008b2383ab..65698a014c3 100644
--- a/.github/workflows/pulsar-ci.yaml
+++ b/.github/workflows/pulsar-ci.yaml
@@ -224,19 +224,12 @@ jobs:
         if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
         uses: ./.github/actions/copy-test-reports
 
-      - name: Report test summary as warning
+      - name: Publish Test Report
+        uses: apache/pulsar-test-infra/action-junit-report@master
         if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
-        uses: ./.github/actions/merge-test-reports
         with:
-          summary_title: 'Test Summary for Unit - ${{ matrix.name }}:'
-
-      - name: Publish the Test reports in Junit xml format
-        uses: actions/upload-artifact@v3
-        if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
-        with:
-          name: Unit-${{ matrix.group }}-test-report
-          path: test-reports
-          retention-days: 7
+          report_paths: 'test-reports/TEST-*.xml'
+          annotate_only: 'true'
 
       - name: Upload Surefire reports
         uses: actions/upload-artifact@v3
@@ -449,19 +442,12 @@ jobs:
         if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
         uses: ./.github/actions/copy-test-reports
 
-      - name: Report test summary as warning
+      - name: Publish Test Report
+        uses: apache/pulsar-test-infra/action-junit-report@master
         if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
-        uses: ./.github/actions/merge-test-reports
         with:
-          summary_title: 'Test Summary for Integration - ${{ matrix.name }}:'
-
-      - name: Publish the Test reports in Junit xml format
-        uses: actions/upload-artifact@v3
-        if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
-        with:
-          name: Integration-${{ matrix.group }}-test-report
-          path: test-reports
-          retention-days: 7
+          report_paths: 'test-reports/TEST-*.xml'
+          annotate_only: 'true'
 
       - name: Upload Surefire reports
         uses: actions/upload-artifact@v3
@@ -692,26 +678,19 @@ jobs:
         run: $GITHUB_WORKSPACE/build/pulsar_ci_tool.sh print_thread_dumps
 
       - name: Aggregates all test reports to ./test-reports and ./surefire-reports directories
-        if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' }}
+        if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
         uses: ./.github/actions/copy-test-reports
 
-      - name: Report test summary as warning
-        if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' }}
-        uses: ./.github/actions/merge-test-reports
-        with:
-          summary_title: 'Test Summary for System - ${{ matrix.name }}:'
-
-      - name: Publish the Test reports in Junit xml format
-        uses: actions/upload-artifact@v3
-        if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' }}
+      - name: Publish Test Report
+        uses: apache/pulsar-test-infra/action-junit-report@master
+        if: ${{ always() && needs.changed_files_job.outputs.docs_only != 'true' && needs.changed_files_job.outputs.cpp_only != 'true' }}
         with:
-          name: System-${{ matrix.group }}-test-report
-          path: test-reports
-          retention-days: 7
+          report_paths: 'test-reports/TEST-*.xml'
+          annotate_only: 'true'
 
       - name: Upload container logs
         uses: actions/upload-artifact@v3
-        if: ${{ !success() && needs.changed_files_job.outputs.docs_only != 'true' }}
+        if: ${{ !success() && needs.changed_files_job.outputs.docs_only != 'true'  && needs.changed_files_job.outputs.cpp_only != 'true' }}
         continue-on-error: true
         with:
           name: System-${{ matrix.group }}-container-logs