Skip to content

Commit bca448b

Browse files
committed
Clean up and add run test
Signed-off-by: knmcguire <[email protected]>
1 parent 6a4e420 commit bca448b

File tree

1 file changed

+43
-24
lines changed

1 file changed

+43
-24
lines changed

.github/workflows/rust-win.yml

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
name: Rust ROS 2 Windows build
22

33
on:
4-
#push:
5-
# branches: [ main ]
6-
#pull_request:
7-
# branches: [ main ]
8-
#schedule:
9-
# - cron: '22 2 * * 2'
104
push:
115
branches: [ win-ci]
126
workflow_dispatch:
@@ -17,49 +11,74 @@ env:
1711
jobs:
1812
build:
1913
runs-on: windows-latest
20-
env:
21-
LIBCLANG_PATH: C:\pixi_ws\.pixi\envs\default\Library\bin
22-
RUST_BACKTRACE: 1
23-
RUST_LOG: debug
2414
steps:
2515
- uses: actions/checkout@v4
16+
2617
- uses: ilammy/[email protected]
27-
- name: Make new directory environment and copy ros2_rust repo in there
18+
19+
- name: Make new directories and copy ros2_rust repo
2820
run: |
2921
mkdir C:\workspace\src
3022
mkdir C:\pixi_ws
3123
xcopy /E /I /Y D:\a\ros2_rust\ros2_rust C:\workspace\src\ros2_rust
24+
3225
- name: Get pixi toml file
3326
run: irm https://raw.githubusercontent.com/ros2/ros2/refs/heads/rolling/pixi.toml -OutFile C:\pixi_ws\pixi.toml
34-
- name: Setup Pixi environment
27+
28+
- name: Setup Pixi environment woth ROS2 toml file
3529
uses: prefix-dev/[email protected]
3630
with:
3731
manifest-path: C:/pixi_ws/pixi.toml
32+
3833
- name: Get prebuild ROS files and unzip
3934
run: |
4035
irm https://ci.ros2.org/view/packaging/job/packaging_windows/lastSuccessfulBuild/artifact/ws/ros2-package-windows-AMD64.zip -Outfile ros2-package-windows-AMD64.zip
4136
Expand-Archive -Path ros2-package-windows-AMD64.zip -DestinationPath C:/pixi_ws/
42-
- name: Install Rust ROS prerequisites
43-
run: pixi add libclang --manifest-path C:\pixi_ws\pixi.toml
44-
- name: Rename libclang-13.dll to libclang.dll
37+
38+
- name: Install ros2_rust prerequisites
39+
# Prerequisits and fixes for windows build ros2_rust:
40+
# * examples_rclrs_message_demo error and incompatibility with backtrace v0.3.75 with rustc 1.75. (TODO update in ROS2 pixi.toml)
41+
# * Libclang has to be added (from the ros2_rust instructions) and the dll has to be renamed
42+
# * colcon-ros-cargo and colcon-cargo have to be added as PyPI packages
4543
run: |
44+
pixi add --manifest-path C:\pixi_ws\pixi.toml rust
45+
pixi add libclang --manifest-path C:\pixi_ws\pixi.toml
4646
$src = "C:\pixi_ws\.pixi\envs\default\Library\bin\libclang-13.dll"
4747
$dst = "C:\pixi_ws\.pixi\envs\default\Library\bin\libclang.dll"
4848
if (Test-Path $src) { Rename-Item -Path $src -NewName "libclang.dll" }
49-
- name: Adding Colcon to pixi as PyPI
50-
working-directory: C:\pixi_ws\
51-
run: |
5249
pixi add --pypi "colcon-ros-cargo@git+https://github.com/colcon/colcon-ros-cargo.git" --manifest-path C:\pixi_ws\pixi.toml
5350
pixi add --pypi "colcon-cargo@git+https://github.com/colcon/colcon-cargo.git" --manifest-path C:\pixi_ws\pixi.toml
54-
- name: Import other rolling ROS rust repos
55-
run: pixi run --manifest-path C:\pixi_ws\pixi.toml vcs import C:/workspace/src --input C:/workspace/src/ros2_rust/ros2_rust_rolling.repos
56-
- name: update rust version
57-
run: pixi add --manifest-path C:\pixi_ws\pixi.toml rust # necessary for examples_rclrs_message_demo error and incompatibility with backtrace v0.3.75 with rustc 1.75. (TODO update in ROS2 pixi.toml)
51+
5852
- name: Build the rust package
59-
#env:
60-
# BINDGEN_EXTRA_CLANG_ARGS: -D_Check_return_= # to handle the clang error with the windows specific bindgen error
53+
env:
54+
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
55+
BINDGEN_EXTRA_CLANG_ARGS: -D_Check_return_= # to handle the clang error with the windows specific bindgen error
6156
run: |
6257
call C:\pixi_ws\ros2-windows\setup.bat
58+
pixi run --manifest-path C:\pixi_ws\pixi.toml vcs import C:/workspace/src --input C:/workspace/src/ros2_rust/ros2_rust_rolling.repos
6359
pixi run --manifest-path C:\pixi_ws\pixi.toml colcon build
6460
working-directory: C:/workspace
6561
shell: cmd
62+
63+
- name: Run cargo test on Rust packages
64+
run: |
65+
call C:\pixi_ws\ros2-windows\setup.bat
66+
cd C:\workspace
67+
for /f "tokens=1,2,3" %%A in ('pixi run --manifest-path C:\pixi_ws\pixi.toml colcon list') do (
68+
if "%%C"=="(ament_cargo)" (
69+
if /I not "%%A"=="examples_rclrs_minimal_pub_sub" if /I not "%%A"=="examples_rclrs_minimal_client_service" if /I not "%%A"=="rust_pubsub" (
70+
cd %%B
71+
echo Running cargo test in %%B
72+
if /I "%%~nxB"=="rclrs" (
73+
cargo test -F default,dyn_msg
74+
) else if /I "%%~nxB"=="rosidl_runtime_rs" (
75+
cargo test -F default
76+
) else (
77+
cargo test --all-features
78+
)
79+
cd ..
80+
)
81+
)
82+
)
83+
shell: cmd
84+
working-directory: C:\workspace

0 commit comments

Comments
 (0)