Skip to content

Commit

Permalink
[GHA] Use autogenerated matrix for grouping unit-tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
s3rj1k committed Oct 12, 2024
1 parent 9599739 commit cf99721
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,36 @@ 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
generate-unit-test-matrix:
runs-on: ubuntu-latest
env:
TOTAL_GROUPS: 2
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Generate Unit-test Matrix
id: set-matrix
run: |
MATRIX=$(jq -c -n --argjson groups "${{ env.TOTAL_GROUPS }}" \
'{
group: [range(1; $groups + 1)],
"total-groups": $groups
}')
echo "matrix=$(echo $MATRIX | jq -c .)" | tee -a $GITHUB_OUTPUT
- name: Print Resulting Matrix
run: |
cat $GITHUB_OUTPUT
unit-tests_2:
name: "unit-tests (group 2)"
unit-tests:
needs: generate-unit-test-matrix
strategy:
matrix: ${{fromJson(needs.generate-unit-test-matrix.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-groups }}
current-group: ${{ matrix.group }}
secrets: inherit

scan-build:
Expand Down

0 comments on commit cf99721

Please sign in to comment.