create-matrix.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. name: MatrixCreator
  2. run-name: "Creates supported family matrix for other jobs"
  3. on:
  4. workflow_call:
  5. outputs:
  6. matrix:
  7. description: "Supported family for job matrixing"
  8. value: ${{ jobs.CreateMatrix.outputs.matrix }}
  9. jobs:
  10. CreateMatrix:
  11. runs-on: ubuntu-latest
  12. outputs:
  13. matrix: ${{ steps.create-matrix.outputs.matrix }}
  14. steps:
  15. - name: Checkout repo
  16. id: checkout
  17. uses: actions/checkout@v4
  18. - name: Get uppercase no-extension ordered file names
  19. id: find-files
  20. run: |
  21. files=$(find cmake/stm32/ -name '*.cmake' -exec sh -c "basename {} | cut -f1 -d '.' | tr '[:lower:]' '[:upper:]'" \; | sort)
  22. echo "files=\"${files[@]}\"" >> $GITHUB_OUTPUT
  23. - name: Filter out non family files
  24. id: get-famillies
  25. run: |
  26. files=${{ steps.find-files.outputs.files }}
  27. deletes="COMMON DEVICES LINKER_LD"
  28. for del in $deletes; do
  29. files=(${files[@]/$del})
  30. done
  31. echo "files=\"${files[@]\"" >> $GITHUB_OUTPUT
  32. - name: Create matrix
  33. id: create-matrix
  34. run: |
  35. echo "matrix={\"family\":$(jq --compact-output --null-input '$ARGS.positional' --args -- ${{ steps.get-famillies.outputs.files }})}" >> $GITHUB_OUTPUT