Coder Social home page Coder Social logo

ros-builder-action's Introduction

github action to build .deb packages from ROS sources

This repository provides actions and resusable workflows helping to build Debian packages from ROS package sources.

For convenience, the built packages from ros-one.repos are deployed to https://ros.packages.techfak.net.
If you want any other packages to be included in the repository, please open an issue or pull request.

Interactive build workflow

For building a ROS distro it is recommended to use the high-level interactive.yaml workflow. This manually triggered workflow builds all packages from the given source(s) and provides the resulting .debs as an artifact. Optionally, the .debs can be deployed to a github repo. However, using github for this purpose is not recommended (slow and size limitations). Better use a dedicated repository server like aptly or reprepro. The reprepro-import.sh script helps with the latter.

What to build?

ROS_SOURCES specifies a (space-separated) list of inputs. Usually these should be .repos or .rosinstall files suitable for vcs import. However, an URL pointing to a release .tar.gz or a github repository is also supported. In the latter case, use the following scheme: github:organization/repo#version. Other URLs are interpreted as inputs for vcs import.

A subset of packages can be selected via colcon package selection options specified in COLCON_PKG_SELECTION. For example:

  • To rebuild a specific package and all its downstream dependencies:
    --packages-above-and-dependencies <pkg ...>
  • To rebuild a single package (only use if ABI/API hasn't changed):
    --packages-select <pkg ...>

Where to start building from?

Building a complete ROS distro from scratch takes a lot of time, often more than the 6 hours allowed by default GHA runners. For this reason, it is possible to continue a build either from a previous build (downloading an existing debs artifact) or from an existing repository. For the former, set the input DOWNLOAD_DEBS=true, for the latter add the deploy repository to EXTRA_DEB_SOURCES. Note that this variable supports shell variable expansion, i.e. you can use $DEB_DISTRO and/or $ROS_DISTRO to generically specify the deploy repository across different builds. In both cases, set the variable/input SKIP_EXISTING=true to actually skip building already existing packages.

In the interactive.yaml workflow, a combination of these options is offered:

  • Tick option Continue from previous build to draw on https://ros.packages.techfak.net (or untick to trigger a clean build from sratch).
  • Tick option Skip already built packages? to skip existing packages (or untick to enforce a rebuild).
  • Simply rerun the workflow to automatically continue building a previous build that was cancelled due to a timeout.

Reusable workflows build.yaml + deploy.yaml

These workflows are intended for reuse by an external repository to build a custom list of ROS packages. The build workflow stores created .debs as an artifact that can be manually downloaded or automatically uploaded to a repository server (via the deploy workflow) subsequently.

A simple usage example looks like this:

jobs:
  build:
    uses: ubi-agni/ros-builder-action/.github/workflows/build.yaml@main
    with:
      ROS_SOURCES: '*.repos'

  deploy:
    needs: build
    if: always()
    uses: ubi-agni/ros-builder-action/.github/workflows/deploy.yaml@main
    with:
      DEPLOY_URL: ${{ vars.DEPLOY_URL || 'self' }}
      TOKEN: ${{ secrets.GITHUB_TOKEN }}                  # used for own repo
      SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_PRIVATE_KEY }}  # used for other repo

More complex usage examples can be found in interactive.yaml or splitted.yaml.

Environment variables

The build process is controlled by several environment variables. Usually, those environment variables are inititialized from inputs, repository variables, or the given default value - in that order.

