tooling: Group pip runtime dependencies #6464
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ################################################################################ | |
| # This workflow will do a clean install of project dependencies, build the | |
| # source code and run tests. | |
| ################################################################################ | |
| name: OASIS ROS | |
| # Controls when the action will run. Triggers the workflow on push or pull | |
| # request events | |
| on: | |
| push: | |
| pull_request: | |
| schedule: | |
| # Schedule the workflow to run at midnight on the first day of each month (UTC time) | |
| - cron: '0 0 1 * *' | |
| # A workflow run is made up of one or more jobs that can run sequentially or in | |
| # parallel | |
| jobs: | |
| # This workflow contains a single job called "build" | |
| build: | |
| # The type of runner that the job will run on | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-24.04 | |
| ros2_distro: kilted | |
| # Steps represent a sequence of tasks that will be executed as part of the | |
| # job | |
| steps: | |
| - name: Build environment information | |
| run: 'echo "Matrix OS: ${{ matrix.os }} on $HOSTNAME with $(getconf _NPROCESSORS_ONLN) cores"' | |
| # Check-out the repository under $GITHUB_WORKSPACE, so the job can | |
| # access it | |
| - name: Checkout main repo | |
| uses: actions/checkout@v4 | |
| # Compute all cache hashes once | |
| - name: Compute cache hashes | |
| uses: actions/github-script@v7 | |
| with: | |
| # Include messages with perception_cpp as keys can't be longer than | |
| # 512 characters | |
| script: | | |
| async function hash(patterns) { | |
| return await glob.hashFiles(patterns.join('\n')); | |
| } | |
| async function setHash(name, patterns) { | |
| const value = await hash(patterns); | |
| core.setOutput(name, value); | |
| core.exportVariable(name, value); | |
| } | |
| await setHash('CMAKE_HASH', [ | |
| 'oasis_tooling/scripts/*cmake.sh', | |
| ]); | |
| await setHash('OPENCV_HASH', [ | |
| 'oasis_tooling/config/opencv/**', | |
| 'oasis_tooling/scripts/*cv.sh', | |
| ]); | |
| await setHash('ROS2_DESKTOP_HASH', [ | |
| 'oasis_tooling/config/image_common/**', | |
| 'oasis_tooling/scripts/*ros2_desktop.sh', | |
| ]); | |
| await setHash('OASIS_DEPENDS_HASH', [ | |
| 'oasis_tooling/config/bgslibrary/**', | |
| 'oasis_tooling/config/camera_ros/**', | |
| 'oasis_tooling/config/depends.repos', | |
| 'oasis_tooling/config/i2cdevlib/**', | |
| 'oasis_tooling/config/libcamera_cmake/**', | |
| 'oasis_tooling/config/libcec/**', | |
| 'oasis_tooling/config/libfreenect2/**', | |
| 'oasis_tooling/config/OpenNI/**', | |
| 'oasis_tooling/config/ORB_SLAM_OASIS/**', | |
| 'oasis_tooling/config/p8-platform/**', | |
| 'oasis_tooling/config/pangolin/**', | |
| 'oasis_tooling/config/vision_opencv/**', | |
| 'oasis_tooling/scripts/*oasis_deps.sh', | |
| ]); | |
| await setHash('MEDIAPIPE_HASH', [ | |
| 'oasis_tooling/config/mediapipe/**', | |
| 'oasis_tooling/scripts/*mediapipe.sh', | |
| ]); | |
| await setHash('ARDUINO_BOOTSTRAP_HASH', [ | |
| 'oasis_avr/bootstrap.sh', | |
| 'oasis_avr/scripts/get_arduino_platform.sh', | |
| ]); | |
| await setHash('OASIS_AVR_HASH', [ | |
| 'oasis_avr/**', | |
| ]); | |
| await setHash('OASIS_DRIVERS_CPP_HASH', [ | |
| 'oasis_drivers_cpp/**', | |
| ]); | |
| await setHash('OASIS_MESSAGES_HASH', [ | |
| 'oasis_msgs/**', | |
| ]); | |
| await setHash('OASIS_PERCEPTION_CPP_HASH', [ | |
| 'oasis_msgs/**', | |
| 'oasis_perception_cpp/**', | |
| ]); | |
| await setHash('OASIS_RUNTIME_HASH', [ | |
| 'oasis_tooling/scripts/rdepinstall_oasis.sh', | |
| ]); | |
| - name: Restore CMake | |
| id: restore-cmake | |
| if: matrix.os != 'macbook' | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ros-ws/cmake/install | |
| key: > | |
| restore-cmake-\ | |
| ${{ matrix.os }}-\ | |
| ${{ env.CMAKE_HASH }} | |
| - name: Restore OpenCV | |
| id: restore-opencv | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ros-ws/cv/install | |
| key: > | |
| restore-opencv-\ | |
| ${{ matrix.os }}-\ | |
| ${{ env.OPENCV_HASH }}-\ | |
| ${{ env.CMAKE_HASH }} | |
| - name: Restore ROS 2 Desktop | |
| id: restore-ros2-desktop | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ros-ws/ros2-desktop-${{ matrix.ros2_distro }}/install | |
| key: > | |
| restore-ros2-desktop-\ | |
| ${{ matrix.os }}-\ | |
| ${{ matrix.ros2_distro }}-\ | |
| ${{ env.ROS2_DESKTOP_HASH }}-\ | |
| ${{ env.CMAKE_HASH }} | |
| - name: Restore OASIS dependencies | |
| id: restore-oasis-depends | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ros-ws/oasis-depends-${{ matrix.ros2_distro }}/install | |
| key: > | |
| restore-oasis-depends-\ | |
| ${{ matrix.os }}-\ | |
| ${{ matrix.ros2_distro }}-\ | |
| ${{ env.OASIS_DEPENDS_HASH }}-\ | |
| ${{ env.ROS2_DESKTOP_HASH }}-\ | |
| ${{ env.OPENCV_HASH }}-\ | |
| ${{ env.CMAKE_HASH }} | |
| - name: Restore MediaPipe | |
| id: restore-mediapipe | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ros-ws/abseil/install | |
| ros-ws/mediapipe/install | |
| key: > | |
| restore-mediapipe-\ | |
| ${{ matrix.os }}-\ | |
| ${{ env.MEDIAPIPE_HASH }}-\ | |
| ${{ env.OPENCV_HASH }} | |
| - name: Restore Arduino IDE and CLI | |
| id: restore-arduino-tools | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| oasis_avr/arduino-* | |
| ros-ws/arduino-* | |
| ~/.arduino15 | |
| key: > | |
| restore-arduino-tools-\ | |
| ${{ matrix.os }}-\ | |
| ${{ env.ARDUINO_BOOTSTRAP_HASH }} | |
| - name: Restore OASIS AVR | |
| id: restore-oasis-avr | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ros-ws/oasis-${{ matrix.ros2_distro }}/install/share/**/oasis_avr | |
| key: > | |
| restore-oasis-avr-\ | |
| ${{ matrix.os }}-\ | |
| ${{ matrix.ros2_distro }}-\ | |
| ${{ env.CMAKE_HASH }}-\ | |
| ${{ env.ARDUINO_BOOTSTRAP_HASH }}-\ | |
| ${{ env.OASIS_AVR_HASH }} | |
| - name: Restore OASIS drivers_cpp | |
| id: restore-oasis-drivers-cpp | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ros-ws/oasis-${{ matrix.ros2_distro }}/install/include/oasis_drivers_cpp | |
| ros-ws/oasis-${{ matrix.ros2_distro }}/install/lib/oasis_drivers_cpp | |
| ros-ws/oasis-${{ matrix.ros2_distro }}/install/share/**/oasis_drivers_cpp | |
| key: > | |
| restore-oasis-drivers-cpp-\ | |
| ${{ matrix.os }}-\ | |
| ${{ matrix.ros2_distro }}-\ | |
| ${{ env.CMAKE_HASH }}-\ | |
| ${{ env.ROS2_DESKTOP_HASH }}-\ | |
| ${{ env.OASIS_DEPENDS_HASH }}-\ | |
| ${{ env.OASIS_MESSAGES_HASH }}-\ | |
| ${{ env.OASIS_DRIVERS_CPP_HASH }} | |
| - name: Restore OASIS messages | |
| id: restore-oasis-msgs | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ros-ws/oasis-${{ matrix.ros2_distro }}/install/include/oasis_msgs | |
| ros-ws/oasis-${{ matrix.ros2_distro }}/install/lib/liboasis_msgs* | |
| ros-ws/oasis-${{ matrix.ros2_distro }}/install/share/**/oasis_msgs | |
| key: > | |
| restore-oasis-msgs-\ | |
| ${{ matrix.os }}-\ | |
| ${{ matrix.ros2_distro }}-\ | |
| ${{ env.CMAKE_HASH }}-\ | |
| ${{ env.ROS2_DESKTOP_HASH }}-\ | |
| ${{ env.OASIS_MESSAGES_HASH }} | |
| - name: Restore OASIS perception_cpp | |
| id: restore-oasis-perception-cpp | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ros-ws/oasis-${{ matrix.ros2_distro }}/install/include/oasis_perception_cpp | |
| ros-ws/oasis-${{ matrix.ros2_distro }}/install/lib/oasis_perception_cpp | |
| ros-ws/oasis-${{ matrix.ros2_distro }}/install/share/**/oasis_perception_cpp | |
| key: > | |
| restore-oasis-perception-cpp-\ | |
| ${{ matrix.os }}-\ | |
| ${{ matrix.ros2_distro }}-\ | |
| ${{ env.CMAKE_HASH }}-\ | |
| ${{ env.OPENCV_HASH }}-\ | |
| ${{ env.MEDIAPIPE_HASH }}-\ | |
| ${{ env.ROS2_DESKTOP_HASH }}-\ | |
| ${{ env.OASIS_DEPENDS_HASH }}-\ | |
| ${{ env.OASIS_PERCEPTION_CPP_HASH }} | |
| - name: Restore OASIS runtime dependencies | |
| id: restore-oasis-runtime | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ros-ws/oasis-${{ matrix.ros2_distro }}/install/share/oasis_tooling/package.xml | |
| key: > | |
| restore-oasis-runtime-\ | |
| ${{ matrix.os }}-\ | |
| ${{ env.OASIS_RUNTIME_HASH }} | |
| - name: Install CMake dependencies | |
| if: steps.restore-cmake.outputs.cache-hit != 'true' | |
| run: ./oasis_tooling/scripts/depinstall_cmake.sh | |
| - name: Build CMake | |
| if: steps.restore-cmake.outputs.cache-hit != 'true' | |
| run: ./oasis_tooling/scripts/build_cmake.sh | |
| - name: Install OpenCV dependencies | |
| if: steps.restore-opencv.outputs.cache-hit != 'true' | |
| run: ./oasis_tooling/scripts/depinstall_cv.sh | |
| - name: Build OpenCV | |
| if: steps.restore-opencv.outputs.cache-hit != 'true' | |
| run: ./oasis_tooling/scripts/build_cv.sh | |
| - name: Install ROS 2 Desktop dependencies | |
| if: steps.restore-ros2-desktop.outputs.cache-hit != 'true' | |
| run: ./oasis_tooling/scripts/depinstall_ros2_desktop.sh | |
| - name: Build ROS 2 Desktop | |
| if: steps.restore-ros2-desktop.outputs.cache-hit != 'true' | |
| run: ./oasis_tooling/scripts/build_ros2_desktop.sh | |
| - name: Install OASIS dependency rosdeps | |
| if: steps.restore-oasis-depends.outputs.cache-hit != 'true' | |
| run: ./oasis_tooling/scripts/depinstall_oasis_deps.sh | |
| - name: Build OASIS dependencies | |
| if: steps.restore-oasis-depends.outputs.cache-hit != 'true' | |
| run: ./oasis_tooling/scripts/build_oasis_deps.sh | |
| - name: Install MediaPipe dependencies | |
| if: steps.restore-mediapipe.outputs.cache-hit != 'true' | |
| run: ./oasis_tooling/scripts/depinstall_mediapipe.sh | |
| - name: Build MediaPipe | |
| if: steps.restore-mediapipe.outputs.cache-hit != 'true' | |
| run: ./oasis_tooling/scripts/build_mediapipe.sh | |
| - name: Mark cached packages as skipped | |
| run: | | |
| set -euo pipefail | |
| if [ "${{ steps.restore-oasis-avr.outputs.cache-hit }}" = 'true' ]; then | |
| echo "Marking oasis_avr as ignored (cache hit detected)" | |
| touch "oasis_avr/COLCON_IGNORE" | |
| fi | |
| if [ "${{ steps.restore-oasis-drivers-cpp.outputs.cache-hit }}" = 'true' ]; then | |
| echo "Marking oasis_drivers_cpp as ignored (cache hit detected)" | |
| touch "oasis_drivers_cpp/COLCON_IGNORE" | |
| fi | |
| if [ "${{ steps.restore-oasis-perception-cpp.outputs.cache-hit }}" = 'true' ]; then | |
| echo "Marking oasis_perception_cpp as ignored (cache hit detected)" | |
| touch "oasis_perception_cpp/COLCON_IGNORE" | |
| fi | |
| - name: Install OASIS rosdeps | |
| run: ./oasis_tooling/scripts/depinstall_oasis.sh | |
| - name: colcon build | |
| run: | | |
| set -euo pipefail | |
| args=() | |
| if [ "${{ steps.restore-oasis-avr.outputs.cache-hit }}" = 'true' ]; then | |
| echo "Skipping oasis_avr build (cache hit detected)" | |
| args+=(--skip-avr) | |
| fi | |
| if [ "${{ steps.restore-oasis-drivers-cpp.outputs.cache-hit }}" = 'true' ]; then | |
| echo "Skipping oasis_drivers_cpp build (cache hit detected)" | |
| args+=(--skip-drivers-cpp) | |
| fi | |
| if [ "${{ steps.restore-oasis-msgs.outputs.cache-hit }}" = 'true' ]; then | |
| echo "Skipping oasis_msgs build (cache hit detected)" | |
| args+=(--skip-messages) | |
| fi | |
| if [ "${{ steps.restore-oasis-perception-cpp.outputs.cache-hit }}" = 'true' ]; then | |
| echo "Skipping oasis_perception_cpp build (cache hit detected)" | |
| args+=(--skip-perception-cpp) | |
| fi | |
| if [ ${#args[@]} -eq 0 ]; then | |
| echo "No packages skipped; performing full build." | |
| ./oasis_tooling/scripts/build_oasis.sh | |
| else | |
| echo "Running build with skipped packages: ${args[*]}" | |
| ./oasis_tooling/scripts/build_oasis.sh "${args[@]}" | |
| fi | |
| - name: Install OASIS files | |
| run: ./oasis_tooling/scripts/install_oasis.sh | |
| - name: Install OASIS runtime dependencies | |
| if: steps.restore-oasis-runtime.outputs.cache-hit != 'true' | |
| run: ./oasis_tooling/scripts/rdepinstall_oasis.sh | |
| #- name: Upload Ardino hex to /dev/ttyACM0 | |
| # if: matrix.os == 'cinder' | |
| # run: | | |
| # ./oasis_avr/scripts/reset_leonardo.py /dev/ttyACM0 | |
| # sleep 2 | |
| # source oasis_tooling/scripts/env_ros2_desktop.sh && cmake --build "build/oasis_avr" --target upload -- TARGET=firmata_node SERIAL_PORT=/dev/ttyACM0 | |
| # sleep 2 | |
| #- name: Test Ardino | |
| # if: matrix.os == 'cinder' | |
| # run: | | |
| # source install/setup.bash && ros2 run oasis_drivers_py firmata_test |