@matheusbsbs / matheus-bagliano / commits / f72f328bc5
Fork 0

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 <johannes.schindelin@gmx.de> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Apr 11, 2020 at 00:18 UTC f72f328bc57e1b0db380ef76e0c1e94a9ed0ac7c
2 files changed +25
.github/workflows/main.yml
+18
@@ -63,6 +63,12 @@ jobs:
63 shell: powershell
64 run: |
65 & .\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}}
72 vs-build:
73 env:
74 MSYSTEM: MINGW64
@@ -176,6 +182,12 @@ jobs:
182 - run: ci/run-build-and-tests.sh
183 - run: ci/print-test-failures.sh
184 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}}
191 dockerized:
192 strategy:
193 matrix:
@@ -194,6 +206,12 @@ jobs:
206 - run: ci/run-build-and-tests.sh
207 - run: ci/print-test-failures.sh
208 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}}
215 static-analysis:
216 env:
217 jobname: StaticAnalysis
ci/print-test-failures.sh
+7
@@ -46,6 +46,13 @@ do
46 mv "$trash_dir" failed-test-artifacts
47 continue
48 ;;
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 + ;;
56 *)
57 echo "Unhandled CI type: $CI_TYPE" >&2
58 exit 1