Skip to content

Commit 036b6ab

Browse files
committed
CI
1 parent c8caca3 commit 036b6ab

File tree

5 files changed

+235
-0
lines changed

5 files changed

+235
-0
lines changed

.github/workflows/rust.yml

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build:
14+
strategy:
15+
matrix:
16+
ros_distribution:
17+
- foxy
18+
- galactic
19+
- humble
20+
- rolling
21+
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
30+
# Humble Hawksbill (May 2022 - May 2027)
31+
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest
32+
ros_distribution: humble
33+
ros_version: 2
34+
# Rolling Ridley (June 2020 - Present)
35+
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-rolling-ros-base-latest
36+
ros_distribution: rolling
37+
ros_version: 2
38+
runs-on: ubuntu-latest
39+
container:
40+
image: ${{ matrix.docker_image }}
41+
steps:
42+
- uses: actions/checkout@v2
43+
44+
- name: Search packages in this repository
45+
id: list_packages
46+
run: |
47+
echo ::set-output name=package_list::$(colcon list --names-only)
48+
49+
- name: Setup ROS environment
50+
uses: ros-tooling/[email protected]
51+
with:
52+
required-ros-distributions: ${{ matrix.ros_distribution }}
53+
54+
- name: Setup Rust
55+
uses: dtolnay/[email protected]
56+
with:
57+
components: clippy, rustfmt
58+
59+
- name: Install colcon-cargo and colcon-ros-cargo
60+
run: |
61+
sudo pip3 install git+https://github.com/colcon/colcon-cargo.git
62+
sudo pip3 install git+https://github.com/colcon/colcon-ros-cargo.git
63+
64+
- name: Check formatting of Rust packages
65+
run: |
66+
for path in $(colcon list | awk '$3 == "(ament_cargo)" { print $2 }'); do
67+
cd $path
68+
cargo fmt -- --check
69+
cd -
70+
done
71+
72+
- name: Install cargo-ament-build
73+
run: |
74+
cargo install --debug cargo-ament-build
75+
76+
- name: Build and test
77+
id: build
78+
uses: ros-tooling/[email protected]
79+
with:
80+
package-name: ${{ steps.list_packages.outputs.package_list }}
81+
target-ros2-distro: ${{ matrix.ros_distribution }}
82+
vcs-repo-file-url: ros2_rust_${{ matrix.ros_distribution }}.repos
83+
84+
- name: Run clippy on Rust packages
85+
run: |
86+
cd ${{ steps.build.outputs.ros-workspace-directory-name }}
87+
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh
88+
for path in $(colcon list | awk '$3 == "(ament_cargo)" { print $2 }'); do
89+
cd $path
90+
echo "Running clippy in $path"
91+
cargo clippy --all-targets --all-features -- -D warnings
92+
cd -
93+
done
94+
95+
- name: Run cargo test on Rust packages
96+
run: |
97+
cd ${{ steps.build.outputs.ros-workspace-directory-name }}
98+
. 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
100+
cd $path
101+
echo "Running cargo test in $path"
102+
cargo test --all-features
103+
cd -
104+
done
105+
106+
- name: Rustdoc check
107+
run: |
108+
cd ${{ steps.build.outputs.ros-workspace-directory-name }}
109+
. /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
111+
cd $path
112+
echo "Running rustdoc check in $path"
113+
cargo rustdoc -- -D warnings
114+
cd -
115+
done

