diff --git a/.github/actions/smoke-test/build.sh b/.github/actions/smoke-test/build.sh index f7cb9b0..662017c 100755 --- a/.github/actions/smoke-test/build.sh +++ b/.github/actions/smoke-test/build.sh @@ -43,7 +43,9 @@ if [ -d "${TEST_DIR}" ] ; then DEST_DIR="${SRC_DIR}/test-project" mkdir -p ${DEST_DIR} cp -Rp ${TEST_DIR}/* ${DEST_DIR} - cp -Rp test/test-utils/* ${DEST_DIR} + if [ -d "test/test-utils" ]; then + cp -Rp test/test-utils/* ${DEST_DIR} + fi fi export DOCKER_BUILDKIT=1 diff --git a/.github/workflows/test-pr.yaml b/.github/workflows/test-pr.yaml index 1abd886..ed89344 100644 --- a/.github/workflows/test-pr.yaml +++ b/.github/workflows/test-pr.yaml @@ -4,6 +4,11 @@ on: jobs: smoke-test: + strategy: + matrix: + template: + - gz + - ros2 runs-on: ubuntu-latest permissions: # Give the default GITHUB_TOKEN write permission to commit and push the @@ -12,11 +17,11 @@ jobs: steps: - uses: actions/checkout@v6 - - name: Smoke test for "gz" + - name: Smoke test for "${{ matrix.template }}" id: smoke_test uses: ./.github/actions/smoke-test with: - template: "gz" + template: "${{ matrix.template }}" feature-tests: runs-on: ubuntu-latest diff --git a/README.md b/README.md index 057ad3e..7bf3064 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,14 @@ Devcontainer templates repository focused on robotics and simulation. -## Included template +## Included templates - `templates/src/gz` +- `templates/src/ros2` + +The templates are development entry points for the actively maintained +`althack/gz` and `althack/ros2` image collections. ROS 2 is headless by default +so projects can choose their own host GUI integration when needed. ## Included feature diff --git a/templates/src/ros2/.devcontainer/devcontainer.json b/templates/src/ros2/.devcontainer/devcontainer.json new file mode 100644 index 0000000..ccdde5a --- /dev/null +++ b/templates/src/ros2/.devcontainer/devcontainer.json @@ -0,0 +1,24 @@ +{ + "name": "ROS 2", + "image": "althack/ros2:${templateOption:distro}-${templateOption:imageVariant}", + "remoteUser": "ros", + "updateRemoteUserUID": true, + "runArgs": [ + "--network=host", + "--ipc=host", + "--cap-add=SYS_PTRACE", + "--security-opt=seccomp:unconfined", + "--security-opt=apparmor:unconfined" + ], + "customizations": { + "vscode": { + "extensions": [ + "ms-iot.vscode-ros", + "ms-vscode.cpptools", + "ms-python.python", + "twxs.cmake", + "redhat.vscode-yaml" + ] + } + } +} diff --git a/templates/src/ros2/NOTES.md b/templates/src/ros2/NOTES.md new file mode 100644 index 0000000..29752f6 --- /dev/null +++ b/templates/src/ros2/NOTES.md @@ -0,0 +1,16 @@ +## Image selection + +This template uses the actively maintained +[`althack/ros2`](https://hub.docker.com/r/althack/ros2) image collection. +`distro` and `imageVariant` select the image tag +`-`. The default is `jazzy-dev`. + +The moving tags follow the latest build of each supported ROS distribution. +For fully reproducible projects, replace the generated image tag with one of +the dated tags published alongside it. + +## ROS networking + +The template uses host networking and host IPC to support common local ROS +discovery and shared-memory workflows. Review those settings before using the +template with untrusted software. diff --git a/templates/src/ros2/README.md b/templates/src/ros2/README.md new file mode 100644 index 0000000..b6730a5 --- /dev/null +++ b/templates/src/ros2/README.md @@ -0,0 +1,33 @@ + +# ROS 2 (ros2) + +ROS 2 development environment backed by the althack/ros2 image collection. + +## Options + +| Options Id | Description | Type | Default Value | +|-----|-----|-----|-----| +| distro | ROS 2 distribution to use. | string | jazzy | +| imageVariant | Container image variant to use for this ROS 2 distribution. | string | dev | + +## Image selection + +This template uses the actively maintained +[`althack/ros2`](https://hub.docker.com/r/althack/ros2) image collection. +`distro` and `imageVariant` select the image tag +`-`. The default is `jazzy-dev`. + +The moving tags follow the latest build of each supported ROS distribution. +For fully reproducible projects, replace the generated image tag with one of +the dated tags published alongside it. + +## ROS networking + +The template uses host networking and host IPC to support common local ROS +discovery and shared-memory workflows. Review those settings before using the +template with untrusted software. + + +--- + +_Note: This file was auto-generated from the [devcontainer-template.json](https://github.com/althack/devcontainers/blob/main/templates/src/ros2/devcontainer-template.json). Add additional notes to a `NOTES.md`._ diff --git a/templates/src/ros2/devcontainer-template.json b/templates/src/ros2/devcontainer-template.json new file mode 100644 index 0000000..80a09e7 --- /dev/null +++ b/templates/src/ros2/devcontainer-template.json @@ -0,0 +1,48 @@ +{ + "id": "ros2", + "version": "0.1.0", + "name": "ROS 2", + "description": "ROS 2 development environment backed by the althack/ros2 image collection.", + "documentationURL": "https://github.com/althack/devcontainers/tree/main/templates/src/ros2", + "licenseURL": "https://github.com/althack/devcontainers/blob/main/LICENSE", + "publisher": "althack", + "keywords": [ + "ros", + "ros2", + "robotics", + "ubuntu", + "docker" + ], + "platforms": [ + "ROS 2", + "Ubuntu", + "C++", + "Python" + ], + "options": { + "distro": { + "type": "string", + "description": "ROS 2 distribution to use.", + "proposals": [ + "rolling", + "lyrical", + "kilted", + "jazzy", + "humble" + ], + "default": "jazzy" + }, + "imageVariant": { + "type": "string", + "description": "Container image variant to use for this ROS 2 distribution.", + "proposals": [ + "base", + "dev", + "desktop", + "full", + "gazebo" + ], + "default": "dev" + } + } +} diff --git a/test/ros2/test.sh b/test/ros2/test.sh new file mode 100755 index 0000000..338567a --- /dev/null +++ b/test/ros2/test.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + +test "${ROS_DISTRO:-}" = "jazzy" +test "$(id -un)" = "ros" +ros2 --help >/dev/null