]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
ci: if list of tests is empty, run all tests
authorLaszlo Gombos <laszlo.gombos@gmail.com>
Sun, 26 Feb 2023 13:51:57 +0000 (13:51 +0000)
committerLaszlo <laszlo.gombos@gmail.com>
Tue, 2 Apr 2024 15:44:44 +0000 (11:44 -0400)
Test matrix for all tests is computed using "find" to.

.github/workflows/manualtest.yml

index 02563c323ae7e30f45471e522ba5be3bef9b9515..c8792960224856b9601ed5898647b1e26851f0f5 100644 (file)
@@ -6,7 +6,6 @@ on:
             test:
                 description: "Array of tests to run, such as [11,12]"
                 default: "['04']"
-                required: true
             container:
                 type: choice
                 description: 'distro'
@@ -26,12 +25,27 @@ env:
     ${{ fromJSON(inputs.env) }}
 
 jobs:
+    matrix:
+        runs-on: ubuntu-latest
+        outputs:
+            tests: ${{ steps.set-matrix.outputs.tests }}
+        steps:
+            -   name: "Checkout Repository"
+                uses: actions/checkout@v1
+                with:
+                    fetch-depth: 0
+            -   id: set-matrix
+                name: "Set Matrix"
+                run: |
+                     [[ "${{ toJson(fromJson(inputs.test)) }}" != '[]' ]] && echo "tests=${{ inputs.test }}" >> $GITHUB_OUTPUT \
+                     || ( tests=$(find test -type d -a -name "TEST-*" | cut -d\- -f2 | sed -z 's/\n/","/g' ); echo "tests=[\"${tests%??}]" >> $GITHUB_OUTPUT )
     test:
+        needs: matrix
         runs-on: ubuntu-latest
         timeout-minutes: 45
         strategy:
             matrix:
-                test: ${{ fromJSON(inputs.test) }}
+                test: ${{ fromJSON(needs.matrix.outputs.tests) }}
         container:
             image: ghcr.io/dracut-ng/${{ inputs.container }}
             options: "--privileged -v /dev:/dev"