ros2_rust_foxy.repos

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
repositories:
2+
ros2/common_interfaces:
3+
type: git
4+
url: https://github.com/ros2/common_interfaces.git
5+
version: foxy
6+
ros2/example_interfaces:
7+
type: git
8+
url: https://github.com/ros2/example_interfaces.git
9+
version: foxy
10+
ros2/rcl_interfaces:
11+
type: git
12+
url: https://github.com/ros2/rcl_interfaces.git
13+
version: foxy
14+
ros2/test_interface_files:
15+
type: git
16+
url: https://github.com/ros2/test_interface_files.git
17+
version: foxy
18+
ros2/rosidl_defaults:
19+
type: git
20+
url: https://github.com/ros2/rosidl_defaults.git
21+
version: foxy
22+
ros2/unique_identifier_msgs:
23+
type: git
24+
url: https://github.com/ros2/unique_identifier_msgs.git
25+
version: foxy
26+
ros2_rust:
27+
type: git
28+
url: https://github.com/ros2-rust/ros2_rust.git
29+
version: main

ros2_rust_galactic.repos

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
repositories:
2+
ros2/common_interfaces:
3+
type: git
4+
url: https://github.com/ros2/common_interfaces.git
5+
version: galactic
6+
ros2/example_interfaces:
7+
type: git
8+
url: https://github.com/ros2/example_interfaces.git
9+
version: galactic
10+
ros2/rcl_interfaces:
11+
type: git
12+
url: https://github.com/ros2/rcl_interfaces.git
13+
version: galactic
14+
ros2/test_interface_files:
15+
type: git
16+
url: https://github.com/ros2/test_interface_files.git
17+
version: galactic
18+
ros2/rosidl_defaults:
19+
type: git
20+
url: https://github.com/ros2/rosidl_defaults.git
21+
version: galactic
22+
ros2/unique_identifier_msgs:
23+
type: git
24+
url: https://github.com/ros2/unique_identifier_msgs.git
25+
version: galactic
26+
ros2_rust:
27+
type: git
28+
url: https://github.com/ros2-rust/ros2_rust.git
29+
version: main

ros2_rust_humble.repos

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
repositories:
2+
ros2/common_interfaces:
3+
type: git
4+
url: https://github.com/ros2/common_interfaces.git
5+
version: humble
6+
ros2/example_interfaces:
7+
type: git
8+
url: https://github.com/ros2/example_interfaces.git
9+
version: humble
10+
ros2/rcl_interfaces:
11+
type: git
12+
url: https://github.com/ros2/rcl_interfaces.git
13+
version: humble
14+
ros2/test_interface_files:
15+
type: git
16+
url: https://github.com/ros2/test_interface_files.git
17+
version: humble
18+
ros2/rosidl_defaults:
19+
type: git
20+
url: https://github.com/ros2/rosidl_defaults.git
21+
version: humble
22+
ros2/unique_identifier_msgs:
23+
type: git
24+
url: https://github.com/ros2/unique_identifier_msgs.git
25+
version: humble
26+
ros2_rust:
27+
type: git
28+
url: https://github.com/ros2-rust/ros2_rust.git
29+
version: main

ros2_rust_rolling.repos

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
repositories:
2+
ros2/common_interfaces:
3+
type: git
4+
url: https://github.com/ros2/common_interfaces.git
5+
version: rolling
6+
ros2/example_interfaces:
7+
type: git
8+
url: https://github.com/ros2/example_interfaces.git
9+
version: rolling
10+
ros2/rcl_interfaces:
11+
type: git
12+
url: https://github.com/ros2/rcl_interfaces.git
13+
version: rolling
14+
ros2/test_interface_files:
15+
type: git
16+
url: https://github.com/ros2/test_interface_files.git
17+
version: rolling
18+
ros2/rosidl_core:
19+
type: git
20+
url: https://github.com/ros2/rosidl_core.git
21+
version: rolling
22+
ros2/rosidl_defaults:
23+
type: git
24+
url: https://github.com/ros2/rosidl_defaults.git
25+
version: rolling
26+
ros2/unique_identifier_msgs:
27+
type: git
28+
url: https://github.com/ros2/unique_identifier_msgs.git
29+
version: rolling
30+
ros2_rust:
31+
type: git
32+
url: https://github.com/ros2-rust/ros2_rust.git
33+
version: main

0 commit comments

Comments
 (0)