diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 00ff1e55..dabda153 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -7,15 +7,18 @@ env: BUILD_TYPE: Release jobs: + RetrieveTargetsMatrix: + uses: ./.github/workflows/create-matrix.yml + test-ubuntu: runs-on: ubuntu-20.04 + needs: RetrieveTargetsMatrix strategy: - matrix: - family: [C0, F0, F1, F2, F3, F4, F7, G0, G4, H5, H7, L0, L1, L4, L5, U0, U5, WB, WL, MP1] + matrix: ${{ fromJSON(needs.RetrieveTargetsMatrix.outputs.matrix) }} fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install ARM toolchain run: sudo apt-get install gcc-arm-none-eabi binutils-arm-none-eabi diff --git a/.github/workflows/create-matrix.yml b/.github/workflows/create-matrix.yml new file mode 100644 index 00000000..41c66270 --- /dev/null +++ b/.github/workflows/create-matrix.yml @@ -0,0 +1,30 @@ +name: MatrixCreator + +run-name: "Creates supported family matrix for other jobs" + +on: + workflow_call: + outputs: + matrix: + description: "Supported family for job matrixing" + value: ${{ jobs.CreateMatrix.outputs.matrix }} + +jobs: + CreateMatrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.create-matrix.outputs.matrix }} + steps: + - name: Checkout repo + id: checkout + uses: actions/checkout@v4 + + - name: Create matrix + id: create-matrix + run: | + files=$(find cmake/stm32/ -name '*.cmake' -exec sh -c "basename {} | cut -f1 -d '.' | tr '[:lower:]' '[:upper:]'" \; | sort) + deletes="COMMON DEVICES LINKER_LD" + for del in $deletes; do + files=(${files[@]/$del}) + done + echo "matrix={\"family\":$(jq --compact-output --null-input '$ARGS.positional' --args -- ${files[@]})}" >> $GITHUB_OUTPUT