From: Johannes Schindelin <johannes.schindelin@xxxxxx> 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@xxxxxx> --- 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