ci(github): bring back the 'print test failures' step

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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin 2022-06-08 10:43:18 +00:00 коммит произвёл Junio C Hamano
Родитель 3069f2a6f4
Коммит 5aeb145780
2 изменённых файлов: 18 добавлений и 1 удалений

16
.github/workflows/main.yml поставляемый
Просмотреть файл

@ -119,6 +119,10 @@ jobs:
- name: test - name: test
shell: bash shell: bash
run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10 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 - name: Upload failed tests' directories
if: failure() && env.FAILED_TEST_ARTIFACTS != '' if: failure() && env.FAILED_TEST_ARTIFACTS != ''
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
@ -200,6 +204,10 @@ jobs:
env: env:
NO_SVN_TESTS: 1 NO_SVN_TESTS: 1
run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10 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 - name: Upload failed tests' directories
if: failure() && env.FAILED_TEST_ARTIFACTS != '' if: failure() && env.FAILED_TEST_ARTIFACTS != ''
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
@ -253,6 +261,10 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: ci/install-dependencies.sh - run: ci/install-dependencies.sh
- run: ci/run-build-and-tests.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 - name: Upload failed tests' directories
if: failure() && env.FAILED_TEST_ARTIFACTS != '' if: failure() && env.FAILED_TEST_ARTIFACTS != ''
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
@ -282,6 +294,10 @@ jobs:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- run: ci/install-docker-dependencies.sh - run: ci/install-docker-dependencies.sh
- run: ci/run-build-and-tests.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 - name: Upload failed tests' directories
if: failure() && env.FAILED_TEST_ARTIFACTS != '' if: failure() && env.FAILED_TEST_ARTIFACTS != ''
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1

Просмотреть файл

@ -177,7 +177,8 @@ then
test_name="${test_exit%.exit}" test_name="${test_exit%.exit}"
test_name="${test_name##*/}" test_name="${test_name##*/}"
printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n" 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" cat "t/test-results/$test_name.markup"
trash_dir="t/trash directory.$test_name" trash_dir="t/trash directory.$test_name"