Skip to content

Commit

Permalink
Add windows CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nnmm committed Jul 15, 2022
1 parent a635b0b commit 0e84b6f
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Rust
name: Ubuntu

on:
push:
Expand Down
102 changes: 102 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Windows

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
CARGO_TERM_COLOR: always

jobs:
build-windows:
strategy:
matrix:
ros_distribution:
- foxy
runs-on: windows-2019
steps:
- uses: actions/checkout@v2

- name: Setup ROS environment
uses: ros-tooling/setup-ros@v0.3
with:
required-ros-distributions: ${{ matrix.ros_distribution }}

- name: Search packages in this repository
id: list_packages
run: |
echo ::set-output name=package_list::$(colcon list --names-only)
shell: bash

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy, rustfmt

- name: Install colcon-cargo and colcon-ros-cargo
run: |
pip install git+https://github.com/colcon/colcon-cargo.git
pip install git+https://github.com/colcon/colcon-ros-cargo.git@fix_windows
shell: bash

- name: Check formatting of Rust packages
run: |
for path in $(colcon list | awk '$3 == "(ament_cargo)" { print $2 }'); do
cd $path
cargo fmt -- --check
cd -
done
shell: bash

- name: Install cargo-ament-build
run: |
cargo install --debug cargo-ament-build
- name: Build and test
id: build
uses: ros-tooling/action-ros-ci@v0.2
with:
package-name: ${{ steps.list_packages.outputs.package_list }}
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: ros2_rust_${{ matrix.ros_distribution }}.repos

- name: Run clippy on Rust packages
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
cd $path
echo "Running clippy in $path"
cargo clippy --all-targets --all-features -- -D warnings
cd -
done
shell: bash

- name: Run cargo test on Rust packages
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" { print $2 }'); do
cd $path
echo "Running cargo test in $path"
cargo test
cd -
done
shell: bash

- name: Rustdoc check
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" { print $2 }'); do
cd $path
echo "Running rustdoc check in $path"
cargo rustdoc -- -D warnings
cd -
done
shell: bash
5 changes: 4 additions & 1 deletion rosidl_generator_rs/rosidl_generator_rs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def generate_rs(generator_arguments_file, typesupport_impls):
(Path(args['output_dir']) / 'rust/src').mkdir(parents=True, exist_ok=True)

for dep_tuple in args.get('ros_interface_dependencies', []):
dep_parts = dep_tuple.rsplit(':', 1)
dep_parts = dep_tuple.split(':', 1)
assert len(dep_parts) == 2
if dep_parts[0] != package_name:
dependency_packages.add(dep_parts[0])
Expand All @@ -81,6 +81,9 @@ def generate_rs(generator_arguments_file, typesupport_impls):
idl_file = parse_idl_file(locator)
idl_content.elements += idl_file.content.elements

import sys; print("XYZ ros_interface_dependencies =", args.get('ros_interface_dependencies', []), file=sys.stderr)
import sys; print("XYZ dependency_packages =", dependency_packages, file=sys.stderr)

typesupport_impls = typesupport_impls.split(';')

template_dir = args['template_dir']
Expand Down

0 comments on commit 0e84b6f

Please sign in to comment.