From 257f5776c53aeb189e8d37fdb50c5f7097d76208 Mon Sep 17 00:00:00 2001 From: EugenioCollado <121509066+EugenioCollado@users.noreply.github.com> Date: Mon, 15 Dec 2025 12:31:29 +0100 Subject: [PATCH] Fix CI no space left on device (#157) * Free space in docker Signed-off-by: Eugenio Collado * Build script as step Signed-off-by: Eugenio Collado * Nightly Signed-off-by: Eugenio Collado --------- Signed-off-by: Eugenio Collado --- .github/workflows/ci.yml | 43 +++++++++++++++++------- .github/workflows/nightly.yml | 43 +++++++++++++++++------- modules/libmicroros/libmicroros.mk | 53 ++++++++++++++++-------------- 3 files changed, 91 insertions(+), 48 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6fb812..028e15c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,11 +12,6 @@ jobs: micro_ros_zephyr_module: runs-on: ubuntu-latest - container: - image: zephyrprojectrtos/ci:v0.26.17 - options: --user root - env: - CMAKE_PREFIX_PATH: /opt/toolchains strategy: fail-fast: false matrix: @@ -26,28 +21,52 @@ jobs: with: path: micro_ros_zephyr_module - - name: Build - shell: bash + - name: Free disk space + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo docker image prune --all --force + + - name: Create build script run: | + cat << 'EOF' > build.sh + #!/bin/bash + set -e + # Zephyr setup apt -y update - west init + west init cd zephyr - git checkout ${{ matrix.zephyr_version }} + git checkout $ZEPHYR_VERSION cd .. west update --narrow # Installing micro-ROS prerequisites pip3 install catkin_pkg lark-parser empy colcon-common-extensions - if [[ ${{ github.ref_name }} == "humble" ]] || [[ ${{ github.head_ref }} == *"humble"* ]]; then + if [[ "$REF_NAME" == "humble" ]] || [[ "$HEAD_REF" == *"humble"* ]]; then # Use empy version 3.3.4 for Humble pip3 install empy==3.3.4 fi # Build with Serial USB transport - west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y + west build -b disco_l475_iot1 /github/workspace/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y # Build with Serial transport - west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL=y + west build -b disco_l475_iot1 /github/workspace/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL=y + EOF + chmod +x build.sh + - name: Build + run: | + sudo docker run --rm \ + --user root \ + -v ${{ github.workspace }}:/github/workspace \ + -w /github/workspace \ + -e CMAKE_PREFIX_PATH=/opt/toolchains \ + -e ZEPHYR_VERSION=${{ matrix.zephyr_version }} \ + -e REF_NAME=${{ github.ref_name }} \ + -e HEAD_REF=${{ github.head_ref }} \ + zephyrprojectrtos/ci:v0.26.17 \ + /github/workspace/build.sh diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index be5b333..3239fae 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -12,11 +12,6 @@ jobs: nightly_micro_ros_zephyr_module: runs-on: ubuntu-latest - container: - image: zephyrprojectrtos/ci:v0.26.17 - options: --user root - env: - CMAKE_PREFIX_PATH: /opt/toolchains strategy: fail-fast: false matrix: @@ -35,27 +30,51 @@ jobs: path: micro_ros_zephyr_module ref: ${{ matrix.branch }} - - name: Build - shell: bash + - name: Free disk space + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo docker image prune --all --force + + - name: Create build script run: | + cat << 'EOF' > build.sh + #!/bin/bash + set -e + # Zephyr setup apt -y update - west init + west init cd zephyr - git checkout ${{ matrix.zephyr_version }} + git checkout $ZEPHYR_VERSION cd .. west update --narrow # Installing micro-ROS prerequisites pip3 install catkin_pkg lark-parser empy colcon-common-extensions - if [[ ${{ matrix.branch }} == "humble" ]]; then + if [[ "$BRANCH_NAME" == "humble" ]]; then # Use empy version 3.3.4 for Humble pip3 install empy==3.3.4 fi # Build with Serial USB transport - west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y + west build -b disco_l475_iot1 /github/workspace/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL_USB=y # Build with Serial transport - west build -b disco_l475_iot1 $GITHUB_WORKSPACE/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL=y + west build -b disco_l475_iot1 /github/workspace/micro_ros_zephyr_module -p -- -DCONFIG_MICROROS_TRANSPORT_SERIAL=y + EOF + chmod +x build.sh + + - name: Build + run: | + sudo docker run --rm \ + --user root \ + -v ${{ github.workspace }}:/github/workspace \ + -w /github/workspace \ + -e CMAKE_PREFIX_PATH=/opt/toolchains \ + -e ZEPHYR_VERSION=${{ matrix.zephyr_version }} \ + -e BRANCH_NAME=${{ matrix.branch }} \ + zephyrprojectrtos/ci:v0.26.17 \ + /github/workspace/build.sh diff --git a/modules/libmicroros/libmicroros.mk b/modules/libmicroros/libmicroros.mk index b76b649..09467d3 100644 --- a/modules/libmicroros/libmicroros.mk +++ b/modules/libmicroros/libmicroros.mk @@ -61,12 +61,12 @@ configure_toolchain: $(COMPONENT_PATH)/zephyr_toolchain.cmake.in $(COMPONENT_PATH)/micro_ros_dev/install: rm -rf micro_ros_dev; \ mkdir micro_ros_dev; cd micro_ros_dev; \ - git clone -b humble https://github.com/ament/ament_cmake src/ament_cmake; \ - git clone -b humble https://github.com/ament/ament_lint src/ament_lint; \ - git clone -b humble https://github.com/ament/ament_package src/ament_package; \ - git clone -b humble https://github.com/ament/googletest src/googletest; \ - git clone -b humble https://github.com/ros2/ament_cmake_ros src/ament_cmake_ros; \ - git clone -b humble https://github.com/ament/ament_index src/ament_index; \ + git clone -b jazzy https://github.com/ament/ament_cmake src/ament_cmake; \ + git clone -b jazzy https://github.com/ament/ament_lint src/ament_lint; \ + git clone -b jazzy https://github.com/ament/ament_package src/ament_package; \ + git clone -b jazzy https://github.com/ament/googletest src/googletest; \ + git clone -b jazzy https://github.com/ros2/ament_cmake_ros src/ament_cmake_ros; \ + git clone -b jazzy https://github.com/ament/ament_index src/ament_index; \ colcon build --cmake-args -DBUILD_TESTING=OFF; $(COMPONENT_PATH)/micro_ros_src/src: @@ -74,27 +74,32 @@ $(COMPONENT_PATH)/micro_ros_src/src: mkdir micro_ros_src; cd micro_ros_src; \ git clone -b ros2 https://github.com/eProsima/micro-CDR src/micro-CDR; \ git clone -b ros2 https://github.com/eProsima/Micro-XRCE-DDS-Client src/Micro-XRCE-DDS-Client; \ - git clone -b humble https://github.com/micro-ROS/rcl src/rcl; \ - git clone -b humble https://github.com/ros2/rclc src/rclc; \ - git clone -b humble https://github.com/micro-ROS/rcutils src/rcutils; \ - git clone -b humble https://github.com/micro-ROS/micro_ros_msgs src/micro_ros_msgs; \ - git clone -b humble https://github.com/micro-ROS/rmw-microxrcedds src/rmw-microxrcedds; \ - git clone -b humble https://github.com/micro-ROS/rosidl_typesupport src/rosidl_typesupport; \ - git clone -b humble https://github.com/micro-ROS/rosidl_typesupport_microxrcedds src/rosidl_typesupport_microxrcedds; \ - git clone -b humble https://github.com/ros2/rosidl src/rosidl; \ - git clone -b humble https://github.com/ros2/rmw src/rmw; \ - git clone -b humble https://github.com/ros2/rcl_interfaces src/rcl_interfaces; \ - git clone -b humble https://github.com/ros2/rosidl_defaults src/rosidl_defaults; \ - git clone -b humble https://github.com/ros2/unique_identifier_msgs src/unique_identifier_msgs; \ - git clone -b humble https://github.com/ros2/common_interfaces src/common_interfaces; \ - git clone -b humble https://github.com/ros2/test_interface_files src/test_interface_files; \ - git clone -b humble https://github.com/ros2/rmw_implementation src/rmw_implementation; \ - git clone -b humble https://github.com/ros2/rcl_logging src/rcl_logging; \ - git clone -b humble https://gitlab.com/ros_tracing/ros2_tracing src/ros2_tracing; \ - git clone -b humble https://github.com/micro-ROS/micro_ros_utilities src/micro_ros_utilities; \ + git clone -b jazzy https://github.com/micro-ROS/rcl src/rcl; \ + git clone -b jazzy https://github.com/ros2/rclc src/rclc; \ + git clone -b jazzy https://github.com/micro-ROS/rcutils src/rcutils; \ + git clone -b jazzy https://github.com/micro-ROS/micro_ros_msgs src/micro_ros_msgs; \ + git clone -b jazzy https://github.com/micro-ROS/rmw-microxrcedds src/rmw-microxrcedds; \ + git clone -b jazzy https://github.com/micro-ROS/rosidl_typesupport src/rosidl_typesupport; \ + git clone -b jazzy https://github.com/micro-ROS/rosidl_typesupport_microxrcedds src/rosidl_typesupport_microxrcedds; \ + git clone -b jazzy https://github.com/ros2/rosidl src/rosidl; \ + git clone -b jazzy https://github.com/ros2/rosidl_dynamic_typesupport src/rosidl_dynamic_typesupport; \ + git clone -b jazzy https://github.com/ros2/rmw src/rmw; \ + git clone -b jazzy https://github.com/ros2/rcl_interfaces src/rcl_interfaces; \ + git clone -b jazzy https://github.com/ros2/rosidl_defaults src/rosidl_defaults; \ + git clone -b jazzy https://github.com/ros2/unique_identifier_msgs src/unique_identifier_msgs; \ + git clone -b jazzy https://github.com/ros2/common_interfaces src/common_interfaces; \ + git clone -b jazzy https://github.com/ros2/test_interface_files src/test_interface_files; \ + git clone -b jazzy https://github.com/ros2/rmw_implementation src/rmw_implementation; \ + git clone -b jazzy https://github.com/ros2/rcl_logging src/rcl_logging; \ + git clone -b jazzy https://github.com/ros2/ros2_tracing src/ros2_tracing; \ + git clone -b jazzy https://github.com/micro-ROS/micro_ros_utilities src/micro_ros_utilities; \ + git clone -b jazzy https://github.com/ros2/rosidl_core src/rosidl_core; \ + touch src/ros2_tracing/test_tracetools/COLCON_IGNORE; \ + touch src/ros2_tracing/lttngpy/COLCON_IGNORE; \ touch src/rosidl/rosidl_typesupport_introspection_cpp/COLCON_IGNORE; \ touch src/rclc/rclc_examples/COLCON_IGNORE; \ touch src/common_interfaces/actionlib_msgs/COLCON_IGNORE; \ + touch src/common_interfaces/std_srvs/COLCON_IGNORE; \ touch src/rcl/rcl_yaml_param_parser/COLCON_IGNORE; \ touch src/rcl_logging/rcl_logging_spdlog/COLCON_IGNORE; \ touch src/rcl_interfaces/test_msgs/COLCON_IGNORE;