From 4be4f336970cb126220ce3aba60f4bfd72c604ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Tue, 29 Apr 2025 14:25:56 +0200 Subject: [PATCH 01/19] quicker job runtime --- .github/workflows/ci.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2953dcd..0760946 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,10 +3,14 @@ name: docker build & colcon-test on: push: branches: - - microservices + - '**' + - '!humble' + - '!jazzy' pull_request: branches: - - microservices + - '**' + - '!humble' + - '!jazzy' jobs: docker-build: @@ -42,12 +46,9 @@ jobs: container: image: ghcr.io/helbling-technik/github_actions:latest steps: - - uses: ros-tooling/action-ros-ci@v0.4 - id: action_ros_ci_step - with: - package-name: helmoro_description - target-ros2-distro: jazzy - coverage-result: false + - name: colcon-test + run: | + colcon-test - uses: actions/upload-artifact@v4 with: From 3e61262d0929ec9f5a9b1e7ceefd520ebc8b5368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Tue, 29 Apr 2025 14:32:05 +0200 Subject: [PATCH 02/19] fix(workflow): typo --- .github/workflows/ci.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0760946..8191b19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,11 +6,6 @@ on: - '**' - '!humble' - '!jazzy' - pull_request: - branches: - - '**' - - '!humble' - - '!jazzy' jobs: docker-build: @@ -46,9 +41,9 @@ jobs: container: image: ghcr.io/helbling-technik/github_actions:latest steps: - - name: colcon-test + - name: colcon test run: | - colcon-test + colcon test - uses: actions/upload-artifact@v4 with: From 550bf3006a96b071480cb8a992dda64049014150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Tue, 29 Apr 2025 14:44:11 +0200 Subject: [PATCH 03/19] fix(workflow): use inline and registry cache --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8191b19..309883e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,8 +31,8 @@ jobs: context: . file: .devcontainer/Dockerfile tags: ghcr.io/helbling-technik/github_actions:latest - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=registry,ref=ghcr.io/helbling-technik/github_actions:latest + cache-to: type=inline push: true colcon-test: From 93fd9219257ddcbb32b1106fc3175dc9456857f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Tue, 29 Apr 2025 14:54:05 +0200 Subject: [PATCH 04/19] added additional cache locations --- .devcontainer/Dockerfile | 2 +- .github/workflows/ci.yml | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 659b7d5..ce73953 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM ros:jazzy AS dev +FROM ros@sha256:9749355a0760334fa5ea3c660f2de1ecc5e8a5af8047e4bbaa9afa8a7843da80 AS dev # ******************************************************** # * Install Dependencies * diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 309883e..37fadfe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,9 +31,13 @@ jobs: context: . file: .devcontainer/Dockerfile tags: ghcr.io/helbling-technik/github_actions:latest - cache-from: type=registry,ref=ghcr.io/helbling-technik/github_actions:latest - cache-to: type=inline - push: true + cache-from: | + type=gha + type=registry,ref=ghcr.io/helbling-technik/github_actions:buildcache + cache-to: | + type=gha,mode=max + type=registry,ref=ghcr.io/helbling-technik/github_actions:buildcache,mode=max + colcon-test: needs: docker-build From b13f51d6bf1da8c76c49b9c2fc351303f43a6efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Tue, 29 Apr 2025 15:27:51 +0200 Subject: [PATCH 05/19] fix(workflow): added push tag --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37fadfe..61a39fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,6 +31,7 @@ jobs: context: . file: .devcontainer/Dockerfile tags: ghcr.io/helbling-technik/github_actions:latest + push: true cache-from: | type=gha type=registry,ref=ghcr.io/helbling-technik/github_actions:buildcache From 65bdc2ce91f0b8bf25640c4b7d274c4149f3db97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 08:16:50 +0000 Subject: [PATCH 06/19] fix: changed workfolder of prod version to align with devcontainer --- .devcontainer/Dockerfile | 6 +++--- .devcontainer/devcontainer.json | 2 +- config/append_to_bashrc.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ce73953..be244aa 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -93,11 +93,11 @@ FROM dev AS prod # Copy our packages into the image and build them USER root -RUN mkdir -p /ws/src -WORKDIR /ws +RUN mkdir -p /home/ws/src +WORKDIR /home/ws COPY config config COPY src src RUN source /opt/ros/jazzy/setup.bash \ && colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -ENTRYPOINT ["python3", "/ws/config/append_to_bashrc.py"] \ No newline at end of file +ENTRYPOINT ["python3", "/home/ws/config/append_to_bashrc.py"] \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8f4c197..0e4856b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -44,5 +44,5 @@ "source=/dev/dri,target=/dev/dri,type=bind,consistency=cached", "source=/dev/input,target=/dev/input,type=bind,consistency=delegated" ], - "postCreateCommand": "sudo apt-get update && sudo rosdep update && sudo rosdep install --from-paths src --ignore-src -y && sudo chown -R $(whoami) /home/ws/ && python3 /home/ws/config/append_to_bashrc.py" + "postCreateCommand": "sudo chown -R $(whoami) /home/ws/ && python3 /home/ws/config/append_to_bashrc.py" } \ No newline at end of file diff --git a/config/append_to_bashrc.py b/config/append_to_bashrc.py index 726fefe..9fab257 100644 --- a/config/append_to_bashrc.py +++ b/config/append_to_bashrc.py @@ -26,7 +26,7 @@ def append_unique_lines_to_bashrc(source_file): print("ℹ️ No new lines were added. All lines already exist.") if __name__ == "__main__": - append_unique_lines_to_bashrc(os.path.expanduser("/ws/config/append_to_bashrc.txt")) + append_unique_lines_to_bashrc(os.path.abspath("/home/ws/config/append_to_bashrc.txt")) # If there are arguments passed to this container (i.e., CMD), run them From a903b9c60cbeed63140a59922e56628a9e97f73f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 08:17:30 +0000 Subject: [PATCH 07/19] fix(description): initialising rclpy twice led to failure --- .../test/launch_description.test.py | 25 +++++-------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/helmoro_description/test/launch_description.test.py b/src/helmoro_description/test/launch_description.test.py index 725babb..5ad1107 100644 --- a/src/helmoro_description/test/launch_description.test.py +++ b/src/helmoro_description/test/launch_description.test.py @@ -48,7 +48,7 @@ def generate_test_description(): ld.add_action(ready_to_test) return ld -class TestRobotStatePublisher(unittest.TestCase): +class TestCollection(unittest.TestCase): """Test suite for checking the robot_state_publisher functionality.""" def setUp(self): @@ -61,7 +61,7 @@ def tearDown(self): self.node.destroy_node() rclpy.shutdown() - def test_node_start(self, proc_output: ActiveIoHandler): + def test_robot_state_publisher_node_start(self, proc_output: ActiveIoHandler): """Test if the robot_state_publisher node has started.""" found = False print('Waiting for node...') @@ -75,7 +75,7 @@ def test_node_start(self, proc_output: ActiveIoHandler): # Assert that the node was found assert found, 'Node not found!' - def test_advertise_topic(self, proc_output: ActiveIoHandler): + def test_robot_state_publisher_advertise_topic(self, proc_output: ActiveIoHandler): """Test if the robot_description topic is advertised by the node.""" received = False print("Listening for topics...") @@ -94,7 +94,7 @@ def test_advertise_topic(self, proc_output: ActiveIoHandler): # Assert that the topic was advertised assert received, 'Topic not advertised!' - def test_publish_msgs(self, proc_output: ActiveIoHandler): + def test_robot_state_publisher_publish_msgs(self, proc_output: ActiveIoHandler): """Test if messages are published to the correct topic.""" msgs_rx = [] # List to store received messages @@ -128,20 +128,7 @@ def test_publish_msgs(self, proc_output: ActiveIoHandler): # Ensure that the subscription is destroyed after the test self.node.destroy_subscription(sub) -class TestJointStatePublisher(unittest.TestCase): - """Test suite for checking the joint_state_publisher functionality.""" - - def setUp(self): - """Initialize the ROS node before each test.""" - rclpy.init() - self.node = rclpy.create_node('test_node') - - def tearDown(self): - """Shut down the ROS node after each test.""" - self.node.destroy_node() - rclpy.shutdown() - - def test_node_start(self, proc_output: ActiveIoHandler): + def test_joint_state_publisher_node_start(self, proc_output: ActiveIoHandler): """Test if the joint_state_publisher node has started.""" found = False print('Waiting for node...') @@ -155,7 +142,7 @@ def test_node_start(self, proc_output: ActiveIoHandler): # Assert that the node was found assert found, 'Node not found!' - def test_advertise_topic(self, proc_output: ActiveIoHandler): + def test_joint_state_publisher_advertise_topic(self, proc_output: ActiveIoHandler): """Test if the joint_state topic is advertised by the node.""" received = False print("Listening for topics...") From 9e619bfefd196e12ee7c16fe8d76c5721fad5e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 08:29:07 +0000 Subject: [PATCH 08/19] fix(workflow): changed path from relative to absolute path --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61a39fe..a4fcf64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,5 +53,6 @@ jobs: - uses: actions/upload-artifact@v4 with: name: colcon-logs - path: ${{ steps.action_ros_ci_step.outputs.ros-workspace-directory-name }}/log + path: /home/ws/log + if-no-files-found: error if: always() # upload the logs even when the build fails From 12df8e14e17423aea73b96cb55827afad7f174f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 12:02:31 +0200 Subject: [PATCH 09/19] change name of image from github_actions to helmoro-software-ros2:-latest --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4fcf64..02aa6e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,21 +30,21 @@ jobs: with: context: . file: .devcontainer/Dockerfile - tags: ghcr.io/helbling-technik/github_actions:latest + tags: ghcr.io/helbling-technik/helmoro-software-ros2:${{ github.ref_name }}-latest push: true cache-from: | type=gha - type=registry,ref=ghcr.io/helbling-technik/github_actions:buildcache + type=registry,ref=ghcr.io/helbling-technik/helmoro-software-ros2:${{ github.ref_name }}-buildcache cache-to: | type=gha,mode=max - type=registry,ref=ghcr.io/helbling-technik/github_actions:buildcache,mode=max + type=registry,ref=ghcr.io/helbling-technik/helmoro-software-ros2:${{ github.ref_name }}-buildcache,mode=max colcon-test: needs: docker-build runs-on: ubuntu-latest container: - image: ghcr.io/helbling-technik/github_actions:latest + image: ghcr.io/helbling-technik/helmoro-software-ros2:${{ github.ref_name }}-latest steps: - name: colcon test run: | From 4973a356a5c2c90175bd63bcb5e6515d64e3ac90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 12:01:32 +0000 Subject: [PATCH 10/19] refactor environment parameter loading --- .devcontainer/Dockerfile | 8 ++++++-- .devcontainer/devcontainer.json | 2 +- config/append_to_bashrc.txt | 8 -------- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index be244aa..1c1bc53 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -56,8 +56,11 @@ RUN apt-get update && apt-get install -y \ ros-jazzy-teleop-twist-joy \ ros-jazzy-fuse +# Install cyclonedds rmw and set up the configuration RUN apt-get update && apt-get install -y \ - ros-jazzy-rmw-cyclonedds-cpp + ros-jazzy-rmw-cyclonedds-cpp && \ + grep -F "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" /root/.bashrc || echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> /root/.bashrc && \ + grep -F "export RMW_CYCLONEDDS_URI=file:///home/ws/config/cyclonedds.xml" /root/.bashrc || echo "export RMW_CYCLONEDDS_URI=file:///home/ws/config/cyclonedds.xml" >> /root/.bashrc # ******************************************************** # * Set up the user * @@ -100,4 +103,5 @@ COPY src src RUN source /opt/ros/jazzy/setup.bash \ && colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -ENTRYPOINT ["python3", "/home/ws/config/append_to_bashrc.py"] \ No newline at end of file +# Add install source to shell +RUN grep -F "source /home/ws/install/setup.bash" /root/.bashrc || echo "source /home/ws/install/setup.bash" >> /root/.bashrc \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0e4856b..0cea5ed 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -44,5 +44,5 @@ "source=/dev/dri,target=/dev/dri,type=bind,consistency=cached", "source=/dev/input,target=/dev/input,type=bind,consistency=delegated" ], - "postCreateCommand": "sudo chown -R $(whoami) /home/ws/ && python3 /home/ws/config/append_to_bashrc.py" + "postCreateCommand": "sudo chown -R $(whoami) /home/ws/ && sudo cp /root/.bashrc /home/$(whoami)/.bashrc && python3 /home/ws/config/append_to_bashrc.py" } \ No newline at end of file diff --git a/config/append_to_bashrc.txt b/config/append_to_bashrc.txt index 510fe5e..5d95426 100644 --- a/config/append_to_bashrc.txt +++ b/config/append_to_bashrc.txt @@ -1,10 +1,2 @@ # Custom Alias alias src='source /opt/ros/jazzy/setub.bash && source /home/ws/install/setup.bash' - -# Environment Setup -source /opt/ros/jazzy/setup.bash -source /home/ws/install/setup.bash -export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp -export CYCLONEDDS_URI=file:///home/ws/config/cyclonedds.xml - - From 6042963aab8bf56fdf22ac64c8eab826be4cd485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 12:02:16 +0000 Subject: [PATCH 11/19] fix(workflow): start tests in correct directory --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02aa6e2..2a7c980 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,7 @@ jobs: steps: - name: colcon test run: | + cd /home/ws colcon test - uses: actions/upload-artifact@v4 From 3018d3c7ae36ea4c552ea07555f576fd6b6fdf04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 12:13:35 +0000 Subject: [PATCH 12/19] Add Debug test --- .devcontainer/Dockerfile | 25 +++++++++------------ .devcontainer/devcontainer.json | 3 ++- .devcontainer/entrypoint.sh | 10 +++++++++ .github/workflows/ci.yml | 1 + .github/workflows/debug.yml | 40 +++++++++++++++++++++++++++++++++ config/append_to_bashrc.py | 1 - config/append_to_bashrc.txt | 3 +++ 7 files changed, 67 insertions(+), 16 deletions(-) create mode 100755 .devcontainer/entrypoint.sh create mode 100644 .github/workflows/debug.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 1c1bc53..fd23c7f 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -20,11 +20,6 @@ RUN apt-get update -q && \ apt-get install -y gnupg2 iputils-ping usbutils \ python3-argcomplete python3-colcon-common-extensions python3-networkx python3-pip python3-rosdep python3-vcstool -# Set up the ROS 2 environment -# This ensures that ROS 2 commands are available in the shell -RUN grep -F "source /opt/ros/jazzy/setup.bash" /root/.bashrc || echo "source /opt/ros/jazzy/setup.bash" >> /root/.bashrc && \ - grep -F "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" /root/.bashrc || echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> /root/.bashrc - # Install Linux packages # xterm: to use teleop_twist_keyboard RUN apt-get update && apt-get install -y \ @@ -58,9 +53,9 @@ RUN apt-get update && apt-get install -y \ # Install cyclonedds rmw and set up the configuration RUN apt-get update && apt-get install -y \ - ros-jazzy-rmw-cyclonedds-cpp && \ - grep -F "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" /root/.bashrc || echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> /root/.bashrc && \ - grep -F "export RMW_CYCLONEDDS_URI=file:///home/ws/config/cyclonedds.xml" /root/.bashrc || echo "export RMW_CYCLONEDDS_URI=file:///home/ws/config/cyclonedds.xml" >> /root/.bashrc + ros-jazzy-rmw-cyclonedds-cpp +ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp +ENV RMW_CYCLONEDDS_URI=file:///home/ws/config/cyclonedds.xml # ******************************************************** # * Set up the user * @@ -85,9 +80,15 @@ RUN apt-get update && apt-get upgrade -y RUN apt-get install -y python3-pip ENV SHELL=/bin/bash +# Define entrypoint +RUN mkdir -p /home/ws +COPY .devcontainer/entrypoint.sh /home/ws +RUN chmod +x /home/ws/entrypoint.sh +ENTRYPOINT [ "/home/ws/entrypoint.sh" ] +CMD ["/bin/bash"] + # [Optional] Set the default user. Omit if you want to keep the default as root. USER $USERNAME -CMD ["/bin/bash"] # ******************************************************** # * Production * @@ -96,12 +97,8 @@ FROM dev AS prod # Copy our packages into the image and build them USER root -RUN mkdir -p /home/ws/src WORKDIR /home/ws COPY config config COPY src src RUN source /opt/ros/jazzy/setup.bash \ - && colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release - -# Add install source to shell -RUN grep -F "source /home/ws/install/setup.bash" /root/.bashrc || echo "source /home/ws/install/setup.bash" >> /root/.bashrc \ No newline at end of file + && colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0cea5ed..4b088d4 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,6 +4,7 @@ "remoteUser": "htkz", "build": { "dockerfile": "Dockerfile", + "context": "..", "target": "dev", "args": { "USERNAME": "htkz" @@ -44,5 +45,5 @@ "source=/dev/dri,target=/dev/dri,type=bind,consistency=cached", "source=/dev/input,target=/dev/input,type=bind,consistency=delegated" ], - "postCreateCommand": "sudo chown -R $(whoami) /home/ws/ && sudo cp /root/.bashrc /home/$(whoami)/.bashrc && python3 /home/ws/config/append_to_bashrc.py" + "postCreateCommand": "sudo chown -R $(whoami) /home/ws/ && python3 /home/ws/config/append_to_bashrc.py" } \ No newline at end of file diff --git a/.devcontainer/entrypoint.sh b/.devcontainer/entrypoint.sh new file mode 100755 index 0000000..3d92c74 --- /dev/null +++ b/.devcontainer/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -e + +# Source environment variables +source /opt/ros/jazzy/setup.bash +source /home/ws/install/setup.bash +source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash + +# Execute the provided command +exec "$@" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a7c980..0a68d8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,7 @@ jobs: - name: colcon test run: | cd /home/ws + source entrypoint.sh colcon test - uses: actions/upload-artifact@v4 diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml new file mode 100644 index 0000000..ed28384 --- /dev/null +++ b/.github/workflows/debug.yml @@ -0,0 +1,40 @@ +name: colcon-test-only + +on: + push: + branches: + - '**' + - '!humble' + - '!jazzy' + +jobs: + colcon-test: + runs-on: ubuntu-latest + container: + image: ghcr.io/helbling-technik/helmoro-software-ros2:${{ github.ref_name }}-latest + steps: + - name: check username + run: | + echo "===================" + whoami + pwd + ls -la + printenv + - name: check username + run: | + echo "===================" + source entrypoint.sh + printenv + echo "===================" + - name: colcon test + run: | + cd /home/ws + source entrypoint.sh + colcon test + + - uses: actions/upload-artifact@v4 + with: + name: colcon-logs + path: /home/ws/log + if-no-files-found: error + if: always() # upload the logs even when the build fails diff --git a/config/append_to_bashrc.py b/config/append_to_bashrc.py index 9fab257..79ce07d 100644 --- a/config/append_to_bashrc.py +++ b/config/append_to_bashrc.py @@ -28,7 +28,6 @@ def append_unique_lines_to_bashrc(source_file): if __name__ == "__main__": append_unique_lines_to_bashrc(os.path.abspath("/home/ws/config/append_to_bashrc.txt")) - # If there are arguments passed to this container (i.e., CMD), run them if len(sys.argv) > 1: os.execvp(sys.argv[1], sys.argv[1:]) diff --git a/config/append_to_bashrc.txt b/config/append_to_bashrc.txt index 5d95426..d3d43a2 100644 --- a/config/append_to_bashrc.txt +++ b/config/append_to_bashrc.txt @@ -1,2 +1,5 @@ # Custom Alias alias src='source /opt/ros/jazzy/setub.bash && source /home/ws/install/setup.bash' + +# Integrate entrypoint.sh +source /home/ws/.devcontainer/entrypoint.sh \ No newline at end of file From 3a785e82898392d27968f63b05bce32ba87fa043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 13:16:05 +0000 Subject: [PATCH 13/19] fix(entrypoint): prevent crash with set +x --- .devcontainer/entrypoint.sh | 4 ++-- .github/workflows/ci.yml | 17 +++++++++++------ .github/workflows/debug.yml | 24 ++++++++---------------- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/.devcontainer/entrypoint.sh b/.devcontainer/entrypoint.sh index 3d92c74..2ba3e6b 100755 --- a/.devcontainer/entrypoint.sh +++ b/.devcontainer/entrypoint.sh @@ -1,10 +1,10 @@ #!/bin/bash -set -e +set +e # Source environment variables source /opt/ros/jazzy/setup.bash source /home/ws/install/setup.bash -source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash +#source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash # Execute the provided command exec "$@" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a68d8b..84c412a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: docker build & colcon-test +name: Build Image and Run Tests on: push: @@ -8,7 +8,7 @@ on: - '!jazzy' jobs: - docker-build: + Build-image: runs-on: ubuntu-latest steps: @@ -40,19 +40,24 @@ jobs: type=registry,ref=ghcr.io/helbling-technik/helmoro-software-ros2:${{ github.ref_name }}-buildcache,mode=max - colcon-test: - needs: docker-build + Run-tests: + needs: Build-image runs-on: ubuntu-latest container: image: ghcr.io/helbling-technik/helmoro-software-ros2:${{ github.ref_name }}-latest steps: - - name: colcon test + - name: Source packages + shell: bash run: | cd /home/ws source entrypoint.sh + + - name: Run tests + run: | colcon test - - uses: actions/upload-artifact@v4 + - name: Upload logs + uses: actions/upload-artifact@v4 with: name: colcon-logs path: /home/ws/log diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index ed28384..94477da 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -1,4 +1,4 @@ -name: colcon-test-only +name: Run Tests on: push: @@ -13,26 +13,18 @@ jobs: container: image: ghcr.io/helbling-technik/helmoro-software-ros2:${{ github.ref_name }}-latest steps: - - name: check username - run: | - echo "===================" - whoami - pwd - ls -la - printenv - - name: check username - run: | - echo "===================" - source entrypoint.sh - printenv - echo "===================" - - name: colcon test + - name: Source packages + shell: bash run: | cd /home/ws source entrypoint.sh + + - name: Run tests + run: | colcon test - - uses: actions/upload-artifact@v4 + - name: Upload logs + uses: actions/upload-artifact@v4 with: name: colcon-logs path: /home/ws/log From efd57a903b0266bdf19dde52aec6a556b5749d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 14:20:17 +0000 Subject: [PATCH 14/19] Test for failure --- src/helmoro_description/test/launch_description.test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/helmoro_description/test/launch_description.test.py b/src/helmoro_description/test/launch_description.test.py index 5ad1107..0e1e243 100644 --- a/src/helmoro_description/test/launch_description.test.py +++ b/src/helmoro_description/test/launch_description.test.py @@ -140,6 +140,7 @@ def test_joint_state_publisher_node_start(self, proc_output: ActiveIoHandler): time.sleep(0.1) # Assert that the node was found + assert False assert found, 'Node not found!' def test_joint_state_publisher_advertise_topic(self, proc_output: ActiveIoHandler): From 1f894c222b6c8a67ee302afe4854bb3acac39736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 14:29:17 +0000 Subject: [PATCH 15/19] fix(workflows): specified default work directory --- .devcontainer/entrypoint.sh | 2 +- .github/workflows/ci.yml | 4 +++- .github/workflows/debug.yml | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.devcontainer/entrypoint.sh b/.devcontainer/entrypoint.sh index 2ba3e6b..3ed87e1 100755 --- a/.devcontainer/entrypoint.sh +++ b/.devcontainer/entrypoint.sh @@ -4,7 +4,7 @@ set +e # Source environment variables source /opt/ros/jazzy/setup.bash source /home/ws/install/setup.bash -#source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash +source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash # Execute the provided command exec "$@" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84c412a..7465a23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,13 +43,15 @@ jobs: Run-tests: needs: Build-image runs-on: ubuntu-latest + defaults: + run: + working-directory: /home/ws container: image: ghcr.io/helbling-technik/helmoro-software-ros2:${{ github.ref_name }}-latest steps: - name: Source packages shell: bash run: | - cd /home/ws source entrypoint.sh - name: Run tests diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index 94477da..8712918 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -10,17 +10,22 @@ on: jobs: colcon-test: runs-on: ubuntu-latest + defaults: + run: + working-directory: /home/ws container: image: ghcr.io/helbling-technik/helmoro-software-ros2:${{ github.ref_name }}-latest steps: - name: Source packages shell: bash run: | - cd /home/ws + ls + pwd source entrypoint.sh - name: Run tests run: | + ls colcon test - name: Upload logs From 6ea7d8aed6f552254f34599cba59db36506411f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 14:41:54 +0000 Subject: [PATCH 16/19] fix: forgot to source --- .github/workflows/ci.yml | 6 ++---- .github/workflows/debug.yml | 9 ++------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7465a23..50e3b74 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,14 +48,12 @@ jobs: working-directory: /home/ws container: image: ghcr.io/helbling-technik/helmoro-software-ros2:${{ github.ref_name }}-latest + steps: - - name: Source packages + - name: Run tests shell: bash run: | source entrypoint.sh - - - name: Run tests - run: | colcon test - name: Upload logs diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index 8712918..d2bb914 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -15,17 +15,12 @@ jobs: working-directory: /home/ws container: image: ghcr.io/helbling-technik/helmoro-software-ros2:${{ github.ref_name }}-latest + steps: - - name: Source packages + - name: Run tests shell: bash run: | - ls - pwd source entrypoint.sh - - - name: Run tests - run: | - ls colcon test - name: Upload logs From 9d1f2e36ff8a24d6314ff8044711625432e82ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 14:47:34 +0000 Subject: [PATCH 17/19] remove debug statement --- src/helmoro_description/test/launch_description.test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/helmoro_description/test/launch_description.test.py b/src/helmoro_description/test/launch_description.test.py index 0e1e243..5ad1107 100644 --- a/src/helmoro_description/test/launch_description.test.py +++ b/src/helmoro_description/test/launch_description.test.py @@ -140,7 +140,6 @@ def test_joint_state_publisher_node_start(self, proc_output: ActiveIoHandler): time.sleep(0.1) # Assert that the node was found - assert False assert found, 'Node not found!' def test_joint_state_publisher_advertise_topic(self, proc_output: ActiveIoHandler): From 3054801332b161744f96ec1a945366f4b7ebcc65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 14:55:02 +0000 Subject: [PATCH 18/19] Enabled debug statement again and added check for test failure in workflow --- .github/workflows/ci.yml | 4 +++- .github/workflows/debug.yml | 4 +++- src/helmoro_description/test/launch_description.test.py | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50e3b74..75e77c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,8 +53,10 @@ jobs: - name: Run tests shell: bash run: | + set -e source entrypoint.sh colcon test + colcon test-result --all --verbose - name: Upload logs uses: actions/upload-artifact@v4 @@ -62,4 +64,4 @@ jobs: name: colcon-logs path: /home/ws/log if-no-files-found: error - if: always() # upload the logs even when the build fails + if: always() # upload the logs even when the test fails diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index d2bb914..c0eae36 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -20,8 +20,10 @@ jobs: - name: Run tests shell: bash run: | + set -e source entrypoint.sh colcon test + colcon test-result --all --verbose - name: Upload logs uses: actions/upload-artifact@v4 @@ -29,4 +31,4 @@ jobs: name: colcon-logs path: /home/ws/log if-no-files-found: error - if: always() # upload the logs even when the build fails + if: always() # upload the logs even when the test fails diff --git a/src/helmoro_description/test/launch_description.test.py b/src/helmoro_description/test/launch_description.test.py index 5ad1107..0e1e243 100644 --- a/src/helmoro_description/test/launch_description.test.py +++ b/src/helmoro_description/test/launch_description.test.py @@ -140,6 +140,7 @@ def test_joint_state_publisher_node_start(self, proc_output: ActiveIoHandler): time.sleep(0.1) # Assert that the node was found + assert False assert found, 'Node not found!' def test_joint_state_publisher_advertise_topic(self, proc_output: ActiveIoHandler): From af16bc5a1b8eeaf491eef9b9337be51c47d614e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Bl=C3=B6chlinger?= Date: Fri, 2 May 2025 15:00:41 +0000 Subject: [PATCH 19/19] Remove debug statement --- src/helmoro_description/test/launch_description.test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/helmoro_description/test/launch_description.test.py b/src/helmoro_description/test/launch_description.test.py index 0e1e243..5ad1107 100644 --- a/src/helmoro_description/test/launch_description.test.py +++ b/src/helmoro_description/test/launch_description.test.py @@ -140,7 +140,6 @@ def test_joint_state_publisher_node_start(self, proc_output: ActiveIoHandler): time.sleep(0.1) # Assert that the node was found - assert False assert found, 'Node not found!' def test_joint_state_publisher_advertise_topic(self, proc_output: ActiveIoHandler):