Skip to content

Commit fa3179a

Browse files
authored
refactor/ros-no-ros (#14)
* refactor: restructure workspace for ROS-independent build - Add default-members excluding ROS-dependent packages - Move protobuf_demo to workspace members - Update roslibrust dependency to latest commit * refactor: support multiple ROS distros in Nix flake - Add factory functions to create environments for different ROS distros - Support Jazzy and Rolling distributions - Add noRos development shell without ROS dependencies - Create per-distro CI shells (jazzy-ci, rolling-ci, noRos-ci) - Generate packages for all supported distros - Update dependencies (nix-ros-overlay, nixpkgs, rust-overlay) * ci: split workflow into ROS-independent and ROS-dependent jobs - Add no-ros job testing core functionality without ROS - Add with-ros job matrix for testing with different ROS distros - Test bundled message features without ROS installation - Test external message features with ROS installation - Add protobuf feature testing - Fix typo: requries -> requires * refactor: make ros-z-codegen ROS-independent - Remove roslibrust from default features - Make protobuf support opt-in - Conditionally compile protobuf adapter - Remove default RCL dependency lookups * feat: support bundled and external messages in ros-z-msgs - Split features into bundled (no ROS) and external (needs ROS) - Add individual package features for fine-grained control - Implement fallback search for ROS packages (system -> roslibrust) - Make common_interfaces default (bundled messages only) - Add all_msgs feature for bundled + external messages - Print detailed cargo warnings about message sources * docs: add RCL dependency note to rcl-z Add note explaining that rcl-z requires ROS Client Library dependencies and how to exclude it from builds without ROS. * refactor: make ros-z core ROS-independent - Add protobuf and rcl-z as optional features - Update z_pubsub example to use bundled messages - Add z_custom_message example with Rust-defined messages - Remove default ros-z-msgs dependency from core library * refactor: make ros-z-tests dependencies optional Add ros-msgs feature to gate ros-z-msgs dependency and allow testing core functionality without ROS messages. * feat: add protobuf demo as advanced example Move protobuf_demo to workspace member and update to demonstrate both ROS message protobuf serialization and custom protobuf messages. * docs: comprehensive update for ROS-independent build - Document default build without ROS dependencies - Add bundled vs external message feature documentation - Document workspace structure and member exclusions - Add examples categorized by dependencies - Document Nix shell options for different distros - Add feature flags documentation for all packages - Clarify build system search order for message packages * feat: add markdownlint to development and CI - Add markdownlint-cli to common build inputs - Add Markdown formatting check to CI workflow - Check all markdown files while ignoring target and node_modules * fix: resolve markdownlint errors - Fix line length issues in README.md and _PROTOBUF.md - Add blank lines around headings and lists - Add code block language specifications - Create .markdownlintignore for build artifacts and temp files - Create .markdownlint.json to allow HTML in styled sections - Update CI to use markdownlint config files * feat: add nix fmt check to CI and fix formatting - Add "Check Nix formatting" step to CI workflow - Run nixfmt-rfc-style on flake.nix - Fix formatting issues in flake.nix * chore: tidy .markdownlintignore * fix: gate z_srvcli example behind external_msgs feature - Add external_msgs feature to ros-z that propagates to ros-z-msgs - Require external_msgs feature for z_srvcli example - Update README to document the feature and build command - Fixes cargo test failure when building without ROS dependencies * fix: enable external_msgs for interop tests - Add ros-z-msgs/external_msgs to interop-tests feature - Update test.yml workflow to run interop tests correctly - Change test command to: cargo test -p ros-z-tests --features interop-tests - Rename workflow from "CI" to "Interop Tests" for clarity - Clean up workflow formatting * style: cargo fmt * fix: correct z_srvcli example feature flag syntax * perf: use release build for interop tests in CI * ci: disable the interop test
1 parent 29c852b commit fa3179a

File tree

22 files changed

+1091
-269
lines changed

22 files changed

+1091
-269
lines changed

.github/workflows/ci.yml

Lines changed: 103 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,79 @@ on:
77
branches: [ main ]
88

99
jobs:
10-
ci:
11-
name: Check, Build, and Test
10+
no-ros:
11+
name: ROS-independent Test
1212
runs-on: ubuntu-latest
1313

14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Install Nix
19+
uses: cachix/install-nix-action@v27
20+
with:
21+
nix_path: nixpkgs=channel:nixos-unstable
22+
extra_nix_config: |
23+
experimental-features = nix-command flakes
24+
accept-flake-config = true
25+
26+
- name: Setup sccache
27+
if: env.ACT != 'true'
28+
uses: mozilla-actions/sccache-action@v0.0.9
29+
30+
- name: Check Nix formatting
31+
run: |
32+
nix fmt -- --check flake.nix
33+
34+
- name: Check Markdown formatting
35+
run: |
36+
nix develop '.#noRos-ci' -c markdownlint '**/*.md'
37+
38+
- name: Check Rust formatting
39+
run: |
40+
nix develop '.#noRos-ci' -c cargo fmt --all -- --check
41+
42+
- name: Clippy (default workspace)
43+
run: |
44+
nix develop '.#noRos-ci' -c cargo clippy --lib --bins --tests -- -D warnings
45+
46+
- name: Check default workspace
47+
run: |
48+
nix develop '.#noRos-ci' -c cargo check
49+
50+
- name: Build default workspace
51+
run: |
52+
nix develop '.#noRos-ci' -c cargo build
53+
54+
- name: Build examples without ROS dependencies
55+
run: |
56+
nix develop '.#noRos-ci' -c cargo build --example z_custom_message
57+
58+
- name: Run tests
59+
run: |
60+
nix develop '.#noRos-ci' -c cargo test
61+
62+
- name: Check ros-z-msgs with bundled messages (no ROS required)
63+
run: |
64+
nix develop '.#noRos-ci' -c cargo check -p ros-z-msgs
65+
nix develop '.#noRos-ci' -c cargo check -p ros-z-msgs --features bundled_msgs
66+
nix develop '.#noRos-ci' -c cargo check -p ros-z-msgs --features common_interfaces
67+
68+
- name: Build ros-z-msgs with individual bundled packages
69+
run: |
70+
nix develop '.#noRos-ci' -c cargo build -p ros-z-msgs --no-default-features --features std_msgs
71+
nix develop '.#noRos-ci' -c cargo build -p ros-z-msgs --no-default-features --features geometry_msgs
72+
nix develop '.#noRos-ci' -c cargo build -p ros-z-msgs --no-default-features --features sensor_msgs
73+
nix develop '.#noRos-ci' -c cargo build -p ros-z-msgs --no-default-features --features nav_msgs
74+
75+
with-ros:
76+
name: ROS-dependent Test (${{ matrix.distro }})
77+
runs-on: ubuntu-latest
78+
strategy:
79+
matrix:
80+
distro: [jazzy]
81+
# distro: [jazzy, rolling] # Uncomment to test rolling when stable
82+
1483
steps:
1584
- name: Checkout repository
1685
uses: actions/checkout@v4
@@ -36,19 +105,44 @@ jobs:
36105
if: env.ACT != 'true'
37106
uses: mozilla-actions/sccache-action@v0.0.9
38107

39-
- name: Check Rust formatting
108+
- name: Check rcl-z
109+
run: |
110+
nix develop '.#${{ matrix.distro }}-ci' -c cargo check -p rcl-z
111+
112+
- name: Check ros-z-msgs (default bundled features)
113+
run: |
114+
nix develop '.#${{ matrix.distro }}-ci' -c cargo check -p ros-z-msgs
115+
116+
- name: Check ros-z-msgs with external messages
117+
run: |
118+
nix develop '.#${{ matrix.distro }}-ci' -c cargo check -p ros-z-msgs --features external_msgs
119+
nix develop '.#${{ matrix.distro }}-ci' -c cargo check -p ros-z-msgs --features example_interfaces
120+
121+
- name: Check ros-z-msgs with all messages (bundled + external)
122+
run: |
123+
nix develop '.#${{ matrix.distro }}-ci' -c cargo check -p ros-z-msgs --features all_msgs
124+
125+
- name: Check with protobuf feature
126+
run: |
127+
nix develop '.#${{ matrix.distro }}-ci' -c cargo check -p ros-z -p ros-z-msgs --features ros-z/protobuf,ros-z-msgs/protobuf
128+
129+
- name: Check ros-z (with rcl-z feature)
40130
run: |
41-
nix develop .#ci -c cargo fmt --all -- --check
131+
nix develop '.#${{ matrix.distro }}-ci' -c cargo check -p ros-z --features rcl-z
42132
43-
- name: Clippy
133+
- name: Build ROS message examples
44134
run: |
45-
nix develop .#ci -c cargo clippy --all-targets --all-features -- -D warnings
135+
nix develop '.#${{ matrix.distro }}-ci' -c cargo build -p ros-z-msgs
136+
nix develop '.#${{ matrix.distro }}-ci' -c cargo build --example twist_pub
137+
nix develop '.#${{ matrix.distro }}-ci' -c cargo build --example battery_state_sub
138+
nix develop '.#${{ matrix.distro }}-ci' -c cargo build --example laser_scan
139+
nix develop '.#${{ matrix.distro }}-ci' -c cargo build --example z_srvcli --features external_msgs
46140
47-
- name: Check all features
141+
- name: Build protobuf demo
48142
run: |
49-
nix develop .#ci -c cargo check --all-targets --all-features
143+
nix develop '.#${{ matrix.distro }}-ci' -c cargo build -p protobuf_demo
50144
51-
# FIXME: This requries the installation of rmw_zenoh_cpp triggering a build from source...
145+
# FIXME: This requires the installation of rmw_zenoh_cpp triggering a build from source...
52146
# - name: Run unit tests
53147
# run: |
54148
# nix develop .#ci -c cargo test --all-features

.github/workflows/test.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Interop Tests
22

33
on:
44
push:
@@ -14,12 +14,18 @@ jobs:
1414
image: rostooling/setup-ros-docker:ubuntu-noble-ros-jazzy-ros-base-latest
1515
steps:
1616
- name: Install Node.js
17-
run: apt-get update && apt-get install -y nodejs
18-
- name: ROS dependencies
19-
run: apt-get install -y ros-jazzy-example-interfaces
17+
run: apt-get update && apt-get install -y nodejs
18+
19+
- name: Install ROS dependencies
20+
run: apt-get install -y ros-jazzy-example-interfaces
21+
2022
- uses: actions/checkout@v4
23+
2124
- uses: actions-rust-lang/setup-rust-toolchain@v1
22-
- name: Run ROS tests
23-
shell: bash
24-
# Note that we limit only one test item tested at the same time to avoid the confliction between bridges
25-
run: "source /opt/ros/jazzy/setup.bash && cd ros-z && cargo test --all-features --verbose"
25+
26+
# FIXME: This fails on Github runner
27+
# - name: Run interop tests
28+
# shell: bash
29+
# run: |
30+
# source /opt/ros/jazzy/setup.bash
31+
# cargo test -p ros-z-tests --features interop-tests --release

.markdownlint.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"MD013": false,
3+
"MD033": {
4+
"allowed_elements": ["div", "h1", "p", "strong", "a", "sub"]
5+
},
6+
"MD041": false
7+
}

.markdownlintignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Build artifacts
2+
target/
3+
node_modules/
4+
5+
# Temporary and analysis files
6+
_*
7+
8+
# Third-party dependencies
9+
.cargo/

Cargo.lock

Lines changed: 15 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ homepage = "https://github.com/ZettaScaleLabs/ros-z"
66

77
[workspace]
88
resolver = "2"
9-
members = ["ros-z", "rcl-z", "ros-z-codegen", "ros-z-msgs", "ros-z-tests"]
9+
members = ["ros-z", "ros-z-codegen", "rcl-z", "ros-z-msgs", "ros-z-tests", "ros-z/examples/protobuf_demo"]
10+
default-members = ["ros-z", "ros-z-codegen"]
11+
# Note: protobuf_demo is an advanced example demonstrating protobuf serialization
1012

1113
[workspace.dependencies]
1214
# Workspace members

0 commit comments

Comments
 (0)