Skip to content

Commit 3605b7a

Browse files
committed
Update with main
Signed-off-by: Michael X. Grey <[email protected]>
2 parents 8420bea + bf861a6 commit 3605b7a

File tree

82 files changed

+44550
-1436
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+44550
-1436
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Generate bindings
2+
3+
on:
4+
schedule:
5+
# Run the CI at 00:11 UTC every night
6+
# We pick an arbitrary time outside of most of the world's work hours
7+
# to minimize the likelihood of running alongside a heavy workload.
8+
- cron: '11 0 * * *'
9+
workflow_dispatch:
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
build:
16+
strategy:
17+
matrix:
18+
ros_distribution:
19+
- humble
20+
- jazzy
21+
- kilted
22+
- rolling
23+
include:
24+
# Humble Hawksbill (May 2022 - May 2027)
25+
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest
26+
ros_distribution: humble
27+
ros_version: 2
28+
# Jazzy Jalisco (May 2024 - May 2029)
29+
- docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-jazzy-ros-base-latest
30+
ros_distribution: jazzy
31+
ros_version: 2
32+
# Kilted Kaiju (May 2025 - Dec 2026)
33+
- docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-kilted-ros-base-latest
34+
ros_distribution: kilted
35+
ros_version: 2
36+
# Rolling Ridley (June 2020 - Present)
37+
- docker_image: rostooling/setup-ros-docker:ubuntu-noble-ros-rolling-ros-base-latest
38+
ros_distribution: rolling
39+
ros_version: 2
40+
runs-on: ubuntu-latest
41+
permissions:
42+
contents: write
43+
pull-requests: write
44+
container:
45+
image: ${{ matrix.docker_image }}
46+
steps:
47+
- uses: actions/checkout@v5
48+
with:
49+
fetch-depth: 0
50+
51+
- name: Setup ROS environment
52+
uses: ros-tooling/[email protected]
53+
with:
54+
required-ros-distributions: ${{ matrix.ros_distribution }}
55+
use-ros2-testing: ${{ matrix.ros_distribution == 'rolling' }}
56+
57+
- name: Setup Rust
58+
uses: dtolnay/[email protected]
59+
with:
60+
components: clippy, rustfmt
61+
62+
- name: Install cargo binstall
63+
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
64+
65+
- name: Install bindgen
66+
run: cargo binstall -y bindgen-cli
67+
68+
- name: Install GitHub CLI tool
69+
run: |
70+
(type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
71+
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
72+
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
73+
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
74+
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
75+
&& sudo mkdir -p -m 755 /etc/apt/sources.list.d \
76+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
77+
&& sudo apt update \
78+
&& sudo apt install gh -y
79+
80+
- name: Generate bindings
81+
run: |
82+
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh
83+
cd rclrs/src
84+
../generate_bindings.py rcl_wrapper.h ${{ matrix.ros_distribution }} .
85+
86+
- name: Submit PR
87+
run: |
88+
cd $GITHUB_WORKSPACE
89+
git config --global --add safe.directory $GITHUB_WORKSPACE
90+
if git diff --exit-code; then
91+
exit 0
92+
fi
93+
git config --global user.email "[email protected]"
94+
git config --global user.name "GitHub Action"
95+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
96+
git remote update origin
97+
CREATE_PR=0
98+
if ! git checkout update-bindings-${{ matrix.ros_distribution }}; then
99+
CREATE_PR=1
100+
git checkout -b update-bindings-${{ matrix.ros_distribution }}
101+
fi
102+
git add rclrs/src/rcl_bindings_generated_${{ matrix.ros_distribution }}.rs
103+
git commit -m "Regenerate bindings for ${{ matrix.ros_distribution }}"
104+
git push -u origin update-bindings-${{ matrix.ros_distribution }}
105+
if [ $CREATE_PR -eq 1 ]; then
106+
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 }}."
107+
fi
108+
env:
109+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-plz.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Release-plz
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
RUSTFLAGS: "--cfg ros_distro=\"humble\""
10+
11+
jobs:
12+
release-plz-release:
13+
name: Release-plz release
14+
runs-on: ubuntu-latest
15+
if: ${{ github.repository_owner == 'ros2-rust' }}
16+
permissions:
17+
contents: write
18+
steps:
19+
# Generating a GitHub token, so that PRs and tags created by
20+
# the release-plz-action can trigger actions workflows.
21+
- name: Generate GitHub token
22+
uses: actions/create-github-app-token@v2
23+
id: generate-token
24+
with:
25+
# GitHub App ID secret name
26+
app-id: ${{ secrets.APP_ID }}
27+
# GitHub App private key secret name
28+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
token: ${{ steps.generate-token.outputs.token }}
34+
- name: Install Rust toolchain
35+
uses: dtolnay/rust-toolchain@stable
36+
- name: Run release-plz
37+
uses: release-plz/[email protected]
38+
with:
39+
command: release
40+
env:
41+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
42+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
43+
44+
release-plz-pr:
45+
name: Release-plz PR
46+
runs-on: ubuntu-latest
47+
if: ${{ github.repository_owner == 'ros2-rust' }}
48+
permissions:
49+
pull-requests: write
50+
contents: write
51+
concurrency:
52+
group: release-plz-${{ github.ref }}
53+
cancel-in-progress: false
54+
steps:
55+
# Generating a GitHub token, so that PRs and tags created by
56+
# the release-plz-action can trigger actions workflows.
57+
- name: Generate GitHub token
58+
uses: actions/create-github-app-token@v2
59+
id: generate-token
60+
with:
61+
# GitHub App ID secret name
62+
app-id: ${{ secrets.APP_ID }}
63+
# GitHub App private key secret name
64+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
65+
- name: Checkout repository
66+
uses: actions/checkout@v4
67+
with:
68+
fetch-depth: 0
69+
token: ${{ steps.generate-token.outputs.token }}
70+
- name: Install Rust toolchain
71+
uses: dtolnay/rust-toolchain@stable
72+
- name: Run release-plz
73+
uses: release-plz/[email protected]
74+
with:
75+
command: release-pr
76+
env:
77+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
78+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[workspace]
2+
members = [
3+
"rclrs",
4+
]
5+
resolver = "2"

Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@ RUN apt-get update && apt-get install -y \
1515
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.75.0 -y
1616
ENV PATH=/root/.cargo/bin:$PATH
1717

