diff --git a/cross_compile/.github/workflows/build-images.yaml b/cross_compile/.github/workflows/build-images.yaml new file mode 100644 index 0000000..74828df --- /dev/null +++ b/cross_compile/.github/workflows/build-images.yaml @@ -0,0 +1,129 @@ +name: Build Cross-Compiled ROS 2 Images + +on: + push: + branches: [main] + paths-ignore: + - "**.md" + - ".github/ISSUE_TEMPLATE/**" + - ".github/pull_request_template.md" + pull_request: + branches: [main] + paths-ignore: + - "**.md" + - ".github/ISSUE_TEMPLATE/**" + - ".github/pull_request_template.md" + workflow_dispatch: + inputs: + platform: + description: "Target platform" + required: true + type: choice + options: [rk3588] + default: rk3588 + ros_distro: + description: "ROS 2 distribution" + required: true + type: choice + options: [rolling, jazzy, lyrical] + default: lyrical + push_images: + description: "Push built images to registry" + required: false + type: boolean + default: false + +env: + REGISTRY: ghcr.io + IMAGE_NAMESPACE: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-22.04 + strategy: + matrix: + platform: [rk3588] + ros_distro: [rolling] + fail-fast: false + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + driver-opts: | + network=host + + - name: Log in to GitHub Container Registry + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push_images) + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # ── Stage 1: Build base image ────────────────────────────────────── + - name: Build cc-base + run: | + docker compose build cc-base + + - name: Push cc-base + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push_images) + run: | + docker tag cc-base:latest \ + ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/cc-base:latest + docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/cc-base:latest + + # ── Stage 2: Build toolchain image per platform ──────────────────── + - name: Build cc-toolchain (${{ matrix.platform }}) + run: | + PLATFORM=${{ matrix.platform }} docker compose build cc-toolchain + env: + BUILDKIT_INLINE_CACHE: "1" + + - name: Push cc-toolchain + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push_images) + run: | + docker tag ${{ matrix.platform }}/cc-toolchain:latest \ + ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.platform }}/cc-toolchain:latest + docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.platform }}/cc-toolchain:latest + + # ── Stage 3: Build vendor packages ───────────────────────────────── + - name: Build vendor-packages (${{ matrix.platform }}) + run: | + PLATFORM=${{ matrix.platform }} docker compose build vendor-packages + env: + BUILDKIT_INLINE_CACHE: "1" + + - name: Push vendor-packages + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push_images) + run: | + docker tag ${{ matrix.platform }}/cc-vendor-packages:latest \ + ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.platform }}/cc-vendor-packages:latest + docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.platform }}/cc-vendor-packages:latest + + # ── Stage 4: Build ROS 2 per distro ──────────────────────────────── + - name: Build ROS 2 (${{ matrix.ros_distro }}) + run: | + PLATFORM=${{ matrix.platform }} ROS_DISTRO=${{ matrix.ros_distro }} docker compose build ros2 + env: + BUILDKIT_INLINE_CACHE: "1" + + - name: Push ROS 2 image + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.push_images) + run: | + docker tag ${{ matrix.platform }}/cc-ros-${{ matrix.ros_distro }}:latest \ + ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.platform }}/cc-ros-${{ matrix.ros_distro }}:latest + docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.platform }}/cc-ros-${{ matrix.ros_distro }}:latest + + # ── Summary ─────────────────────────────────────────────────────── + - name: Image summary + if: always() + run: | + echo "### Built Images :rocket:" >> $GITHUB_STEP_SUMMARY + docker images \ + --filter "reference=cc-*" \ + --format "| \`{{.Repository}}:{{.Tag}}\` | {{.Size}} |" \ + >> $GITHUB_STEP_SUMMARY diff --git a/cross_compile/ros2/lyrical/ros_lyrical.Dockerfile b/cross_compile/ros2/lyrical/ros_lyrical.Dockerfile index 8f66d65..28eedb4 100644 --- a/cross_compile/ros2/lyrical/ros_lyrical.Dockerfile +++ b/cross_compile/ros2/lyrical/ros_lyrical.Dockerfile @@ -26,7 +26,8 @@ RUN patch -p1 -d /workspace/src/ros2/rclcpp < /workspace/patch/memory_strategy.p RUN touch src/ros2/geometry2/tf2_bullet/COLCON_IGNORE \ && touch src/ros2/rosbag2/rosbag2_storage_sqlite3/COLCON_IGNORE \ - && touch src/ros-perception/image_transport_plugins/theora_image_transport/COLCON_IGNORE + && touch src/ros-perception/image_transport_plugins/theora_image_transport/COLCON_IGNORE \ + && touch src/diagnostics/diagnostic_remote_logging/COLCON_IGNORE RUN MAKEFLAGS="-j6" colcon build \ --executor parallel \