From 1fa614c867b5da7c59d0a4d3a0f34b13be9e182e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 09:39:55 +0100 Subject: [PATCH] Remove non-header files from include folder (backport #716) (#754) * Remove non-header files from include folder (#716) The `include` directory previously contained all files copied over, but only `*.h` and `*.hpp` files are required. This commit removes all files that do not have a `.h` or `.hpp` extension, as well as any empty directories that may result from this cleanup. Signed-off-by: Meet Gandhi Co-authored-by: Meet Gandhi (cherry picked from commit 096ded099b8b11680991fac804af3e808b606d7d) * Fix CI Signed-off-by: Pablo Garrido * Fix naming * Ensure naming * New line fix --------- Signed-off-by: Pablo Garrido Co-authored-by: Meet Gandhi Co-authored-by: Pablo Garrido --- .github/workflows/ci.yml | 27 ++++++++++++++++++++++++--- config/generate_lib/generic/build.sh | 2 ++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6782aee8..f4ba1f5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,9 +44,16 @@ jobs: run: | (test -f install/micro_ros_setup/lib/micro_ros_setup/build_firmware.sh) && true || false + - name: Sanitize Artifact Name + id: sanitize-name + run: | + sanitized_name=$(echo "${{ inputs.ci_target_ref }}" | sed 's/[\/:*?"<>|\\]/_/g') + echo "sanitized_name=$sanitized_name" >> $GITHUB_ENV + echo "::set-output name=sanitized_name::$sanitized_name" + - uses: actions/upload-artifact@v4.4.0 with: - name: micro_ros_build_${{ inputs.ci_target_ref }} + name: micro_ros_build_${{ steps.sanitize-name.outputs.sanitized_name }} path: install micro_ros_agent: @@ -75,9 +82,16 @@ jobs: rosdep update --rosdistro ${{ env.ROS_DISTRO }} rosdep install --rosdistro ${{ env.ROS_DISTRO }} -y --from-paths src --ignore-src -y + - name: Sanitize Artifact Name + id: sanitize-name + run: | + sanitized_name=$(echo "${{ inputs.ci_target_ref }}" | sed 's/[\/:*?"<>|\\]/_/g') + echo "sanitized_name=$sanitized_name" >> $GITHUB_ENV + echo "::set-output name=sanitized_name::$sanitized_name" + - uses: actions/download-artifact@v4.1.7 with: - name: micro_ros_build_${{ inputs.ci_target_ref }} + name: micro_ros_build_${{ steps.sanitize-name.outputs.sanitized_name }} path: install # Workaround https://github.com/actions/upload-artifact/issues/38 @@ -218,9 +232,16 @@ jobs: rosdep update --rosdistro ${{ env.ROS_DISTRO }} rosdep install --rosdistro ${{ env.ROS_DISTRO }} -y --from-paths src --ignore-src -y + - name: Sanitize Artifact Name + id: sanitize-name + run: | + sanitized_name=$(echo "${{ inputs.ci_target_ref }}" | sed 's/[\/:*?"<>|\\]/_/g') + echo "sanitized_name=$sanitized_name" >> $GITHUB_ENV + echo "::set-output name=sanitized_name::$sanitized_name" + - uses: actions/download-artifact@v4.1.7 with: - name: micro_ros_build_${{ inputs.ci_target_ref }} + name: micro_ros_build_${{ steps.sanitize-name.outputs.sanitized_name }} path: install # Workaround https://github.com/actions/upload-artifact/issues/38 diff --git a/config/generate_lib/generic/build.sh b/config/generate_lib/generic/build.sh index 49af523b..891676b6 100755 --- a/config/generate_lib/generic/build.sh +++ b/config/generate_lib/generic/build.sh @@ -48,6 +48,8 @@ pushd $FW_TARGETDIR/mcu_ws >/dev/null done ; \ ar rc libmicroros.a $(ls *.o *.obj 2> /dev/null); mkdir -p $BUILD_DIR; cp libmicroros.a $BUILD_DIR; ranlib $BUILD_DIR/libmicroros.a; \ cp -R $FW_TARGETDIR/mcu_ws/install/include $BUILD_DIR/; \ + rm $(find $BUILD_DIR/include -type f -not -name "*.h" -not -name "*.hpp"); \ + rm -rf $(find $BUILD_DIR/include -type d -empty); \ cd ..; rm -rf libmicroros; popd >/dev/null