[GHA] Use autogenerated matrix for grouping unit-tests.

This commit is contained in:
s3rj1k 2024-10-12 19:02:23 +02:00
parent 9599739b7e
commit b662cc73fb
No known key found for this signature in database
2 changed files with 23 additions and 12 deletions

View File

@ -10,20 +10,31 @@ on:
- synchronize - synchronize
jobs: jobs:
unit-tests_1: unit-tests-pre-config:
name: "unit-tests (group 1)" runs-on: ubuntu-latest
uses: ./.github/workflows/unit-test.yml env:
with: TOTAL_GROUPS: 2
total-groups: 2 outputs:
current-group: 1 matrix: ${{ steps.set-matrix.outputs.matrix }}
secrets: inherit 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: unit-tests:
name: "unit-tests (group 2)" 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 uses: ./.github/workflows/unit-test.yml
with: with:
total-groups: 2 total-groups: ${{ matrix.total }}
current-group: 2 current-group: ${{ matrix.group }}
secrets: inherit secrets: inherit
scan-build: scan-build:

View File

@ -13,7 +13,7 @@ on:
type: number type: number
jobs: jobs:
unit-tests: unit-test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: container:
image: signalwire/freeswitch-public-base:bookworm image: signalwire/freeswitch-public-base:bookworm