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

nfilotto pushed a commit to branch camel-4.0.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.0.x by this push:
     new 02415e3069d (chore) ci: add failing tests list on error (#11951)
02415e3069d is described below

commit 02415e3069deb47884b32175cf37ee3af7808ca6
Author: Nicolas Filotto <[email protected]>
AuthorDate: Thu Nov 9 11:59:42 2023 +0100

    (chore) ci: add failing tests list on error (#11951)
    
    ## Motivation
    
    When using the `component-test` Github action, in case of a failure, we 
would like to have the list of tests that failed to avoid having to look into 
the log file if possible.
    
    ## Modifications:
    
    * Reuse the same approach as the one used with the `incremental-build` to 
parse and list the errors in case of a build failure
    * Update the `incremental-build` to parse and list the errors only in case 
of a failure
---
 .github/actions/component-test/component-test.sh       | 9 +++++++++
 .github/actions/incremental-build/incremental-build.sh | 8 +++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/.github/actions/component-test/component-test.sh 
b/.github/actions/component-test/component-test.sh
index 948f451fea2..cf3ee25f404 100755
--- a/.github/actions/component-test/component-test.sh
+++ b/.github/actions/component-test/component-test.sh
@@ -47,6 +47,15 @@ function main() {
   else
     echo "Launching tests of the projects ${pl}"
     $mavenBinary -l $log $MVND_OPTS install -pl "$pl"
+    ret=$?
+
+    if [[ ${ret} -ne 0 ]] ; then
+      echo "Processing surefire and failsafe reports to create the summary"
+      echo -e "| Failed Test | Duration | Failure Type |\n| --- | --- | --- |" 
 > "$GITHUB_STEP_SUMMARY"
+      find . -path '*target/*-reports*' -iname '*.txt' -exec 
.github/actions/incremental-build/parse_errors.sh {} \;
+    fi
+
+    exit $ret
   fi
 }
 
diff --git a/.github/actions/incremental-build/incremental-build.sh 
b/.github/actions/incremental-build/incremental-build.sh
index b5e29a444fd..9cbbf1fcc9a 100755
--- a/.github/actions/incremental-build/incremental-build.sh
+++ b/.github/actions/incremental-build/incremental-build.sh
@@ -144,9 +144,11 @@ function main() {
     fi
   fi
 
-  echo "Processing surefire and failsafe reports to create the summary"
-  echo -e "| Failed Test | Duration | Failure Type |\n| --- | --- | --- |"  > 
"$GITHUB_STEP_SUMMARY"
-  find . -path '*target/*-reports*' -iname '*.txt' -exec 
.github/actions/incremental-build/parse_errors.sh {} \;
+  if [[ ${ret} -ne 0 ]] ; then
+    echo "Processing surefire and failsafe reports to create the summary"
+    echo -e "| Failed Test | Duration | Failure Type |\n| --- | --- | --- |"  
> "$GITHUB_STEP_SUMMARY"
+    find . -path '*target/*-reports*' -iname '*.txt' -exec 
.github/actions/incremental-build/parse_errors.sh {} \;
+  fi
 
   exit $ret
 }

Reply via email to