-
Notifications
You must be signed in to change notification settings - Fork 170
fix: added generated bindings for ROS Humble, Jazzy, Kilted and Rolling #512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
50568a9
8b1ff4c
00990b7
bc68c4e
9da03ea
f0b3ee1
dd42d09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: Generate bindings | ||
|
||
on: | ||
schedule: | ||
# Run the CI at 02:22 UTC every Tuesday | ||
# 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: '22 2 * * 2' | ||
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@v4 | ||
|
||
- 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 | ||
|
||
- name: Generate bindings | ||
run: | | ||
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 }} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There seems to be a fair amount being removed from the build script. Is this functionality no longer needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've removed the code that generates the bindings from the |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env python3 | ||
import ament_index_python | ||
import os | ||
import subprocess | ||
import sys | ||
|
||
def main(): | ||
if len(sys.argv) != 4: | ||
print("Usage: generate_bindings.py <header_file> <ros_distribution> <output_directory>") | ||
sys.exit(1) | ||
|
||
header_file = sys.argv[1] | ||
ros_distribution = sys.argv[2] | ||
output_directory = sys.argv[3] | ||
bindgen_command = [] | ||
bindgen_command.append('bindgen') | ||
bindgen_command.append(header_file) | ||
bindgen_command.append('-o') | ||
bindgen_command.append(f'{output_directory}/rcl_bindings_generated_{ros_distribution}.rs') | ||
bindgen_command.append('--rust-edition') | ||
bindgen_command.append('2021') | ||
bindgen_command.append('--rust-target') | ||
bindgen_command.append('1.75') | ||
bindgen_command.append('--no-derive-copy') | ||
bindgen_command.append('--allowlist-type') | ||
bindgen_command.append('rcl_.*') | ||
bindgen_command.append('--allowlist-type') | ||
bindgen_command.append('rmw_.*') | ||
bindgen_command.append('--allowlist-type') | ||
bindgen_command.append('rcutils_.*') | ||
bindgen_command.append('--allowlist-type') | ||
bindgen_command.append('rosidl_.*') | ||
bindgen_command.append('--allowlist-function') | ||
bindgen_command.append('rcl_.*') | ||
bindgen_command.append('--allowlist-function') | ||
bindgen_command.append('rmw_.*') | ||
bindgen_command.append('--allowlist-function') | ||
bindgen_command.append('rcutils_.*') | ||
bindgen_command.append('--allowlist-function') | ||
bindgen_command.append('rosidl_.*') | ||
bindgen_command.append('--allowlist-var') | ||
bindgen_command.append('rcl_.*') | ||
bindgen_command.append('--allowlist-var') | ||
bindgen_command.append('rmw_.*') | ||
bindgen_command.append('--allowlist-var') | ||
bindgen_command.append('rcutils_.*') | ||
bindgen_command.append('--allowlist-var') | ||
bindgen_command.append('rosidl_.*') | ||
bindgen_command.append('--no-layout-tests') | ||
bindgen_command.append('--default-enum-style') | ||
bindgen_command.append('rust') | ||
bindgen_command.append('--') | ||
for package, prefix in ament_index_python.get_packages_with_prefixes().items(): | ||
package_include_dir = os.path.join(prefix, 'include', package) | ||
if os.path.isdir(package_include_dir): | ||
bindgen_command.append('-isystem') | ||
bindgen_command.append(package_include_dir) | ||
subprocess.run(bindgen_command) | ||
|
||
if __name__ == "__main__": | ||
main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description says this will run daily, but this looks like it's actually weekly. Is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I've submitted #515 to fix that