]> git.ipfire.org Git - thirdparty/git.git/commitdiff
ci: let GitHub Actions upload failed tests' directories
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 10 Apr 2020 17:18:14 +0000 (00:18 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 10 Apr 2020 17:30:40 +0000 (10:30 -0700)
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>
.github/workflows/main.yml
ci/print-test-failures.sh

index e1ac6d23b4c467f591032938f4526feca96f8e3b..fd4df939b50e48b2e2fa9d1e087b430d06c5ab37 100644 (file)
@@ -63,6 +63,12 @@ jobs:
       shell: powershell
       run: |
         & .\git-sdk-64-minimal\usr\bin\bash.exe -lc ci/print-test-failures.sh
+    - name: Upload failed tests' directories
+      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+      uses: actions/upload-artifact@v1
+      with:
+        name: failed-tests-windows
+        path: ${{env.FAILED_TEST_ARTIFACTS}}
   vs-build:
     env:
       MSYSTEM: MINGW64
@@ -176,6 +182,12 @@ jobs:
     - run: ci/run-build-and-tests.sh
     - run: ci/print-test-failures.sh
       if: failure()
+    - name: Upload failed tests' directories
+      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+      uses: actions/upload-artifact@v1
+      with:
+        name: failed-tests-${{matrix.vector.jobname}}
+        path: ${{env.FAILED_TEST_ARTIFACTS}}
   dockerized:
     strategy:
       matrix:
@@ -194,6 +206,12 @@ jobs:
     - run: ci/run-build-and-tests.sh
     - run: ci/print-test-failures.sh
       if: failure()
+    - name: Upload failed tests' directories
+      if: failure() && env.FAILED_TEST_ARTIFACTS != ''
+      uses: actions/upload-artifact@v1
+      with:
+        name: failed-tests-${{matrix.vector.jobname}}
+        path: ${{env.FAILED_TEST_ARTIFACTS}}
   static-analysis:
     env:
       jobname: StaticAnalysis
index e688a26f0d61464c473fd7f0c7fce1a805269b2c..92a983a265c246da0865fbd9f82ae5c15bb99322 100755 (executable)
@@ -46,6 +46,13 @@ do
                        mv "$trash_dir" failed-test-artifacts
                        continue
                        ;;
+               github-actions)
+                       mkdir -p failed-test-artifacts
+                       echo "::set-env name=FAILED_TEST_ARTIFACTS::t/failed-test-artifacts"
+                       cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
+                       tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
+                       continue
+                       ;;
                *)
                        echo "Unhandled CI type: $CI_TYPE" >&2
                        exit 1