Skip to content

Commit

Permalink
Merge pull request ObKo#342 from xanthio/maintenance/dynamic-matrixing
Browse files Browse the repository at this point in the history
Dynamic family matrix for CI jobs
  • Loading branch information
Hish15 authored Jul 7, 2024
2 parents e89dfc5 + ee94679 commit d8f9e07
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/create-matrix.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d8f9e07

Please sign in to comment.