Skip to content
Snippets Groups Projects
README.md 2.56 KiB
Newer Older
[![ROS](https://upload.wikimedia.org/wikipedia/commons/b/bb/Ros_logo.svg)](http://www.ros.org/)
Victor Lamoine's avatar
Victor Lamoine committed

Victor Lamoine's avatar
Victor Lamoine committed
Using Travis CI? Take a look at [ros-industrial/industrial_ci](https://github.com/ros-industrial/industrial_ci).
Victor Lamoine's avatar
Victor Lamoine committed

Victor Lamoine's avatar
Victor Lamoine committed
## Description
This repository contains helper scripts and instructions on how to use Continuous Integration (CI) for ROS projects hosted on a GitLab instance.
Victor Lamoine's avatar
Victor Lamoine committed

Victor Lamoine's avatar
Victor Lamoine committed
Supported ROS releases (older release should be supported too):

- `humble`
- `jazzy`
Victor Lamoine's avatar
Victor Lamoine committed

Victor Lamoine's avatar
Victor Lamoine committed
This repository uses the [ROS Docker](https://store.docker.com/images/ros) images to compile your packages, it does not run tests by default.
Victor Lamoine's avatar
Victor Lamoine committed

Victor Lamoine's avatar
Victor Lamoine committed
## How to use
Victor Lamoine's avatar
Victor Lamoine committed
Your repository must be hosted on a GitLab instance with CI working and Docker support.

Victor Lamoine's avatar
Victor Lamoine committed
Create a `.gitlab-ci.yml` that looks like this:
Victor Lamoine's avatar
Victor Lamoine committed

Victor Lamoine's avatar
Victor Lamoine committed
```yml
image: ros:jazzy-ros-core
Victor Lamoine's avatar
Victor Lamoine committed

Victor Lamoine's avatar
Victor Lamoine committed
cache:
  paths:
    - ccache/

Victor Lamoine's avatar
Victor Lamoine committed
before_script:
  - apt update >/dev/null && apt install -y git >/dev/null
Victor Lamoine's avatar
Victor Lamoine committed
  - git clone https://gitlab.com/VictorLamoine/ros_gitlab_ci.git >/dev/null
  - source ros_gitlab_ci/gitlab-ci.bash >/dev/null
Victor Lamoine's avatar
Victor Lamoine committed

jazzy:build:
Victor Lamoine's avatar
Victor Lamoine committed
  stage: build
  script:
    - source ros_gitlab_ci/gitlab-ci.bash >/dev/null
    - colcon build --event-handlers console_cohesion+ --packages-up-to package_name
Victor Lamoine's avatar
Victor Lamoine committed
```

Commit, push to your repository and watch the pipeline! (make sure pipelines are enabled in your project settings).
Victor Lamoine's avatar
Victor Lamoine committed
## Useful variables
- `DISABLE_CCACHE` (false by default), if defined to `true`: disables [ccache](https://ccache.samba.org/) gcc output caching.
- `USE_ROSDEP` (true by default) use [rosdep](http://wiki.ros.org/rosdep/) to install dependencies. Define to `false` to disable.
- `ROSINSTALL_CI_JOB_TOKEN` (false by default), if defined to `true`: makes it possible to clone private repositories using wstool by using the [CI job permissions mode](https://docs.gitlab.com/ee/user/project/new_ci_build_permissions_model.html). Requires GitLab 8.12 minimum and that the private repositories are on the same GitLab server.
- `WSTOOL_RECURSIVE` (false by default), if defined to `true`: 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
Victor Lamoine's avatar
Victor Lamoine committed
## Installing extra APT packages
Victor Lamoine's avatar
Victor Lamoine committed
Just add them after sourcing `gitlab-ci.bash` in the `before_script` section, for example:
Victor Lamoine's avatar
Victor Lamoine committed

```yml
before_script:
 - apt update >/dev/null && apt install -y git >/dev/null
Victor Lamoine's avatar
Victor Lamoine committed
 - 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-jazzy-uuid-msgs >/dev/null
Victor Lamoine's avatar
Victor Lamoine committed
```