There is no difference between ROS 1 and ROS 2 in that regards. You can do any of the following:
- Register the repository in the rosdistro database and the buildfarm will optionally build each commit on the target branch and/or every pull request against that target branch. This approach requires dependencies to be released and available as Debian packages.
- Use Travis (or any other service) to invoke a build of the repository using the
ros_buildfarm
scripts. This can e.g. do a prerelease build which can span multiple not yet released repositories. - Manage your own custom build logic.