Skip to content

Commit

Permalink
is this gonna work
Browse files Browse the repository at this point in the history
  • Loading branch information
ahiuchingau committed Jan 18, 2024
1 parent 4f6113a commit 432ba42
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 32 deletions.
27 changes: 27 additions & 0 deletions .github/actions/parse-cmake-preset/action.yaml
Original file line number Diff line number Diff line change
@@ -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 }}

89 changes: 57 additions & 32 deletions .github/workflows/build-cross-target.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
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

0 comments on commit 432ba42

Please sign in to comment.