]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[GHA] Use autogenerated matrix for grouping unit-tests. 2622/head
authors3rj1k <evasive.gyron@gmail.com>
Sat, 12 Oct 2024 17:02:23 +0000 (19:02 +0200)
committers3rj1k <evasive.gyron@gmail.com>
Sat, 12 Oct 2024 18:41:29 +0000 (20:41 +0200)
.github/workflows/ci.yml
.github/workflows/unit-test.yml

index d16f1a987ac6d79749772472481c4be759a54c49..51586fabfe7a9be9bb94e8df8444c21c8a32d18f 100644 (file)
@@ -10,20 +10,31 @@ on:
       - synchronize
 
 jobs:
-  unit-tests_1:
-    name: "unit-tests (group 1)"
-    uses: ./.github/workflows/unit-test.yml
-    with:
-      total-groups: 2
-      current-group: 1
-    secrets: inherit
+  unit-tests-pre-config:
+    runs-on: ubuntu-latest
+    env:
+      TOTAL_GROUPS: 2
+    outputs:
+      matrix: ${{ steps.set-matrix.outputs.matrix }}
+    steps:
+      - id: set-matrix
+        shell: bash
+        run: |
+          MATRIX=$(jq -c -n --argjson groups "${{ env.TOTAL_GROUPS }}" \
+            '{
+              include: [range(1; $groups + 1) | {group: ., total: $groups}]
+            }')
+          echo "matrix=$MATRIX" | tee -a $GITHUB_OUTPUT
 
-  unit-tests_2:
-    name: "unit-tests (group 2)"
+  unit-tests:
+    needs: unit-tests-pre-config
+    strategy:
+      matrix: ${{ fromJson(needs.unit-tests-pre-config.outputs.matrix) }}
+    name: "unit-tests (group ${{ matrix.group }})"
     uses: ./.github/workflows/unit-test.yml
     with:
-      total-groups: 2
-      current-group: 2
+      total-groups: ${{ matrix.total }}
+      current-group: ${{ matrix.group }}
     secrets: inherit
 
   scan-build:
index 8ff0d832a7e518bc22a7336d688a8a62a2530b58..5db97620a4f36bec963a8939db9e4e21a4b6ce12 100644 (file)
@@ -13,7 +13,7 @@ on:
         type: number
 
 jobs:
-  unit-tests:
+  unit-test:
     runs-on: ubuntu-latest
     container:
       image: signalwire/freeswitch-public-base:bookworm