Skip to content

build: migrate ROS stack to Jazzy, Python 3.12, and NumPy 2 #322

build: migrate ROS stack to Jazzy, Python 3.12, and NumPy 2

build: migrate ROS stack to Jazzy, Python 3.12, and NumPy 2 #322

Workflow file for this run

name: CI Check
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
jobs:
registry-check:
runs-on: windows-2022
env:
# Fix Unicode encoding issue on Windows runner (cp1252 -> utf-8)
PYTHONIOENCODING: utf-8
PYTHONUTF8: 1
# 强制 matplotlib 使用无头后端,避免在无显示的 Windows runner 上加载 GUI 后端 DLL 导致原生崩溃
MPLBACKEND: Agg
# 原生崩溃(0xC0000005 访问违例)时打印 Python 调用栈,便于定位是哪个设备模块 import 崩溃
PYTHONFAULTHANDLER: "1"
defaults:
run:
shell: cmd
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Miniforge
uses: conda-incubator/setup-miniconda@v4
with:
miniforge-version: latest
use-mamba: true
python-version: '3.12.13'
channels: conda-forge,robostack-jazzy
channel-priority: strict
activate-environment: check-env
auto-update-conda: false
show-channel-urls: true
- name: Install ROS 2 Jazzy dependencies and build tools
run: |
echo Installing ROS 2 Jazzy dependencies...
mamba install -n check-env --override-channels -c conda-forge -c robostack-jazzy conda-forge::numpy=2 conda-forge::uv conda-forge::opencv conda-forge::colcon-common-extensions robostack-jazzy::ros2-distro-mutex=0.15 robostack-jazzy::ros-jazzy-ros-core robostack-jazzy::ros-jazzy-action-msgs robostack-jazzy::ros-jazzy-std-msgs robostack-jazzy::ros-jazzy-geometry-msgs robostack-jazzy::ros-jazzy-control-msgs robostack-jazzy::ros-jazzy-nav2-msgs robostack-jazzy::ros-jazzy-cv-bridge robostack-jazzy::ros-jazzy-vision-opencv robostack-jazzy::ros-jazzy-tf-transformations robostack-jazzy::ros-jazzy-moveit-msgs robostack-jazzy::ros-jazzy-tf2-ros robostack-jazzy::ros-jazzy-tf2-ros-py conda-forge::transforms3d -y
- name: Initialize MSVC x64 toolchain
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Build unilabos_msgs for Jazzy/cp312
run: |
call conda activate check-env
colcon build --base-paths unilabos_msgs --build-base build\unilabos_msgs --install-base install\unilabos_msgs --merge-install --packages-select unilabos_msgs --cmake-args -DBUILD_TESTING=OFF
call install\unilabos_msgs\setup.bat
python -c "from unilabos_msgs.msg import Resource; print('unilabos_msgs Jazzy/cp312: OK')"
- name: Install pip dependencies and unilabos
run: |
call conda activate check-env
call install\unilabos_msgs\setup.bat
echo Installing pip dependencies...
uv pip install -r unilabos/utils/requirements.txt
uv pip install pywinauto git+https://github.com/Xuwznln/pylabrobot.git
uv pip uninstall enum34 || echo enum34 not installed, skipping
uv pip install pytest
uv pip install .
- name: Run HostLink networking tests
run: |
call conda activate check-env
call install\unilabos_msgs\setup.bat
echo Running HostLink, ROS2 domain and networking runtime tests...
python -m pytest -q tests\hostlink tests\networking tests\ros\test_domain_init.py -p no:launch_testing -p no:launch_ros
- name: Run check mode (AST registry validation)
# check_mode 会真实 import 所有设备类(连带 matplotlib/opencv 等原生库)。
# Windows runner 上偶发原生崩溃(退出码 -1073741819 = 0xC0000005 访问违例),
# 这是环境/DLL 层面的 flaky 崩溃,与注册表内容无关,因此对该步做有限次重试。
# 注意:段错误退出码为负数,必须用 "%ERRORLEVEL% EQU 0" 显式判断,
# 不能用 "if errorlevel 1"(它对负数退出码会误判为成功)。
run: |
call conda activate check-env
call install\unilabos_msgs\setup.bat
echo Running check mode...
set ATTEMPTS=4
set COUNT=0
:retry
set /a COUNT+=1
echo === Check attempt %COUNT% of %ATTEMPTS% ===
python -m unilabos --check_mode --skip_env_check
if %ERRORLEVEL% EQU 0 (
echo Check passed on attempt %COUNT%
exit /b 0
)
echo Attempt %COUNT% failed with exit code %ERRORLEVEL%
if %COUNT% LSS %ATTEMPTS% goto retry
echo All %ATTEMPTS% attempts failed
exit /b 1
- name: Check for uncommitted changes
shell: bash
run: |
if ! git diff --exit-code; then
echo "::error::检测到文件变化!请先在本地运行 'python -m unilabos --complete_registry' 并提交变更"
echo "变化的文件:"
git diff --name-only
exit 1
fi
echo "检查通过:无文件变化"