Skip to content

Generate bindings

Generate bindings #16

name: Generate bindings
on:
schedule:
# Run the CI at 00:11 UTC every night
# We pick an arbitrary time outside of most of the world's work hours
# to minimize the likelihood of running alongside a heavy workload.
- cron: '11 0 * * *'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
ros_distribution:
- humble
- jazzy
- kilted
- rolling
include:
# Humble Hawksbill (May 2022 - May 2027)
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest
ros_distribution: humble
ros_version: 2
# Jazzy Jalisco (May 2024 - May 2029)
- docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-jazzy-ros-base-latest
ros_distribution: jazzy
ros_version: 2
# Kilted Kaiju (May 2025 - Dec 2026)
- docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-kilted-ros-base-latest
ros_distribution: kilted
ros_version: 2
# Rolling Ridley (June 2020 - Present)
- docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-rolling-ros-base-latest
ros_distribution: rolling
ros_version: 2
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
container:
image: ${{ matrix.docker_image }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup ROS environment
uses: ros-tooling/[email protected]
with:
required-ros-distributions: ${{ matrix.ros_distribution }}
use-ros2-testing: ${{ matrix.ros_distribution == 'rolling' }}
- name: Setup Rust
uses: dtolnay/[email protected]
with:
components: clippy, rustfmt
- name: Install cargo binstall
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- name: Install bindgen
run: cargo binstall -y bindgen-cli
- name: Generate bindings
run: |
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh
cd rclrs/src
../generate_bindings.py rcl_wrapper.h ${{ matrix.ros_distribution }} .
- name: Submit PR
run: |
if git diff --exit-code; then
exit 0
fi
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git remote update origin
CREATE_PR=0
if ! git checkout update-bindings-${{ matrix.ros_distribution }}; then
CREATE_PR=1
git checkout -b update-bindings-${{ matrix.ros_distribution }}
fi
git add rclrs/src/rcl_bindings_generated_${{ matrix.ros_distribution }}.rs
git commit -m "Regenerate bindings for ${{ matrix.ros_distribution }}"
git push -u origin update-bindings-${{ matrix.ros_distribution }}
if [ $CREATE_PR -eq 1 ]; then
gh pr create --base main --head update-bindings-${{ matrix.ros_distribution }} --title "Regenerate bindings for ${{ matrix.ros_distribution }}" --body "This PR regenerates the bindings for ${{ matrix.ros_distribution }}."
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}