Skip to content

Commit

Permalink
[Spinal][Gthub Action] New workflow process for Spinal firmware CI to…
Browse files Browse the repository at this point in the history
… avoid unexpected failure in build check. (#646)

* [Spinal][GA] Repeat firmware build multiple times to avoid unexpected build fail.

* [Spinal][GA] Include Ros build into repeat build flow.

* Revert "[Spinal][GA] Include Ros build into repeat build flow."

This reverts commit ac22105.

* [Spinal][GA] Workaround to continue workflow even if some errors happen.

* [Spinal][GA] include ros package build process into repeated build process.

* [Spinal][GA] Back to default GA workspace after finishing ros build.

* [GA][Firmare Build] modify the build option, single package and single make job

* [Spinal][GA]Workaround to use modified catkin build option in interative build process.

---------

Co-authored-by: Moju Zhao <[email protected]>
  • Loading branch information
sugihara-16 and Moju Zhao authored Jan 3, 2025
1 parent e6be0c1 commit 3e9f05d
Showing 1 changed file with 77 additions and 24 deletions.
101 changes: 77 additions & 24 deletions .github/workflows/spinal_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
submodules: recursive

- name: Install ROS packages with rosdep # Setup Github ws as a catkin ws
shell: bash
run: |
source /opt/ros/noetic/setup.bash
rm /etc/ros/rosdep/sources.list.d/20-default.list
Expand All @@ -24,40 +25,92 @@ jobs:
ln -s $GITHUB_WORKSPACE ~/catkin_ws/src/jsk_aerial_robot
cd ~/catkin_ws
rosdep install -y -r --from-paths src --ignore-src --rosdistro noetic
shell: bash
- name: Build Spinal as ROS Package # Build Spinal to generate ROS libraries
run: |
source /opt/ros/noetic/setup.bash
cd ~/catkin_ws
catkin config --cmake-args -Dcatkin_DIR=/opt/ros/noetic/share/catkin/cmake
catkin build -p 1 -j 1 spinal
source devel/setup.bash
shell: bash
# - name: Build Spinal as ROS Package # Build Spinal to generate ROS libraries
# run: |
# source /opt/ros/noetic/setup.bash
# cd ~/catkin_ws
# catkin config --cmake-args -Dcatkin_DIR=/opt/ros/noetic/share/catkin/cmake
# catkin build -p 1 -j 1 spinal
# source devel/setup.bash
# shell: bash

- name: Build Spinal H7 as STM32CubeIDE project # Build Spinal H7 firmware with STM32CubeIDE
shell: bash
run: |
/opt/st/stm32cubeide_1.8.0/stm32cubeide -nosplash \
-application org.eclipse.cdt.managedbuilder.core.headlessbuild \
-data ~/STM32CubeIDE/workspace_1.8.0/ \
-import aerial_robot_nerve/spinal/mcu_project/boards/stm32H7/STM32CubeIDE/ \
-cleanBuild spinal/Debug \
-vmargs -Dorg.eclipse.cdt.core.build.parallel=true \
-Dorg.eclipse.cdt.core.build.parallel.threads=12
# set default result to avoid build interruption
set +e
for i in {1..5}; do
echo "=== Attempt #$i for H7 Build ==="
#build ros packages related to spinla firmware
source /opt/ros/noetic/setup.bash
cd ~/catkin_ws
catkin config --cmake-args -Dcatkin_DIR=/opt/ros/noetic/share/catkin/cmake
catkin build -p 1 -j 1 spinal
source devel/setup.bash
# back to default workspace
cd $GITHUB_WORKSPACE
/opt/st/stm32cubeide_1.8.0/stm32cubeide -nosplash \
-application org.eclipse.cdt.managedbuilder.core.headlessbuild \
-data ~/STM32CubeIDE/workspace_1.8.0/ \
-import aerial_robot_nerve/spinal/mcu_project/boards/stm32H7/STM32CubeIDE/ \
-cleanBuild spinal/Debug \
-vmargs -Dorg.eclipse.cdt.core.build.parallel=true \
-Dorg.eclipse.cdt.core.build.parallel.threads=12
# check build result
if [ $? -eq 0 ]; then
echo "Build Spinal H7 succeeded on attempt #$i."
exit 0 # success
else
echo "Build Spinal H7 failed on attempt #$i."
fi
done
echo "All 5 attempts for Spinal H7 have failed."
exit 1
- name: Clean up STM32CubeIDE # Clean up STM32CubeIDE WS to build same name project
shell: bash
run: |
rm -rf ~/STM32CubeIDE/workspace_1.8.0/.metadata
- name: Build Spinal F7 as STM32CubeIDE project # Build Spinal F7 firmware with STM32CubeIDE
shell: bash
run: |
/opt/st/stm32cubeide_1.8.0/stm32cubeide -nosplash \
-application org.eclipse.cdt.managedbuilder.core.headlessbuild \
-data ~/STM32CubeIDE/workspace_1.8.0/ \
-import aerial_robot_nerve/spinal/mcu_project/boards/stm32F7/STM32CubeIDE/ \
-cleanBuild spinal/Debug \
-vmargs -Dorg.eclipse.cdt.core.build.parallel=true \
-Dorg.eclipse.cdt.core.build.parallel.threads=12
set +e
for i in {1..5}; do
echo "=== Attempt #$i for F7 Build ==="
#build ros packages related to spinla firmware
source /opt/ros/noetic/setup.bash
cd ~/catkin_ws
catkin config --cmake-args -Dcatkin_DIR=/opt/ros/noetic/share/catkin/cmake
catkin build -p 1 -j 1 spinal
source devel/setup.bash
# back to default workspace
cd $GITHUB_WORKSPACE
/opt/st/stm32cubeide_1.8.0/stm32cubeide -nosplash \
-application org.eclipse.cdt.managedbuilder.core.headlessbuild \
-data ~/STM32CubeIDE/workspace_1.8.0/ \
-import aerial_robot_nerve/spinal/mcu_project/boards/stm32F7/STM32CubeIDE/ \
-cleanBuild spinal/Debug \
-vmargs -Dorg.eclipse.cdt.core.build.parallel=true \
-Dorg.eclipse.cdt.core.build.parallel.threads=12
if [ $? -eq 0 ]; then
echo "Build Spinal F7 succeeded on attempt #$i."
exit 0 #success
else
echo "Build Spinal F7 failed on attempt #$i."
fi
done
echo "All 5 attempts for Spinal F7 have failed."
exit 1
- name: Upload H7 artifacts # Upload required H7 files for flash.
uses: actions/upload-artifact@v4
Expand All @@ -69,4 +122,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: SpinalF7.artifacts
path: aerial_robot_nerve/spinal/mcu_project/boards/stm32F7/STM32CubeIDE/Debug/spinal.*
path: aerial_robot_nerve/spinal/mcu_project/boards/stm32F7/STM32CubeIDE/Debug/spinal.*

0 comments on commit 3e9f05d

Please sign in to comment.