You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/07/21 07:57:26 UTC

[camel] branch main updated: (chores) ci: rework the summary to process the surefire/failsafe reports

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

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 0adaa8d49ca (chores) ci: rework the summary to process the surefire/failsafe reports
0adaa8d49ca is described below

commit 0adaa8d49caef93bd93dc89a1a79a4acb5693eaa
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Fri Jul 21 09:57:06 2023 +0200

    (chores) ci: rework the summary to process the surefire/failsafe reports
---
 .github/actions/incremental-build/incremental-build.sh | 11 ++++++++++-
 .github/actions/incremental-build/parse_errors.sh      | 11 +++--------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/.github/actions/incremental-build/incremental-build.sh b/.github/actions/incremental-build/incremental-build.sh
index 76f7282b37d..e73b9fcbce7 100755
--- a/.github/actions/incremental-build/incremental-build.sh
+++ b/.github/actions/incremental-build/incremental-build.sh
@@ -43,6 +43,7 @@ function main() {
   local mode=${2}
   local log="incremental-${mode}.log"
   local prId=${3}
+  local ret=0
 
   echo "Searching for affected projects"
   local projects
@@ -85,6 +86,7 @@ function main() {
     if [[ ${buildAll} = "true" ]] ; then
       echo "Building all projects"
       $mavenBinary -l $log $MVND_OPTS -DskipTests install
+      ret=$?
     else
       local buildDependents
       buildDependents=$(hasLabel ${prId} "build-dependents")
@@ -98,9 +100,11 @@ function main() {
       if [[ ${totalTestableProjects} -gt ${maxNumberOfTestableProjects} ]] ; then
         echo "Launching fast build command against the projects ${pl}, their dependencies and the projects that depend on them"
         $mavenBinary -l $log $MVND_OPTS -DskipTests install -pl "$pl" -amd -am
+        ret=$?
       else
         echo "Launching fast build command against the projects ${pl} and their dependencies"
         $mavenBinary -l $log $MVND_OPTS -DskipTests install -pl "$pl" -am
+        ret=$?
       fi
     fi
     [[ -z $(git status --porcelain | grep -v antora.yml) ]] || { echo 'There are uncommitted changes'; git status; echo; echo; git diff; exit 1; }
@@ -125,14 +129,19 @@ function main() {
       if [[ ${totalTestableProjects} -gt ${maxNumberOfTestableProjects} ]] ; then
         echo "There are too many projects to test so only the affected projects are tested"
         $mavenBinary -l $log $MVND_OPTS install -pl "$pl"
+        ret=$?
       else
         echo "Testing the affected projects and the projects that depend on them"
         $mavenBinary -l $log $MVND_OPTS install -pl "$pl" -amd
+        ret=$?
       fi
     fi
   fi
 
-  ./.github/actions/incremental-build/parse_errors.sh $log
+  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 {} \;
+
+  exit $ret
 }
 
 main "$@"
diff --git a/.github/actions/incremental-build/parse_errors.sh b/.github/actions/incremental-build/parse_errors.sh
index c42979a083f..0bbf82a1577 100755
--- a/.github/actions/incremental-build/parse_errors.sh
+++ b/.github/actions/incremental-build/parse_errors.sh
@@ -18,13 +18,8 @@
 
 LOG_FILE=$1
 
-temp=$(cat $log | egrep "ERROR\].org" | grep "Time elapsed" | awk -F ' '  '{print $2}' | sed 's/^/| /' | sed 's/$/ |/')
+failed_summary=$(cat $LOG_FILE | egrep "FAILURE|ERROR" | grep "Time elapsed"| egrep "^org" | sed 's/\!//g' | awk -F ' ' '{printf "| %s | %s%s | %s |\n", $1,$5,$6, $8}')
 
-if [[ ! -z "$temp" ]] ; then
-  echo -e "| Failed Test |\n| --- |" > "$GITHUB_STEP_SUMMARY"
-  echo "$temp"  >> "$GITHUB_STEP_SUMMARY"
-  exit 1
+if [[ ! -z "$failed_summary" ]] ; then
+  echo "$failed_summary"  >> "$GITHUB_STEP_SUMMARY"
 fi
-
-exit 0
-