Skip to content

Commit 9263652

Browse files
Merge branch 'main' into dynamic_messages
Signed-off-by: Luca Della Vedova <[email protected]>
2 parents 2936a40 + d62583d commit 9263652

File tree

169 files changed

+19073
-5932
lines changed

Some content is hidden

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

169 files changed

+19073
-5932
lines changed

.dockerignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
# will have compiled files and executables
1515
/target/
1616

17-
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
18-
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
19-
Cargo.lock
20-
2117
# These are backup files generated by rustfmt
2218
**/*.rs.bk
2319

.github/workflows/rust.yml renamed to .github/workflows/rust-minimal.yml

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
name: Rust
1+
name: Rust Minimal
22

33
on:
44
push:
55
branches: [ main ]
66
pull_request:
77
branches: [ main ]
8+
schedule:
9+
# Run the CI at 02:22 UTC every Tuesday
10+
# We pick an arbitrary time outside of most of the world's work hours
11+
# to minimize the likelihood of running alongside a heavy workload.
12+
- cron: '22 2 * * 2'
813

914
env:
1015
CARGO_TERM_COLOR: always
@@ -14,19 +19,9 @@ jobs:
1419
strategy:
1520
matrix:
1621
ros_distribution:
17-
- foxy
18-
- galactic
1922
- humble
2023
- rolling
2124
include:
22-
# Foxy Fitzroy (June 2020 - May 2023)
23-
- docker_image: rostooling/setup-ros-docker:ubuntu-focal-ros-foxy-ros-base-latest
24-
ros_distribution: foxy
25-
ros_version: 2
26-
# Galactic Geochelone (May 2021 - November 2022)
27-
- docker_image: rostooling/setup-ros-docker:ubuntu-focal-ros-galactic-ros-base-latest
28-
ros_distribution: galactic
29-
ros_version: 2
3025
# Humble Hawksbill (May 2022 - May 2027)
3126
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest
3227
ros_distribution: humble
@@ -36,23 +31,29 @@ jobs:
3631
ros_distribution: rolling
3732
ros_version: 2
3833
runs-on: ubuntu-latest
34+
continue-on-error: ${{ matrix.ros_distribution == 'rolling' }}
3935
container:
4036
image: ${{ matrix.docker_image }}
4137
steps:
42-
- uses: actions/checkout@v2
38+
- uses: actions/checkout@v4
4339

4440
- name: Search packages in this repository
4541
id: list_packages
4642
run: |
47-
echo ::set-output name=package_list::$(colcon list --names-only)
43+
{
44+
echo 'package_list<<EOF'
45+
colcon list --names-only
46+
echo EOF
47+
} >> "$GITHUB_OUTPUT"
4848
4949
- name: Setup ROS environment
50-
uses: ros-tooling/setup-ros@v0.3
50+
uses: ros-tooling/setup-ros@v0.7
5151
with:
5252
required-ros-distributions: ${{ matrix.ros_distribution }}
53+
use-ros2-testing: ${{ matrix.ros_distribution == 'rolling' }}
5354

5455
- name: Setup Rust
55-
uses: dtolnay/rust-toolchain@1.63.0
56+
uses: dtolnay/rust-toolchain@1.75
5657
with:
5758
components: clippy, rustfmt
5859

@@ -65,17 +66,14 @@ jobs:
6566
run: |
6667
for path in $(colcon list | awk '$3 == "(ament_cargo)" { print $2 }'); do
6768
cd $path
68-
cargo fmt -- --check
69+
rustup toolchain install nightly
70+
cargo +nightly fmt -- --check
6971
cd -
7072
done
7173
72-
- name: Install cargo-ament-build
73-
run: |
74-
cargo install --debug cargo-ament-build
75-
7674
- name: Build and test
7775
id: build
78-
uses: ros-tooling/action-ros-ci@v0.2
76+
uses: ros-tooling/action-ros-ci@v0.3
7977
with:
8078
package-name: ${{ steps.list_packages.outputs.package_list }}
8179
target-ros2-distro: ${{ matrix.ros_distribution }}
@@ -88,26 +86,38 @@ jobs:
8886
for path in $(colcon list | awk '$3 == "(ament_cargo)" { print $2 }'); do
8987
cd $path
9088
echo "Running clippy in $path"
91-
cargo clippy --all-targets --all-features -- -D warnings
89+
# Run clippy for all features except generate_docs (needed for docs.rs)
90+
if [ "$(basename $path)" = "rclrs" ]; then
91+
cargo clippy --no-deps --all-targets -F default,dyn_msg -- -D warnings
92+
else
93+
cargo clippy --no-deps --all-targets --all-features -- -D warnings
94+
fi
9295
cd -
9396
done
9497
9598
- name: Run cargo test on Rust packages
9699
run: |
97100
cd ${{ steps.build.outputs.ros-workspace-directory-name }}
98101
. install/setup.sh
99-
for path in $(colcon list | awk '$3 == "(ament_cargo)" && $1 != "examples_rclrs_minimal_pub_sub" && $1 != "examples_rclrs_minimal_client_service" { print $2 }'); do
102+
for path in $(colcon list | awk '$3 == "(ament_cargo)" && $1 != "examples_rclrs_minimal_pub_sub" && $1 != "examples_rclrs_minimal_client_service" && $1 != "rust_pubsub" { print $2 }'); do
100103
cd $path
101104
echo "Running cargo test in $path"
102-
cargo test --all-features
105+
# Run cargo test for all features except generate_docs (needed for docs.rs)
106+
if [ "$(basename $path)" = "rclrs" ]; then
107+
cargo test -F default,dyn_msg
108+
elif [ "$(basename $path)" = "rosidl_runtime_rs" ]; then
109+
cargo test -F default
110+
else
111+
cargo test --all-features
112+
fi
103113
cd -
104114
done
105115
106116
- name: Rustdoc check
107117
run: |
108118
cd ${{ steps.build.outputs.ros-workspace-directory-name }}
109119
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh
110-
for path in $(colcon list | awk '$3 == "(ament_cargo)" && $1 != "examples_rclrs_minimal_pub_sub" && $1 != "examples_rclrs_minimal_client_service" { print $2 }'); do
120+
for path in $(colcon list | awk '$3 == "(ament_cargo)" && $1 != "examples_rclrs_minimal_pub_sub" && $1 != "examples_rclrs_minimal_client_service" && $1 != "rust_pubsub" { print $2 }'); do
111121
cd $path
112122
echo "Running rustdoc check in $path"
113123
cargo rustdoc -- -D warnings

.github/workflows/rust-stable.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Rust Stable
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
# Run the CI at 02:22 UTC every Tuesday
10+
# We pick an arbitrary time outside of most of the world's work hours
11+
# to minimize the likelihood of running alongside a heavy workload.
12+
- cron: '22 2 * * 2'
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
17+
jobs:
18+
build:
19+
strategy:
20+
matrix:
21+
ros_distribution:
22+
- humble
23+
- rolling
24+
include:
25+
# Humble Hawksbill (May 2022 - May 2027)
26+
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest
27+
ros_distribution: humble
28+
ros_version: 2
29+
# Rolling Ridley (June 2020 - Present)
30+
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-rolling-ros-base-latest
31+
ros_distribution: rolling
32+
ros_version: 2
33+
runs-on: ubuntu-latest
34+
continue-on-error: ${{ matrix.ros_distribution == 'rolling' }}
35+
container:
36+
image: ${{ matrix.docker_image }}
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Search packages in this repository
41+
id: list_packages
42+
run: |
43+
{
44+
echo 'package_list<<EOF'
45+
colcon list --names-only
46+
echo EOF
47+
} >> "$GITHUB_OUTPUT"
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/rust-toolchain@stable
57+
with:
58+
components: clippy, rustfmt
59+
60+
- name: Install colcon-cargo and colcon-ros-cargo
61+
run: |
62+
sudo pip3 install git+https://github.com/colcon/colcon-cargo.git
63+
sudo pip3 install git+https://github.com/colcon/colcon-ros-cargo.git
64+
65+
- name: Check formatting of Rust packages
66+
run: |
67+
for path in $(colcon list | awk '$3 == "(ament_cargo)" { print $2 }'); do
68+
cd $path
69+
rustup toolchain install nightly
70+
cargo +nightly fmt -- --check
71+
cd -
72+
done
73+
74+
- name: Build and test
75+
id: build
76+
uses: ros-tooling/[email protected]
77+
with:
78+
package-name: ${{ steps.list_packages.outputs.package_list }}
79+
target-ros2-distro: ${{ matrix.ros_distribution }}
80+
vcs-repo-file-url: ros2_rust_${{ matrix.ros_distribution }}.repos
81+
82+
- name: Run clippy on Rust packages
83+
run: |
84+
cd ${{ steps.build.outputs.ros-workspace-directory-name }}
85+
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh
86+
for path in $(colcon list | awk '$3 == "(ament_cargo)" { print $2 }'); do
87+
cd $path
88+
echo "Running clippy in $path"
89+
# Run clippy for all features except generate_docs (needed for docs.rs)
90+
if [ "$(basename $path)" = "rclrs" ]; then
91+
cargo clippy --no-deps --all-targets -F default,dyn_msg -- -D warnings
92+
else
93+
cargo clippy --no-deps --all-targets --all-features -- -D warnings
94+
fi
95+
cd -
96+
done
97+
98+
- name: Run cargo test on Rust packages
99+
run: |
100+
cd ${{ steps.build.outputs.ros-workspace-directory-name }}
101+
. install/setup.sh
102+
for path in $(colcon list | awk '$3 == "(ament_cargo)" && $1 != "examples_rclrs_minimal_pub_sub" && $1 != "examples_rclrs_minimal_client_service" && $1 != "rust_pubsub" { print $2 }'); do
103+
cd $path
104+
echo "Running cargo test in $path"
105+
# Run cargo test for all features except generate_docs (needed for docs.rs)
106+
if [ "$(basename $path)" = "rclrs" ]; then
107+
cargo test -F default,dyn_msg
108+
elif [ "$(basename $path)" = "rosidl_runtime_rs" ]; then
109+
cargo test -F default
110+
else
111+
cargo test --all-features
112+
fi
113+
cd -
114+
done
115+
116+
- name: Rustdoc check
117+
run: |
118+
cd ${{ steps.build.outputs.ros-workspace-directory-name }}
119+
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh
120+
for path in $(colcon list | awk '$3 == "(ament_cargo)" && $1 != "examples_rclrs_minimal_pub_sub" && $1 != "examples_rclrs_minimal_client_service" && $1 != "rust_pubsub" { print $2 }'); do
121+
cd $path
122+
echo "Running rustdoc check in $path"
123+
cargo rustdoc -- -D warnings
124+
cd -
125+
done

.github/workflows/rust-win.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Rust ROS 2 Windows build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
# Run the CI at 02:22 UTC every Tuesday
10+
# We pick an arbitrary time outside of most of the world's work hours
11+
# to minimize the likelihood of running alongside a heavy workload.
12+
- cron: '22 2 * * 2'
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
17+
jobs:
18+
build:
19+
runs-on: windows-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: ilammy/[email protected]
24+
25+
- name: Make new directories and copy ros2_rust repo
26+
run: |
27+
mkdir C:\workspace\src
28+
mkdir C:\pixi_ws
29+
xcopy /E /I /Y D:\a\ros2_rust\ros2_rust C:\workspace\src\ros2_rust
30+
31+
- name: Get pixi toml file
32+
run: irm https://raw.githubusercontent.com/ros2/ros2/refs/heads/rolling/pixi.toml -OutFile C:\pixi_ws\pixi.toml
33+
34+
- name: Setup Pixi environment woth ROS2 toml file
35+
uses: prefix-dev/[email protected]
36+
with:
37+
manifest-path: C:/pixi_ws/pixi.toml
38+
39+
- name: Get prebuild ROS files and unzip
40+
run: |
41+
irm https://ci.ros2.org/view/packaging/job/packaging_windows/lastSuccessfulBuild/artifact/ws/ros2-package-windows-AMD64.zip -Outfile ros2-package-windows-AMD64.zip
42+
Expand-Archive -Path ros2-package-windows-AMD64.zip -DestinationPath C:/pixi_ws/
43+
44+
- name: Install ros2_rust prerequisites
45+
# prerequisites and fixes for windows build ros2_rust:
46+
# * Libclang has to be added (from the ros2_rust instructions) and the dll has to be renamed
47+
# * colcon-ros-cargo and colcon-cargo have to be added as PyPI packages
48+
run: |
49+
pixi add libclang --manifest-path C:\pixi_ws\pixi.toml
50+
$src = "C:\pixi_ws\.pixi\envs\default\Library\bin\libclang-13.dll"
51+
$dst = "C:\pixi_ws\.pixi\envs\default\Library\bin\libclang.dll"
52+
if (Test-Path $src) { Rename-Item -Path $src -NewName "libclang.dll" }
53+
pixi add --pypi "colcon-ros-cargo@git+https://github.com/colcon/colcon-ros-cargo.git" --manifest-path C:\pixi_ws\pixi.toml
54+
pixi add --pypi "colcon-cargo@git+https://github.com/colcon/colcon-cargo.git" --manifest-path C:\pixi_ws\pixi.toml
55+
56+
- name: Build the rust package
57+
env:
58+
LIBCLANG_PATH: C:\pixi_ws\.pixi\envs\default\Library\bin # See https://github.com/ros2-rust/ros2_rust?tab=readme-ov-file#sounds-great-how-can-i-try-this-out
59+
BINDGEN_EXTRA_CLANG_ARGS: -D_Check_return_= # to handle the clang error with the windows specific bindgen error
60+
run: |
61+
call C:\pixi_ws\ros2-windows\setup.bat
62+
pixi run --manifest-path C:\pixi_ws\pixi.toml vcs import C:/workspace/src --input C:/workspace/src/ros2_rust/ros2_rust_rolling.repos
63+
pixi run --manifest-path C:\pixi_ws\pixi.toml colcon build
64+
working-directory: C:/workspace
65+
shell: cmd
66+
67+
- name: Run cargo test on Rust packages
68+
run: |
69+
call C:\pixi_ws\ros2-windows\setup.bat
70+
cd C:\workspace
71+
for /f "tokens=1,2,3" %%A in ('pixi run --manifest-path C:\pixi_ws\pixi.toml colcon list') do (
72+
if "%%C"=="(ament_cargo)" (
73+
if /I not "%%A"=="examples_rclrs_minimal_pub_sub" if /I not "%%A"=="examples_rclrs_minimal_client_service" if /I not "%%A"=="rust_pubsub" (
74+
cd %%B
75+
echo Running cargo test in %%B
76+
if /I "%%~nxB"=="rclrs" (
77+
cargo test -F default,dyn_msg
78+
) else if /I "%%~nxB"=="rosidl_runtime_rs" (
79+
cargo test -F default
80+
) else (
81+
cargo test --all-features
82+
)
83+
cd ..
84+
)
85+
)
86+
)
87+
shell: cmd
88+
working-directory: C:\workspace

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,6 @@ dmypy.json
215215
# will have compiled files and executables
216216
/target/
217217

218-
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
219-
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
220-
Cargo.lock
221-
222218
# These are backup files generated by rustfmt
223219
**/*.rs.bk
224220

.rustfmt.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This requires the nightly release of Rust, so when formating the repo, use
2+
# $ cargo +nightly fmt
3+
imports_granularity = "Crate"

0 commit comments

Comments
 (0)