git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH] ci(github): bring back the 'print test failures' step
Date: Wed, 08 Jun 2022 10:43:18 +0000	[thread overview]
Message-ID: <pull.1252.git.1654684998599.gitgitgadget@gmail.com> (raw)

From: Johannes Schindelin <johannes.schindelin@gmx.de>

Git now shows better information in the GitHub workflow runs when a test
case failed. However, when a test case was implemented incorrectly and
therefore does not even run, nothing is shown.

Let's bring back the step that prints the full logs of the failed tests,
and to improve the user experience, print out an informational message
for readers so that they do not have to know/remember where to see the
full logs.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
    ci(GitHub workflow): bring back the 'print test failures' step
    
    When an incorrectly-implemented test let a CI build fail
    [https://github.com/git/git/runs/6703333447?check_suite_focus=true#step:4:1750]
    without any failing test cases, the output was not helpful for readers
    who wished to investigate the problem:
    
    [...]
     751 ⏵Run tests
    1746 === Failed test: t3105-ls-tree-output ===
    1747 The full logs are in the artifacts attached to this run.
    1748 Error: Process completed with exit code 1.
    
    
    While this is still an improvement from before (where no output was
    shown in the test step at all, apart from the very high-level prove
    output), we can do better than point users to downloading the artifacts
    (which is a bit cumbersome).
    
    With this patch, the print test failures step is reintroduced. To make
    sure that readers know to look at it, we now print an explicit message
    [https://github.com/dscho/git/runs/6790035528?check_suite_focus=true#step:4:1741]:
    
    [...]
     749 ⏵Run tests
    1737 === Failed test: t3105-ls-tree-output ===
    1738 The full logs are in the 'print test failures' step below.
    1739 See also the 'failed-tests-*' artifacts attached to this run.
    1740 Error: Process completed with exit code 1.
    
    
    The "print test failures" step is still not expanded by default, but at
    least the output is now so nicely uncluttered that it is really easy to
    spot it: it is right below the above-quoted error message.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1252%2Fdscho%2Fci-print-failures-again-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1252/dscho/ci-print-failures-again-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1252

 .github/workflows/main.yml | 16 ++++++++++++++++
 ci/lib.sh                  |  3 ++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 3fa88b78b6d..cd1f52692a5 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -119,6 +119,10 @@ jobs:
     - name: test
       shell: bash
       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
+    - name: print test failures
+      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+      shell: bash
+      run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
       uses: actions/upload-artifact@v2
@@ -200,6 +204,10 @@ jobs:
       env:
         NO_SVN_TESTS: 1
       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10
+    - name: print test failures
+      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+      shell: bash
+      run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
       uses: actions/upload-artifact@v2
@@ -253,6 +261,10 @@ jobs:
     - uses: actions/checkout@v2
     - run: ci/install-dependencies.sh
     - run: ci/run-build-and-tests.sh
+    - name: print test failures
+      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+      shell: bash
+      run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
       uses: actions/upload-artifact@v2
@@ -282,6 +294,10 @@ jobs:
     - uses: actions/checkout@v1
     - run: ci/install-docker-dependencies.sh
     - run: ci/run-build-and-tests.sh
+    - name: print test failures
+      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+      shell: bash
+      run: ci/print-test-failures.sh
     - name: Upload failed tests' directories
       if: failure() && env.FAILED_TEST_ARTIFACTS != ''
       uses: actions/upload-artifact@v1
diff --git a/ci/lib.sh b/ci/lib.sh
index 2f6d9d26e40..b142d254ec1 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -177,7 +177,8 @@ then
 			test_name="${test_exit%.exit}"
 			test_name="${test_name##*/}"
 			printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n"
-			echo "The full logs are in the artifacts attached to this run."
+			echo "The full logs are in the 'print test failures' step below."
+			echo "See also the 'failed-tests-*' artifacts attached to this run."
 			cat "t/test-results/$test_name.markup"
 
 			trash_dir="t/trash directory.$test_name"

base-commit: 3069f2a6f4c38e7e599067d2e4a8e31b4f53e2d3
-- 
gitgitgadget

             reply	other threads:[~2022-06-08 10:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 10:43 Johannes Schindelin via GitGitGadget [this message]
2022-06-08 23:14 ` [PATCH] ci(github): bring back the 'print test failures' step Junio C Hamano
2022-06-09 13:06 ` Ævar Arnfjörð Bjarmason
2022-06-10 16:40   ` Junio C Hamano
2022-06-10 17:32     ` Ævar Arnfjörð Bjarmason
2022-07-25 20:00       ` Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1252.git.1654684998599.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).