Skip to content

Commit 205b84b

Browse files
authored
Adding windows github action (#485)
* start github action for window-ci Signed-off-by: knmcguire <kimberleymcguire@gmail.com> * pixi action use right manifest Signed-off-by: knmcguire <kimberleymcguire@gmail.com> * use pixi shell vcs tool Signed-off-by: knmcguire <kimberleymcguire@gmail.com> * change to msv-dev-cmd action for build Signed-off-by: knmcguire <kimberleymcguire@gmail.com> * add rust debug logging Signed-off-by: knmcguire <kimberleymcguire@gmail.com> * fix bindgen issue build Signed-off-by: knmcguire <kimberleymcguire@gmail.com> * remove msvc install and shorten rust ros2 package download Signed-off-by: knmcguire <kimberleymcguire@gmail.com> * Repo back to C drive and rust update Signed-off-by: knmcguire <kimberleymcguire@gmail.com> * pixi fix add rust update Signed-off-by: knmcguire <kimberleymcguire@gmail.com> * Clean up and add run test Signed-off-by: knmcguire <kimberleymcguire@gmail.com> * add normal CI schedule Signed-off-by: knmcguire <kimberleymcguire@gmail.com> * remove rust update win ci --------- Signed-off-by: knmcguire <kimberleymcguire@gmail.com>
1 parent 334f469 commit 205b84b

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

.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/msvc-dev-cmd@v1.4.1
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/setup-pixi@v0.8.1
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

0 commit comments

Comments
 (0)