18-
# Install the colcon-cargo and colcon-ros-cargo plugins
19-
RUN if [ "$ROS_DISTRO" = "humble" ] ; \
20-
then pip install --upgrade pytest && pip install colcon-ros-cargo ; \
21-
else pip install --break-system-packages pytest colcon-ros-cargo ; fi
18+
COPY src/ros2_rust/docker/install_colcon_plugins.sh /
19+
RUN ./install_colcon_plugins.sh
20+
21+
COPY src/ros2_rust/docker/rosidl_rust_setup.sh /
22+
RUN ./rosidl_rust_setup.sh
2223

2324
RUN mkdir -p /workspace && echo "Did you forget to mount the repository into the Docker container?" > /workspace/HELLO.txt
2425
WORKDIR /workspace
26+
27+
COPY src/ros2_rust/docker/rosidl_rust_entrypoint.sh /
28+
ENTRYPOINT ["/rosidl_rust_entrypoint.sh"]
29+
CMD ["/bin/bash"]

docker/install_colcon_plugins.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
if [ "$ROS_DISTRO" = "humble" ]; then
4+
pip install --upgrade pytest
5+
pip install \
6+
git+https://github.com/colcon/colcon-cargo.git \
7+
git+https://github.com/colcon/colcon-ros-cargo.git
8+
else
9+
pip install --break-system-packages pytest \
10+
git+https://github.com/colcon/colcon-cargo.git \
11+
git+https://github.com/colcon/colcon-ros-cargo.git
12+
fi

docker/rosidl_rust_entrypoint.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# setup ros2 environment
5+
source "/opt/ros/$ROS_DISTRO/setup.bash" --
6+
7+
# If we're a distro that needs the overlay built, then source it
8+
if [ -f "/tmp/rosidl_rust_overlay/install/setup.bash" ]; then
9+
source /tmp/rosidl_rust_overlay/install/setup.bash --
10+
fi
11+
12+
exec "$@"

docker/rosidl_rust_setup.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# Depending on the ROS_DISTRO, make sure we've got rosidl_generator_rs
4+
# sourced and available in working directory workspace
5+
6+
if [ "$ROS_DISTRO" = "rolling" ]; then
7+
apt-get update && apt-get install -y ros-$ROS_DISTRO-rosidl-generator-rs
8+
else
9+
# Temporarily add `rosidl_rust` to an overlay, build, and source it.
10+
mkdir -p /tmp/rosidl_rust_overlay/src
11+
git clone https://github.com/ros2-rust/rosidl_rust /tmp/rosidl_rust_overlay/src
12+
13+
cd /tmp/rosidl_rust_overlay
14+
15+
. /opt/ros/$ROS_DISTRO/setup.sh
16+
colcon build
17+
fi

examples/logging_demo/Cargo.toml

Lines changed: 0 additions & 8 deletions
This file was deleted.

examples/logging_demo/package.xml

Lines changed: 0 additions & 21 deletions
This file was deleted.

examples/logging_demo/src/main.rs

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)