From 72333722243c60d46f514b393594d0c53874d707 Mon Sep 17 00:00:00 2001
From: Allison Thackston <73732028+althack@users.noreply.github.com>
Date: Tue, 11 Aug 2026 11:38:17 -0700
Subject: [PATCH 1/2] Add ROS 2 workspace build test
---
.github/workflows/test-pr.yaml | 1 +
.../assets/minimal_package/CMakeLists.txt | 14 +++++++++++
.../ros2/assets/minimal_package/package.xml | 15 ++++++++++++
.../ros2/assets/minimal_package/src/main.cpp | 7 ++++++
.../assets/minimal_package/test/test_main.cpp | 6 +++++
features/test/ros2/scenarios.json | 4 ++++
features/test/ros2/workspace_build.sh | 23 +++++++++++++++++++
7 files changed, 70 insertions(+)
create mode 100644 features/test/ros2/assets/minimal_package/CMakeLists.txt
create mode 100644 features/test/ros2/assets/minimal_package/package.xml
create mode 100644 features/test/ros2/assets/minimal_package/src/main.cpp
create mode 100644 features/test/ros2/assets/minimal_package/test/test_main.cpp
create mode 100755 features/test/ros2/workspace_build.sh
diff --git a/.github/workflows/test-pr.yaml b/.github/workflows/test-pr.yaml
index afd7138..aed8295 100644
--- a/.github/workflows/test-pr.yaml
+++ b/.github/workflows/test-pr.yaml
@@ -119,6 +119,7 @@ jobs:
- lyrical
- osrf_ros
- upstream_ros
+ - workspace_build
- workspace_overlay
- shells
steps:
diff --git a/features/test/ros2/assets/minimal_package/CMakeLists.txt b/features/test/ros2/assets/minimal_package/CMakeLists.txt
new file mode 100644
index 0000000..7c67ae5
--- /dev/null
+++ b/features/test/ros2/assets/minimal_package/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.8)
+project(devcontainers_minimal)
+
+find_package(ament_cmake REQUIRED)
+
+add_executable(devcontainers_minimal_node src/main.cpp)
+install(TARGETS devcontainers_minimal_node DESTINATION lib/${PROJECT_NAME})
+
+if(BUILD_TESTING)
+ find_package(ament_cmake_gtest REQUIRED)
+ ament_add_gtest(devcontainers_minimal_test test/test_main.cpp)
+endif()
+
+ament_package()
diff --git a/features/test/ros2/assets/minimal_package/package.xml b/features/test/ros2/assets/minimal_package/package.xml
new file mode 100644
index 0000000..e6bcf2b
--- /dev/null
+++ b/features/test/ros2/assets/minimal_package/package.xml
@@ -0,0 +1,15 @@
+
+
+ devcontainers_minimal
+ 0.0.0
+ Minimal package used to validate the ROS 2 development environment.
+ Devcontainers test
+ Apache-2.0
+
+ ament_cmake
+ ament_cmake_gtest
+
+
+ ament_cmake
+
+
diff --git a/features/test/ros2/assets/minimal_package/src/main.cpp b/features/test/ros2/assets/minimal_package/src/main.cpp
new file mode 100644
index 0000000..cf76d03
--- /dev/null
+++ b/features/test/ros2/assets/minimal_package/src/main.cpp
@@ -0,0 +1,7 @@
+#include
+
+int main()
+{
+ std::cout << "ROS 2 development environment is ready" << std::endl;
+ return 0;
+}
diff --git a/features/test/ros2/assets/minimal_package/test/test_main.cpp b/features/test/ros2/assets/minimal_package/test/test_main.cpp
new file mode 100644
index 0000000..32f8580
--- /dev/null
+++ b/features/test/ros2/assets/minimal_package/test/test_main.cpp
@@ -0,0 +1,6 @@
+#include
+
+TEST(DevcontainersMinimal, BuildsAndRuns)
+{
+ EXPECT_EQ(2 + 2, 4);
+}
diff --git a/features/test/ros2/scenarios.json b/features/test/ros2/scenarios.json
index db1dde5..340d34f 100644
--- a/features/test/ros2/scenarios.json
+++ b/features/test/ros2/scenarios.json
@@ -46,5 +46,9 @@
"workspace": "/tmp/ros2_shell_overlay"
}
}
+ },
+ "workspace_build": {
+ "image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
+ "features": { "ros2": { "package": "ros-base" } }
}
}
diff --git a/features/test/ros2/workspace_build.sh b/features/test/ros2/workspace_build.sh
new file mode 100755
index 0000000..07ab377
--- /dev/null
+++ b/features/test/ros2/workspace_build.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+set -e
+source dev-container-features-test-lib
+
+test_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+workspace="/tmp/ros2_minimal_workspace"
+
+mkdir -p "${workspace}/src"
+cp -R "${test_dir}/assets/minimal_package" "${workspace}/src/"
+cd "${workspace}"
+
+check "rosdep metadata can be updated" rosdep update
+check "workspace dependencies can be resolved" rosdep install --from-paths src --ignore-src --rosdistro "${ROS_DISTRO}" -y
+check "minimal workspace builds" colcon build --event-handlers console_direct+
+
+# shellcheck disable=SC1091
+source install/setup.bash
+
+check "minimal workspace tests run" colcon test --event-handlers console_direct+
+check "minimal workspace tests pass" colcon test-result --verbose
+check "installed workspace executable runs" "${workspace}/install/devcontainers_minimal/lib/devcontainers_minimal/devcontainers_minimal_node"
+
+reportResults
From d20f12fe5473a2faa56e0c4eb8b1df9c38290884 Mon Sep 17 00:00:00 2001
From: Allison Thackston <73732028+althack@users.noreply.github.com>
Date: Tue, 18 Aug 2026 17:25:15 -0700
Subject: [PATCH 2/2] Run ROS 2 workspace checks in the main test
---
.github/workflows/test-pr.yaml | 1 -
features/test/ros2/scenarios.json | 4 ----
features/test/ros2/test.sh | 18 ++++++++++++++++++
features/test/ros2/workspace_build.sh | 23 -----------------------
4 files changed, 18 insertions(+), 28 deletions(-)
delete mode 100755 features/test/ros2/workspace_build.sh
diff --git a/.github/workflows/test-pr.yaml b/.github/workflows/test-pr.yaml
index aed8295..afd7138 100644
--- a/.github/workflows/test-pr.yaml
+++ b/.github/workflows/test-pr.yaml
@@ -119,7 +119,6 @@ jobs:
- lyrical
- osrf_ros
- upstream_ros
- - workspace_build
- workspace_overlay
- shells
steps:
diff --git a/features/test/ros2/scenarios.json b/features/test/ros2/scenarios.json
index 340d34f..db1dde5 100644
--- a/features/test/ros2/scenarios.json
+++ b/features/test/ros2/scenarios.json
@@ -46,9 +46,5 @@
"workspace": "/tmp/ros2_shell_overlay"
}
}
- },
- "workspace_build": {
- "image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
- "features": { "ros2": { "package": "ros-base" } }
}
}
diff --git a/features/test/ros2/test.sh b/features/test/ros2/test.sh
index 4646e8a..c52c94a 100755
--- a/features/test/ros2/test.sh
+++ b/features/test/ros2/test.sh
@@ -15,4 +15,22 @@ check "absent overlay does not break shell startup" bash -lc 'command -v ros2 >/
check "effective user bashrc sources ROS profile once" bash -lc 'test "$(grep -Fc "[ -f /etc/profile.d/ros2.sh ] && . /etc/profile.d/ros2.sh" /home/vscode/.bashrc)" -eq 1'
check "colcon completion is enabled" bash -ic 'complete -p colcon >/dev/null'
+test_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+workspace="/tmp/ros2_minimal_workspace"
+
+mkdir -p "${workspace}/src"
+cp -R "${test_dir}/assets/minimal_package" "${workspace}/src/"
+cd "${workspace}"
+
+check "rosdep metadata can be updated" rosdep update
+check "workspace dependencies can be resolved" rosdep install --from-paths src --ignore-src --rosdistro "${ROS_DISTRO}" -y
+check "minimal workspace builds" colcon build --event-handlers console_direct+
+
+# shellcheck disable=SC1091
+source install/setup.bash
+
+check "minimal workspace tests run" colcon test --event-handlers console_direct+
+check "minimal workspace tests pass" colcon test-result --verbose
+check "installed workspace executable runs" "${workspace}/install/devcontainers_minimal/lib/devcontainers_minimal/devcontainers_minimal_node"
+
reportResults
diff --git a/features/test/ros2/workspace_build.sh b/features/test/ros2/workspace_build.sh
deleted file mode 100755
index 07ab377..0000000
--- a/features/test/ros2/workspace_build.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env bash
-set -e
-source dev-container-features-test-lib
-
-test_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-workspace="/tmp/ros2_minimal_workspace"
-
-mkdir -p "${workspace}/src"
-cp -R "${test_dir}/assets/minimal_package" "${workspace}/src/"
-cd "${workspace}"
-
-check "rosdep metadata can be updated" rosdep update
-check "workspace dependencies can be resolved" rosdep install --from-paths src --ignore-src --rosdistro "${ROS_DISTRO}" -y
-check "minimal workspace builds" colcon build --event-handlers console_direct+
-
-# shellcheck disable=SC1091
-source install/setup.bash
-
-check "minimal workspace tests run" colcon test --event-handlers console_direct+
-check "minimal workspace tests pass" colcon test-result --verbose
-check "installed workspace executable runs" "${workspace}/install/devcontainers_minimal/lib/devcontainers_minimal/devcontainers_minimal_node"
-
-reportResults