GitHub Action
ROS 2 CI
This action could be used as a continuous integration (CI) to build and test a ROS 2 project.
This action works by building and testing a ROS 2 project inside a Docker's container using the official ROS 2 Docker image. To handle which ROS 2 environment to be used, this action uses a Docker in Docker (DinD). Hence the CI process happens inside the container's container, not just the first layer of the Docker's container for GitHub Actions. Although, The CI process is guaranteed to be fast (approximately 3-5 minutes, depends on each package) as almost every component of the ROS 2 has already been installed inside the Docker's image.
To be able to build and test the project inside the repository, This action requires the Checkout action.
Before the build process, the project files will be put under the /ws/repo
directory inside the container.
Then, the build and test process will be done using colcon inside the /ws
directory.
After the test process happens, the build results (build
, install
, and log
) will be copied inside the /ws/repo/.ws
.
The drawback of using this action is it still needs to install external dependencies that haven't been included in the ROS 2 default installation.
But that problem could be solved by adding a apt-packages
or a pip-packages
input inside the action configuration (see this) or by cloning external packages inside the /ws
directory before the build process happens (see this).
For more information, see the action.yml and the GitHub Actions guide.
name: ROS 2 CI
on:
pull_request:
branches: [ master ]
push:
branches: [ master ]
jobs:
build-and-test:
runs-on: ubuntu-latest
name: Build and test the project
steps:
- name: Checkout
uses: actions/[email protected]
- name: Build and test
uses: ichiro-its/[email protected]
This will be defaulted to use ROS 2 Foxy Fitzroy.
- name: Build and test
uses: ichiro-its/[email protected]
with:
ros2-distro: rolling
- name: Build and test
uses: ichiro-its/[email protected]
with:
apt-packages: libssh-dev libopencv-dev
- name: Build and test
uses: ichiro-its/[email protected]
with:
post-test: ls .ws
- name: Build and test
uses: ichiro-its/[email protected]
with:
apt-packages: git
pre-build: git clone https://github.com/ros2/examples /ws/examples
This project is licensed under the MIT License.