Skip to content

Commit 36a6237

Browse files
dschosgn
authored andcommitted
ci: let GitHub Actions upload failed tests' directories
Arguably, CI builds' most important task is to not only identify regressions, but to make it as easy as possible to investigate what went wrong. In that light, we will want to provide users with a way to inspect the tests' output as well as the corresponding directories. This commit adds build steps that are only executed when tests failed, uploading the relevant information as build artifacts. These artifacts can then be downloaded by interested parties to diagnose the failures more efficiently. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Đoàn Trần Công Danh <[email protected]>
1 parent 651fd37 commit 36a6237

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

.github/workflows/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ jobs:
6363
shell: powershell
6464
run: |
6565
& .\git-sdk-64-minimal\usr\bin\bash.exe -lc ci/print-test-failures.sh
66+
- name: Upload failed tests' directories
67+
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
68+
uses: actions/upload-artifact@v1
69+
with:
70+
name: failed-tests-windows
71+
path: ${{env.FAILED_TEST_ARTIFACTS}}
6672
vs-build:
6773
env:
6874
MSYSTEM: MINGW64
@@ -176,6 +182,12 @@ jobs:
176182
- run: ci/run-build-and-tests.sh
177183
- run: ci/print-test-failures.sh
178184
if: failure()
185+
- name: Upload failed tests' directories
186+
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
187+
uses: actions/upload-artifact@v1
188+
with:
189+
name: failed-tests-${{matrix.vector.jobname}}
190+
path: ${{env.FAILED_TEST_ARTIFACTS}}
179191
dockerized:
180192
strategy:
181193
matrix:
@@ -194,6 +206,12 @@ jobs:
194206
- run: ci/run-build-and-tests.sh
195207
- run: ci/print-test-failures.sh
196208
if: failure()
209+
- name: Upload failed tests' directories
210+
if: failure() && env.FAILED_TEST_ARTIFACTS != ''
211+
uses: actions/upload-artifact@v1
212+
with:
213+
name: failed-tests-${{matrix.vector.jobname}}
214+
path: ${{env.FAILED_TEST_ARTIFACTS}}
197215
static-analysis:
198216
env:
199217
jobname: StaticAnalysis

ci/print-test-failures.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ do
4646
mv "$trash_dir" failed-test-artifacts
4747
continue
4848
;;
49+
github-actions)
50+
mkdir -p failed-test-artifacts
51+
echo "::set-env name=FAILED_TEST_ARTIFACTS::t/failed-test-artifacts"
52+
cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
53+
tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
54+
continue
55+
;;
4956
*)
5057
echo "Unhandled CI type: $CI_TYPE" >&2
5158
exit 1

0 commit comments

Comments
 (0)