variable type default semantics
ROS_DISTRO string one ROS distribution codename to compile for
DEB_DISTRO string jammy The Debian/Ubuntu distribution codename to compile for.
ROS_SOURCES string *.repos ROS sources to compile
COLCON_PKG_SELECTION string colcon package selectio argument(s)
Workflow control
SKIP_EXISTING boolean false Skip (re)building packages already existing in the repository
DOWNLOAD_DEBS boolean false Continue building from previous debs artifact?
BUILD_TIMEOUT number 340 Cancel build after this time, before github will do (minutes)
CONTINUE_ON_ERROR boolean false Continue building even if some packages already failed
Package source options
EXTRA_DEB_SOURCES string Extra debian sources to use in host and sbuild chroot
INSTALL_GPG_KEYS string code to run for installing GPG keys (for use with EXTRA_DEB_SOURCES)
EXTRA_ROSDEP_SOURCES string path to a rosdep-compatible yaml file specifying custom dependency mappings
Package source options
EXTRA_SBUILD_CONFIG string lines to add to ~/.sbuildrc
EXTRA_SBUILD_OPTS string options to pass to sbuild on commandline
DEB_BUILD_OPTIONS string nocheck options used debian/rules
Deployment variables
DEBS_PATH string ~/debs path to store generated .debs in
DEPLOY_URL string repository URL for deployment
DEPLOY_FILES string deb list of file types to deploy: deb, ddeb, dsc, changes
DEPLOY_FILE_SIZE_LIMIT string size limit for files (100M on github)
TOKEN secret secrets.GITHUB_TOKEN github token for pushing to own repo
SSH_PRIVATE_KEY secret ssh private key for pushing to an external repo
Debugging options
VERBOSE string verboseness for all (value true) or selected steps (bloom sbuild apt ccache)
TRACE boolean false Enable function tracing
DEBUG_BASH boolean false Enable bash debugging (set -x) and tracing

Where to deploy?

The built packages can be deployed to a flat Debian repository, for example on a github branch. The easiest way to do so is to specify DEPLOY_URL=self, causing deployment to the active github repository into the branch $DEB_DISTRO-$ROS-DISTRO. However, you can also specify another github repo.

ros-builder-action's People

Contributors

rhaschke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

lcas

ros-builder-action's Issues

Further improvements

Speed

  • Use eatmydata?
  • Use layered chroot: base (ro) - populated (rw) - sbuild (volatile)
    This will allow to enable populated as default and fallback to base on failure automatically.
    For example, gazebo requiring ogre 9.0 conflicts with rviz using ogre 12.x
  • Skip a package if its dependencies are not available
  • Replace vcs --shallow with partial clone

TODO

Features

  • Implement CONTENT_MODE=newer: only keep newest package files
  • Allow selection of (additional) files to deploy: DEPLOY_FILES=".dsc *.ddeb changes"
  • Maintain the database of actually build sources (with commit sha) in a sources.repos file on the deploy repository.
    • Optionally? use that version when rebuilding downstream packages in the repo
    • python helper to add, query, etc that database.
  • Merge remote.yaml and local.yaml into ros-$ROS_DISTRO.yaml?
  • Create docker image for use in CI builds (e.g. MoveIt, MTC)
  • Deploy to reprepro
  • Support rosdistro package index for ROS_SOURCES
    This should allow building existing ROS distros on custom debian distros

Ideas for further improvement

Speed

Features

  • Use repository variables
    • This allows to quickly change the config of a workflow w/o inputs or commits
    • Make inputs optional and retrieve defaults from those (repo) environment variables
    • We cannot easily pass a callers environment to the callee:

      To reuse variables in multiple workflows, set them at the organization, repository, or environment levels and reference them using the vars context.
      Any environment variables set in an env context defined at the workflow level in the caller workflow are not propagated to the called workflow.
      For more information see "Variables" and "Contexts."

TODO

  • Restore ici_step semantics: steps call unique functions and allow for a BEFORE_* and AFTER_* hook.
  • Make deploy a reusable workflow

Fix ici_filter

ici_filter should filter stdout for a given string. However, on error, the full output should be shown.
While the original implementation of industrial_ci realizes the former, the latter fails.

My implementation (8c72e0f) works locally but fails on GHA (showing everything all the time, not filtering at all). For this reason I reverted to the original ici implementation (02ff659) for now. Need to further debug...

Maybe GHA redirects stdout + stderr of the main process?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.