From dbb44d4a8dbf40d6e76ea3597c3c4424f910cf06 Mon Sep 17 00:00:00 2001 From: gs8173 Date: Tue, 14 Oct 2025 11:10:01 +0100 Subject: [PATCH 1/4] removed gitlab ci test, added github ci test yml --- .github/workflows/ci.yml | 89 ++++++++++++++++++++++++++++++++++++ .gitlab-ci.yml | 99 ---------------------------------------- 2 files changed, 89 insertions(+), 99 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .gitlab-ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cc47ad6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,89 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + build: + name: Build (rolling on ubuntu-24.04) + runs-on: ubuntu-24.04 + + env: + DEBIAN_FRONTEND: noninteractive + ROS_DISTRO: rolling + ORL_DRIVER_ROOT: /usr + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Show environment + run: | + echo "ROS_DISTRO=$ROS_DISTRO" + uname -a + . /etc/os-release + echo "UBUNTU_CODENAME=$UBUNTU_CODENAME" + + - name: Base tools & locale + run: | + sudo apt-get update -y + sudo apt-get install -y --no-install-recommends \ + locales curl gnupg2 lsb-release build-essential ca-certificates wget + sudo locale-gen en_US.UTF-8 + sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 + + - name: Add ROS 2 apt repository + run: | + echo ">>> Configuring ROS 2 apt repo for ${ROS_DISTRO}" + curl -fsSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key \ + | gpg --dearmor | sudo tee /usr/share/keyrings/ros-archive-keyring.gpg >/dev/null + echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] \ + http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" \ + | sudo tee /etc/apt/sources.list.d/ros2.list + sudo apt-get update -y + + - name: Install ROS 2 core + dev tools + run: | + sudo apt-get install -y --no-install-recommends \ + ros-${ROS_DISTRO}-ros-base \ + ros-${ROS_DISTRO}-xacro \ + ros-${ROS_DISTRO}-ros2-control \ + ros-${ROS_DISTRO}-ros2-controllers \ + python3-colcon-common-extensions python3-argcomplete \ + python3-pip python3-rosdep + + - name: Initialize rosdep + run: | + sudo rosdep init || true + rosdep update + + - name: Resolve ROS package dependencies + run: | + source /opt/ros/${ROS_DISTRO}/setup.bash + rosdep install --from-paths . -r --rosdistro ${ROS_DISTRO} --ignore-src -y + + - name: Install proprietary ORL driver if present + run: | + set -e + if ls crcopen_hardware/lib/orl_driver-*.deb >/dev/null 2>&1; then + echo "Found ORL .deb, installing…" + sudo apt-get install -y crcopen_hardware/lib/orl_driver-*.deb || true + ORL_DRIVER_ROOT=$(dpkg -L orl_driver 2>/dev/null | grep '/include$' | head -n1 | xargs dirname || true) + if [ -z "$ORL_DRIVER_ROOT" ]; then ORL_DRIVER_ROOT=/usr; fi + echo "ORL_DRIVER_ROOT=$ORL_DRIVER_ROOT" | tee -a $GITHUB_ENV + echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$ORL_DRIVER_ROOT/lib/cmake/orl_driver" | tee -a $GITHUB_ENV + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORL_DRIVER_ROOT/lib" | tee -a $GITHUB_ENV + echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$ORL_DRIVER_ROOT/lib/pkgconfig" | tee -a $GITHUB_ENV + else + echo "No ORL .deb found (crcopen_hardware/lib/orl_driver-*.deb). Skipping." + fi + + - name: Build with colcon + run: | + set -e + source /opt/ros/${ROS_DISTRO}/setup.bash + colcon build --event-handlers console_direct+ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 7a11ba1..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,99 +0,0 @@ -# ──────────────────────────────────────────────────────────────── -# GitLab CI — Build the Comau CRC-Open ROS 2 driver -# Tested on Docker executors -# -# Jobs: -# • build-rolling : Ubuntu 24.04 + ROS 2 Rolling Ridgeline -# ──────────────────────────────────────────────────────────────── - -# Default container -image: ubuntu:24.04 - -stages: [build] - -# ----------------------------------------------------------------- -# Template with all build logic -# ----------------------------------------------------------------- -.build-template: - stage: build - tags: [ubuntu, docker, lower-privacy, meta] - - variables: - DEBIAN_FRONTEND: noninteractive - ORL_DRIVER_ROOT: "/usr" - CMAKE_PREFIX_PATH: "$CMAKE_PREFIX_PATH:/usr/lib/cmake/orl_driver" - LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:/usr/lib" - PKG_CONFIG_PATH: "$PKG_CONFIG_PATH:/usr/lib/pkgconfig" - - before_script: - - apt-get update -y - - script: | - # 1) Base tools & locale -------------------------------------------------- - apt-get install -y --no-install-recommends \ - locales curl gnupg2 lsb-release build-essential ca-certificates wget - locale-gen en_US.UTF-8 - update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 - - # 2) Add the ROS 2 apt repository (works for *all* distros) ------------- - echo ">>> Configuring ROS 2 apt repo for $ROS_DISTRO" - curl -fsSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key \ - | gpg --dearmor -o /usr/share/keyrings/ros-archive-keyring.gpg - echo "deb [arch=$(dpkg --print-architecture) \ - signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] \ - http://packages.ros.org/ros2/ubuntu \ - $(. /etc/os-release && echo $UBUNTU_CODENAME) main" \ - > /etc/apt/sources.list.d/ros2.list - - # 2.5) Pre-fetch and install libcap-dev over HTTPS to bypass HTTP block -- - wget -O /tmp/libcap-dev_2.66-5ubuntu2.2_amd64.deb \ - https://security.ubuntu.com/ubuntu/pool/main/libc/libcap2/libcap-dev_2.66-5ubuntu2.2_amd64.deb || true - if [ -f /tmp/libcap-dev_2.66-5ubuntu2.2_amd64.deb ]; then - apt-get install -y /tmp/libcap-dev_2.66-5ubuntu2.2_amd64.deb || \ - (dpkg -i /tmp/libcap-dev_2.66-5ubuntu2.2_amd64.deb && apt-get -f install -y) - fi - - # 3) Install ROS 2 core + build tools ------------------------------------ - apt-get update -y - apt-get install -y --no-install-recommends \ - ros-${ROS_DISTRO}-ros-base \ - ros-${ROS_DISTRO}-xacro \ - ros-${ROS_DISTRO}-ros2-control \ - ros-${ROS_DISTRO}-ros2-controllers \ - python3-colcon-common-extensions python3-argcomplete \ - python3-pip python3-rosdep - - # 4) ROS environment, rosdep initialisation ------------------------------ - source /opt/ros/${ROS_DISTRO}/setup.bash - rosdep init || true - rosdep update - - # 5) Resolve package dependencies ---------------------------------------- - cd "${CI_PROJECT_DIR}" - rosdep install --from-paths . -r --rosdistro ${ROS_DISTRO} --ignore-src -y - - # 6) install proprietary ORL .deb ----------------------------- - apt-get install -y "${CI_PROJECT_DIR}"/crcopen_hardware/lib/orl_driver-*.deb || true - - ORL_DRIVER_ROOT=$(dpkg -L orl_driver 2>/dev/null | \ - grep '/include$' | head -n1 | xargs dirname) - [ -z "$ORL_DRIVER_ROOT" ] && ORL_DRIVER_ROOT=/usr - echo "Using ORL_DRIVER_ROOT=$ORL_DRIVER_ROOT" - - export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH:$ORL_DRIVER_ROOT/lib/cmake/orl_driver" - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ORL_DRIVER_ROOT/lib" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$ORL_DRIVER_ROOT/lib/pkgconfig" - - # 7) Build the driver ----------------------------------------------------- - source /opt/ros/${ROS_DISTRO}/setup.bash - colcon build --event-handlers console_direct+ - -# ----------------------------------------------------------------- -# Concrete jobs -# ----------------------------------------------------------------- - -build-rolling: - extends: .build-template - variables: - ROS_DISTRO: rolling - rules: [ { when: always } ] \ No newline at end of file From 4ae0032965167097842124fbacd4da6ef5158645 Mon Sep 17 00:00:00 2001 From: gs8173 Date: Tue, 14 Oct 2025 11:14:58 +0100 Subject: [PATCH 2/4] updated readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ed8cdf..13c41a6 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ A ROS 2 package with useful launch files as explained in the usage section of th **Overall pipeline status** -[![Pipeline Status](https://git.ccfe.ac.uk/apcs/comau-crcopen-ros2-driver/badges/main/pipeline.svg)](https://git.ccfe.ac.uk/apcs/comau-crcopen-ros2-driver/-/pipelines) +[![CI](https://github.com/OWNER/REPO/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ukaea/CRCOpenROS2Driver/actions/workflows/ci.yml) # Getting Started From 2cf433e7ba3bc71ec21ac2317208217bdc8aa239 Mon Sep 17 00:00:00 2001 From: gs8173 Date: Tue, 14 Oct 2025 11:22:39 +0100 Subject: [PATCH 3/4] fix for the ci test: Change the install step to install the local .deb correctly and then export prefix paths that actually exist after installation. --- .github/workflows/ci.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc47ad6..a3daa04 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,13 +71,27 @@ jobs: set -e if ls crcopen_hardware/lib/orl_driver-*.deb >/dev/null 2>&1; then echo "Found ORL .deb, installing…" - sudo apt-get install -y crcopen_hardware/lib/orl_driver-*.deb || true - ORL_DRIVER_ROOT=$(dpkg -L orl_driver 2>/dev/null | grep '/include$' | head -n1 | xargs dirname || true) - if [ -z "$ORL_DRIVER_ROOT" ]; then ORL_DRIVER_ROOT=/usr; fi - echo "ORL_DRIVER_ROOT=$ORL_DRIVER_ROOT" | tee -a $GITHUB_ENV - echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH:$ORL_DRIVER_ROOT/lib/cmake/orl_driver" | tee -a $GITHUB_ENV - echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORL_DRIVER_ROOT/lib" | tee -a $GITHUB_ENV - echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$ORL_DRIVER_ROOT/lib/pkgconfig" | tee -a $GITHUB_ENV + # Use a path so apt treats it as a file, not a package name: + # either absolute path or './' prefix both work. + DEB_PATH="$(ls -1 crcopen_hardware/lib/orl_driver-*.deb | head -n1)" + sudo apt-get update -y + # Option A (apt can install local files when prefixed with ./) + sudo apt-get install -y "./${DEB_PATH}" \ + || (sudo dpkg -i "./${DEB_PATH}" && sudo apt-get -f install -y) + + # Discover the actual install prefix of orl_driver + ORL_DRIVER_ROOT="$(dpkg -L orl_driver | grep -E '/include$' | head -n1 | xargs dirname || true)" + [ -z "$ORL_DRIVER_ROOT" ] && ORL_DRIVER_ROOT=/usr + echo "ORL_DRIVER_ROOT=${ORL_DRIVER_ROOT}" + + # Export prefix and common search paths for subsequent steps + # (point CMAKE_PREFIX_PATH to the INSTALL PREFIX, which is safest) + { + echo "ORL_DRIVER_ROOT=${ORL_DRIVER_ROOT}" + echo "CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH:+$CMAKE_PREFIX_PATH:}${ORL_DRIVER_ROOT}" + echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${ORL_DRIVER_ROOT}/lib:${ORL_DRIVER_ROOT}/lib64" + echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH:+$PKG_CONFIG_PATH:}${ORL_DRIVER_ROOT}/lib/pkgconfig:${ORL_DRIVER_ROOT}/lib64/pkgconfig" + } >> "$GITHUB_ENV" else echo "No ORL .deb found (crcopen_hardware/lib/orl_driver-*.deb). Skipping." fi From 9200fdc2ab328ccafd16ce89f5bb3898ed8afda0 Mon Sep 17 00:00:00 2001 From: gs8173 Date: Tue, 14 Oct 2025 11:31:47 +0100 Subject: [PATCH 4/4] fixing the status badge of ci test in readme --- .github/workflows/ci.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3daa04..4c63a21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,7 +66,7 @@ jobs: source /opt/ros/${ROS_DISTRO}/setup.bash rosdep install --from-paths . -r --rosdistro ${ROS_DISTRO} --ignore-src -y - - name: Install proprietary ORL driver if present + - name: Install ORL driver if present run: | set -e if ls crcopen_hardware/lib/orl_driver-*.deb >/dev/null 2>&1; then diff --git a/README.md b/README.md index 13c41a6..b687b42 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ A ROS 2 package with useful launch files as explained in the usage section of th **Overall pipeline status** -[![CI](https://github.com/OWNER/REPO/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ukaea/CRCOpenROS2Driver/actions/workflows/ci.yml) +[![CI](https://github.com/ukaea/CRCOpenROS2Driver/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ukaea/CRCOpenROS2Driver/actions/workflows/ci.yml) # Getting Started