colcon build workflow (linorobot/linorobot2)
The colcon build workflow from linorobot/linorobot2, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the colcon build workflow from the linorobot/linorobot2 repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: colcon build
on:
schedule:
- cron: '0 0 * * 5' # Every Friday at midnight UTC
push:
branches: [ jazzy ]
pull_request:
branches: [ jazzy ] # Adjust this if your default branch is different
jobs:
build:
runs-on: ubuntu-24.04
strategy:
matrix:
base_image: [hardware, gazebo, gazebo-cuda]
steps:
- uses: actions/checkout@v4
- name: Create fake udev directory for hardware builds
run: |
sudo mkdir -p /etc/udev/rules.d
bash install.bash --laser ld19 --udev-only
cat /etc/udev/rules.d/ldlidar.rules
- name: Install and Build ROS2 environment - ${{ matrix.base_image }}
run: |
export ROS_DISTRO=jazzy
export ROBOT_BASE=2wd
export LASER_SENSOR=ld19
export BASE_IMAGE=${{ matrix.base_image }}
cd docker && docker compose build
shell: bash
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: colcon build on: schedule: - cron: '0 0 * * 5' # Every Friday at midnight UTC push: branches: [ jazzy ] pull_request: branches: [ jazzy ] # Adjust this if your default branch is different concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: timeout-minutes: 30 runs-on: latchkey-small strategy: matrix: base_image: [hardware, gazebo, gazebo-cuda] steps: - uses: actions/checkout@v4 - name: Create fake udev directory for hardware builds run: | sudo mkdir -p /etc/udev/rules.d bash install.bash --laser ld19 --udev-only cat /etc/udev/rules.d/ldlidar.rules - name: Install and Build ROS2 environment - ${{ matrix.base_image }} run: | export ROS_DISTRO=jazzy export ROBOT_BASE=2wd export LASER_SENSOR=ld19 export BASE_IMAGE=${{ matrix.base_image }} cd docker && docker compose build shell: bash
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job (3 with the matrix expanded) per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.