diff --git a/.github/actions/parse-cmake-preset/action.yaml b/.github/actions/parse-cmake-preset/action.yaml new file mode 100644 index 000000000..98ec63a9b --- /dev/null +++ b/.github/actions/parse-cmake-preset/action.yaml @@ -0,0 +1,27 @@ +name: Parse CMAKE preset targets +description: Parse targets from CMakePresets.json + +inputs: + name: + description: name of the preset target + required: true +outputs: + targets: + description: a list of valid targets + value: ${{ steps.get-targets.outputs.targets }} + +runs: + using: composite + steps: + - name: Install jq + shell: bash + run: | + sudo apt-get install jq + + - id: get-targets + run: | + targets=$(jq '.buildPresets[] | select(.name=="${{ inputs.name }}") | .targets' CMakePresets.json) + eho targets=$targets >> "$GITHUB_OUTPUT" + shell: bash + working-directory: ${{ env.DEFAULT_DIRECTORY }} + diff --git a/.github/workflows/build-cross-target.yaml b/.github/workflows/build-cross-target.yaml index 05f3da960..4f8c80dc4 100644 --- a/.github/workflows/build-cross-target.yaml +++ b/.github/workflows/build-cross-target.yaml @@ -17,14 +17,11 @@ defaults: working-directory: ot3-firmware jobs: - format-ci: + get-format-targets: runs-on: "ubuntu-20.04" - timeout-minutes: 20 - strategy: - matrix: - target: ${{ jq '.buildPresets[] | select(.name=="format-ci") | .targets' CMakePresets.json }} - fail-fast: false - name: ${{ matrix.target }} format + timeout-minutes: 2 + outputs: + targets: ${{ steps.get-target.outputs.targets}} steps: - name: Checkout github actions directory uses: actions/checkout@v4 @@ -39,27 +36,20 @@ jobs: with: path: ot3-firmware - - name: Setup main - uses: ./actions/.github/actions/main-setup + - name: Parse target + uses: ./github/actions/parse-cmake-preset with: - cache-version: ${{ secrets.CACHE_VERSION }} + name: format-ci - - name: Configure - run: cmake --preset=cross . - - - name: Run format-ci - run: | - cd build-cross - make ${{ matrix.target }} - - cross-compile-target: + format-ci: runs-on: "ubuntu-20.04" timeout-minutes: 20 + needs: get-format-targets strategy: matrix: - target: [ gantry, gripper, head, pipettes, rear-panel] + target: ${{ fromJSON(needs.get-format-targets.outputs.targets) }} fail-fast: false - name: ${{ matrix.target }} cross-compile build + name: ${{ matrix.target }} format steps: - name: Checkout github actions directory uses: actions/checkout@v4 @@ -82,17 +72,52 @@ jobs: - name: Configure run: cmake --preset=cross . - - name: Build applications - run: | - cd build-cross - make ${{ matrix.target }}-applications - - - name: Build bootloader applications - run: | - cd build-cross - make bootloader-${{ matrix.target }}-applications - - name: Run format-ci run: | cd build-cross - make ${{ matrix.target }}-format-ci \ No newline at end of file + make ${{ matrix.target }} + +# cross-compile-target: +# runs-on: "ubuntu-20.04" +# timeout-minutes: 20 +# strategy: +# matrix: +# target: [ gantry, gripper, head, pipettes, rear-panel] +# fail-fast: false +# name: ${{ matrix.target }} cross-compile build +# steps: +# - name: Checkout github actions directory +# uses: actions/checkout@v4 +# with: +# sparse-checkout: | +# .github/actions +# sparse-checkout-cone-mode: false +# path: actions +# +# - name: Checkout ot3-firmware repository +# uses: actions/checkout@v4 +# with: +# path: ot3-firmware +# +# - name: Setup main +# uses: ./actions/.github/actions/main-setup +# with: +# cache-version: ${{ secrets.CACHE_VERSION }} +# +# - name: Configure +# run: cmake --preset=cross . +# +# - name: Build applications +# run: | +# cd build-cross +# make ${{ matrix.target }}-applications +# +# - name: Build bootloader applications +# run: | +# cd build-cross +# make bootloader-${{ matrix.target }}-applications +# +# - name: Run format-ci +# run: | +# cd build-cross +# make ${{ matrix.target }}-format-ci \ No newline at end of file