-
Notifications
You must be signed in to change notification settings - Fork 217
ci: restore blocking Rust package checks #684
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
base: main
Are you sure you want to change the base?
Changes from 5 commits
bc8e4ac
a86ee30
ad828ae
ec6e702
65ec9ec
9a5cdda
d3b3144
3133082
71537a4
a2948d1
0ecc15c
f4044d5
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 |
|---|---|---|
|
|
@@ -92,7 +92,7 @@ jobs: | |
|
|
||
| - name: Check formatting of Rust packages | ||
| run: | | ||
| for path in $(colcon list | awk '$3 == "(ament_cargo)" { print $2 }'); do | ||
| for path in $(colcon list --packages-up-to $(echo "${{ steps.list_packages.outputs.package_list }}") | awk '$3 == "(ros.ament_cargo)" { print $2 }'); do | ||
| cd $path | ||
| rustup toolchain install nightly | ||
| cargo +nightly fmt -- --check | ||
|
|
@@ -108,10 +108,11 @@ jobs: | |
| vcs-repo-file-url: ros2_rust_${{ matrix.ros_distribution }}.repos | ||
|
|
||
| - name: Run clippy on Rust packages | ||
| continue-on-error: true # revived check: non-blocking until the pre-existing rclrs backlog is paid down | ||
| run: | | ||
| cd ${{ steps.build.outputs.ros-workspace-directory-name }} | ||
| . /opt/ros/${{ matrix.ros_distribution }}/setup.sh | ||
| for path in $(colcon list | awk '$3 == "(ament_cargo)" { print $2 }'); do | ||
| for path in $(colcon list --packages-up-to $(echo "${{ steps.list_packages.outputs.package_list }}") | awk '$3 == "(ros.ament_cargo)" { print $2 }'); do | ||
| cd $path | ||
| echo "Running clippy in $path" | ||
| # Run clippy for all features except use_ros_shim (needed for docs.rs) | ||
|
|
@@ -124,10 +125,11 @@ jobs: | |
| done | ||
|
|
||
| - name: Run cargo test on Rust packages | ||
|
Contributor
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 believe the step "Build and test" lines 102-108 already run the tests. At least tests were being run while this was broken. This means that now we are running tests twice. We should check which one we want to keep and avoid running tests twice.
Author
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. Agreed. I removed the direct Linux |
||
| continue-on-error: true # revived check: non-blocking until the pre-existing rclrs backlog is paid down | ||
| run: | | ||
| cd ${{ steps.build.outputs.ros-workspace-directory-name }} | ||
| . install/setup.sh | ||
| 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 | ||
| for path in $(colcon list --packages-up-to $(echo "${{ steps.list_packages.outputs.package_list }}") | awk '$3 == "(ros.ament_cargo)" && $1 != "examples_rclrs_minimal_pub_sub" && $1 != "examples_rclrs_minimal_client_service" && $1 != "rust_pubsub" { print $2 }'); do | ||
| cd $path | ||
| echo "Running cargo test in $path" | ||
| # Run cargo test for all features except use_ros_shim (needed for docs.rs) | ||
|
|
@@ -140,10 +142,11 @@ jobs: | |
| done | ||
|
|
||
| - name: Rustdoc check | ||
| continue-on-error: true # revived check: non-blocking until the pre-existing rclrs backlog is paid down | ||
| run: | | ||
| cd ${{ steps.build.outputs.ros-workspace-directory-name }} | ||
| . /opt/ros/${{ matrix.ros_distribution }}/setup.sh | ||
| 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 | ||
| for path in $(colcon list --packages-up-to $(echo "${{ steps.list_packages.outputs.package_list }}") | awk '$3 == "(ros.ament_cargo)" && $1 != "examples_rclrs_minimal_pub_sub" && $1 != "examples_rclrs_minimal_client_service" && $1 != "rust_pubsub" { print $2 }'); do | ||
| cd $path | ||
| echo "Running rustdoc check in $path" | ||
| cargo rustdoc -- -D warnings | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,7 +76,7 @@ jobs: | |
| call C:\pixi_ws\ros2-windows\setup.bat | ||
| cd C:\workspace | ||
| for /f "tokens=1,2,3" %%A in ('pixi run --manifest-path C:\pixi_ws\pixi.toml colcon list') do ( | ||
|
Contributor
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. From the logs, cargo test fails but the step still succeeds and the failure is silently ignored
Author
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. Fixed in
Author
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. Fixed in : the Windows batch loop now checks immediately after each , returns a failing step on any package failure, and also fails if the selector matches zero target packages. |
||
| if "%%C"=="(ament_cargo)" ( | ||
| if "%%C"=="(ros.ament_cargo)" ( | ||
| if /I not "%%A"=="examples_rclrs_minimal_pub_sub" if /I not "%%A"=="examples_rclrs_minimal_client_service" if /I not "%%A"=="rust_pubsub" ( | ||
| cd %%B | ||
| echo Running cargo test in %%B | ||
|
|
||
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.
This is being repeated multiple times, is it worth extracting into a step that adds the list of packages in an output that other steps can reuse?
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.
Done in
71537a4. Repository and post-build Rust package paths are each computed once into step outputs and reused. Both selector steps fail explicitly if they produce an empty target set.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.
I prefer readability over reducing repetition if the solution is too complex or not easy to read, it's only a handful of packages.