]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
test: Fix saving artifacts
authorMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Fri, 29 Nov 2024 08:48:03 +0000 (09:48 +0100)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Mon, 2 Dec 2024 08:23:04 +0000 (09:23 +0100)
Currently, if error is returned by test command, execution of other
steps is aborted. In that case, continue-on-error safe artifact but
return error later and fail the job.

If executions passed, there are no artifacts to safe, therefore do not
safe them.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
.github/tools/run_mdadm_tests.sh
.github/workflows/tests.yml

index 5c50db43212752af49d680802110d5049d833b16..456874b51f4616df8153c85c1445903857d714dc 100755 (executable)
@@ -5,7 +5,14 @@ sudo make -j$(nproc)
 sudo make install
 sudo mdadm -Ss
 sudo ./test setup
+
+# Uncomment and adjust this to minimalize testing time for CI or test improvements.
+# --tests=test1,test2,...     Comma separated list of tests to run
+
+#sudo ./test --tests=00createnames
+
 sudo ./test --skip-broken --no-error --disable-integrity --disable-multipath --disable-linear --keep-going
+
 ret=$?
 sudo ./test cleanup
 exit $ret
index 7bfbcb3a0a7390a61f005d25f8f51068ca118dfb..ce940108febd364a0b75dcf7e70d49a49b8097f5 100644 (file)
@@ -8,6 +8,9 @@ on:
       - '*.h'
       - 'tests/*'
       - 'test'
+      - '.github/*'
+      - '.github/workflows/*'
+      - '.github/tools/*'
 jobs:
   upstream_tests:
      if: ${{ github.repository == 'md-raid-utilities/mdadm' }}
@@ -31,23 +34,37 @@ jobs:
           vagrant halt
           vagrant status
           vagrant up
+
      - name: 'Run tests'
+       id: testing
+       continue-on-error: true
        run: |
           cd ..
           vagrant ssh -c "cd /home/vagrant/host/mdadm && .github/tools/run_mdadm_tests.sh"
+
      - name: 'Copy logs to host machine'
+       if: ${{ steps.testing.outcome == 'failure' }}
        run: |
           cd ..
           vagrant ssh -c "sudo mkdir -p /home/vagrant/host/logs && sudo mv /var/tmp/*.log /home/vagrant/host/logs"
+
      - name: "Save artifacts"
+       if: ${{ steps.testing.outcome == 'failure' }}
        uses: actions/upload-artifact@v4
        with:
          name: "Logs from failed tests"
          path: /home/ci/actions-runner/_work/mdadm/logs/*.log
+
      - name: "Clean logs"
+       if: ${{ steps.testing.outcome == 'failure' }}
        run: |
           cd ..
           sudo rm /home/ci/actions-runner/_work/mdadm/logs/*.log
+
+     - name: "Set failed"
+       if: ${{ steps.testing.outcome == 'failure' }}
+       run: exit 1
+
   cleanup:
     runs-on: self-hosted
     needs: [upstream_tests]