Skip to content

Commit c7389d0

Browse files
committed
feat: validate ROS_DISTRO explicitly and enable CI push/dispatch workflows
- Add validate_distro() in library_builder.py to check ROS_DISTRO against supported distributions (humble, iron, jazzy, kilted, lyrical, rolling) and fail with explicit error message instead of KeyError - Remove silent 'kilted' fallback in extra_script.py - Add push and workflow_dispatch triggers in .github/workflows/ci.yml - Set board_microros_distro = jazzy in ci/platformio.ini for platform test matrix
1 parent 6af61ad commit c7389d0

4 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: CI
22

33
on:
4+
push:
5+
branches:
6+
- '**'
47
pull_request:
58
branches:
69
- '**'
10+
workflow_dispatch:
711
schedule:
812
- cron: '59 23 * * *' # every day at 23:59 UTC
913

‎ci/platformio.ini‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[env]
2+
board_microros_distro = jazzy
3+
14
; Humble test
25
[env:portenta_h7_m7_humble]
36
platform = ststm32

‎extra_script.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
selected_board_meta = boards_metas[board] if board in boards_metas else "colcon.meta"
3636

37-
# Retrieve the required transport. Default kilted
38-
microros_distro = global_env.BoardConfig().get("microros_distro", "kilted")
37+
# Retrieve the required distro
38+
microros_distro = global_env.BoardConfig().get("microros_distro", "")
3939

4040
# Retrieve the required transport. Default serial
4141
microros_transport = global_env.BoardConfig().get("microros_transport", "serial")

‎microros_utils/library_builder.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,23 @@ def __init__(self, library_folder, packages_folder, distro, python_env):
5454
self.python_env = python_env
5555
self.env = None
5656

57+
def validate_distro(self):
58+
if not self.distro or self.distro not in Sources.dev_environments:
59+
valid_distros = ", ".join(sorted(Sources.dev_environments.keys()))
60+
sys.stderr.write(
61+
f"\n[ERROR] ROS_DISTRO / board_microros_distro is invalid or not defined: '{self.distro}'\n"
62+
f"Please export ROS_DISTRO (e.g., 'export ROS_DISTRO=jazzy' or source your ROS 2 environment) "
63+
f"or specify 'board_microros_distro' in platformio.ini.\n"
64+
f"Supported ROS 2 distributions: {valid_distros}\n\n"
65+
)
66+
sys.exit(1)
67+
5768
def run(self, meta, toolchain, user_meta = ""):
5869
if os.path.exists(self.library):
5970
print("micro-ROS already built")
6071
return
6172

73+
self.validate_distro()
6274
self.check_env()
6375
self.download_dev_environment()
6476
self.build_dev_environment()

0 commit comments

Comments
 (0)