Skip to content

Commit 01cb7f5

Browse files
committed
Merge remote-tracking branch 'origin/main' into worker_with_timers
Signed-off-by: Michael X. Grey <[email protected]>
2 parents 421784b + e61d81b commit 01cb7f5

File tree

81 files changed

+44461
-1390
lines changed

Some content is hidden

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

81 files changed

+44461
-1390
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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@v4
48+
49+
- name: Setup ROS environment
50+
uses: ros-tooling/[email protected]
51+
with:
52+
required-ros-distributions: ${{ matrix.ros_distribution }}
53+
use-ros2-testing: ${{ matrix.ros_distribution == 'rolling' }}
54+
55+
- name: Setup Rust
56+
uses: dtolnay/[email protected]
57+
with:
58+
components: clippy, rustfmt
59+
60+
- name: Install cargo binstall
61+
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
62+
63+
- name: Install bindgen
64+
run: cargo binstall -y bindgen-cli
65+
66+
- name: Generate bindings
67+
run: |
68+
cd rclrs/src
69+
../generate_bindings.py rcl_wrapper.h ${{ matrix.ros_distribution }} .
70+
71+
- name: Submit PR
72+
run: |
73+
if git diff --exit-code; then
74+
exit 0
75+
fi
76+
git config --global user.email "[email protected]"
77+
git config --global user.name "GitHub Action"
78+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
79+
git remote update origin
80+
CREATE_PR=0
81+
if !git checkout update-bindings-${{ matrix.ros_distribution }}; then
82+
CREATE_PR=1
83+
git checkout -b update-bindings-${{ matrix.ros_distribution }}
84+
fi
85+
git add rclrs/src/rcl_bindings_generated_${{ matrix.ros_distribution }}.rs
86+
git commit -m "Regenerate bindings for ${{ matrix.ros_distribution }}"
87+
git push -u origin update-bindings-${{ matrix.ros_distribution }}
88+
if [ $CREATE_PR -eq 1 ]; then
89+
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 }}."
90+
fi
91+
env:
92+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
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)