Using Travis CI? Take a look at ros-industrial/industrial_ci.
This repository contains helper scripts and instructions on how to use Continuous Integration (CI) for ROS projects hosted on a GitLab instance.
Supported ROS releases (older release should be supported too):
melodic
noetic
This repository uses the ROS Docker images to compile your packages, it does not run tests by default.
Your repository must be hosted on a GitLab instance with CI working and Docker support.
Create a .gitlab-ci.yml
that looks like this:
image: ros:noetic-ros-core
cache:
paths:
- ccache/
before_script:
- apt update >/dev/null && apt install -y git >/dev/null
- git clone https://gitlab.com/VictorLamoine/ros_gitlab_ci.git >/dev/null
- source ros_gitlab_ci/gitlab-ci.bash >/dev/null
catkin_make:
stage: build
script:
- catkin_make
catkin tools:
stage: build
script:
- catkin build --summarize --no-status --force-color
Commit, push to your repository and watch the pipeline! (make sure pipelines are enabled in your project settings).
If you want to test your packages after building them, read the example package section.
DISABLE_CCACHE
(false by default), if defined totrue
: disables ccache gcc output caching.USE_ROSDEP
(true by default) use rosdep to install dependencies. Define tofalse
to disable.ROSINSTALL_CI_JOB_TOKEN
(false by default), if defined totrue
: makes it possible to clone private repositories using wstool by using the CI job permissions mode. Requires GitLab 8.12 minimum and that the private repositories are on the same GitLab server.WSTOOL_RECURSIVE
(false by default), if defined totrue
: wstool will be used to cloned recursively every repositories specified in the*.rosinstall
files. For this feature to work:- The rosinstall file names must be unique
- No repository may contain a space in it's name
Just add them after sourcing gitlab-ci.bash
in the before_script
section, for example:
before_script:
- apt update >/dev/null && apt install -y git >/dev/null
- git clone https://gitlab.com/VictorLamoine/ros_gitlab_ci.git >/dev/null
- source ros_gitlab_ci/gitlab-ci.bash >/dev/null
- apt install -y liblapack-dev ros-noetic-uuid-msgs >/dev/null
Using with catkin_lint
Example usage:
catkin lint:
stage: test
image: ros:noetic-ros-core
needs: []
before_script:
- apt update >/dev/null && apt install -y python3-catkin-lint >/dev/null
script:
- catkin_lint -W2 .
You can also test you packages using the ROS testing tools and GitLab CI pipelines.
Example package: https://gitlab.com/VictorLamoine/ros_gitlab_ci_test