Skip to content

Commit

Permalink
Adds manylinux-based docker image for maliput wheel creation (#315)
Browse files Browse the repository at this point in the history
Signed-off-by: Franco Cipollone <[email protected]>
  • Loading branch information
francocipollone authored Oct 24, 2023
1 parent 3a3f582 commit 570471a
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ name: gcc

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
schedule:
- cron: '0 9 * * *' # 9:00am UTC, 1:00am PST.
Expand All @@ -14,6 +18,11 @@ env:
UBUNTU_NAME: focal
UBUNTU_VERSION: 20.04

# Cancel previously running PR jobs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
compile_and_test:
name: Compile and test
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/maliput_full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: maliput_full_build

on:
push:
branches:
- main
pull_request:
branches:
- main
Expand All @@ -13,6 +15,11 @@ env:
PACKAGE_NAME: maliput_full
ROS_DISTRO: foxy

# Cancel previously running PR jobs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
compile_and_test:
name: Build
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/manylinux_image_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: manylinux-maliput image

on:
workflow_dispatch:
pull_request:
types: [labeled]

jobs:
build_and_push:
if: ${{ contains(github.event.pull_request.labels.*.name, 'do-manylinux-image-build') || github.event_name == 'workflow_dispatch'}}
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Login to GitHub Container Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin

- name: Build and tag Docker image
working-directory: wheel_generation/
run: |
docker build -t ghcr.io/${{ github.repository_owner }}/manylinux2014_maliput:latest .
- name: Push Docker image to GHCR
run: docker push ghcr.io/${{ github.repository_owner }}/manylinux2014_maliput:latest
69 changes: 69 additions & 0 deletions wheel_generation/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
FROM quay.io/pypa/manylinux2014_x86_64

##########################################################################
# General setup
##########################################################################
RUN echo "export PATH=/opt/python/cp38-cp38/bin:\$PATH" >> /root/.bashrc
RUN export PATH=/opt/python/cp38-cp38/bin:$PATH

##########################################################################
# Install prerequisites.
##########################################################################

# colcon.
RUN /opt/python/cp38-cp38/bin/pip install colcon-common-extensions
RUN /opt/python/cp38-cp38/bin/pip install python-dev-tools

##########################################################################
# Install CMake dependencies
##########################################################################

# yaml-cpp
WORKDIR /source_builds/
RUN git clone -b yaml-cpp-0.7.0 https://github.com/jbeder/yaml-cpp.git yaml-cpp
WORKDIR /source_builds/yaml-cpp/build
RUN cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release .. && make -j$(nproc) && make install

# tinyxml2
WORKDIR /source_builds/
RUN git clone -b 7.1.0 https://github.com/leethomason/tinyxml2.git tinyxml2
WORKDIR /source_builds/tinyxml2/build
RUN cmake -DCMAKE_BUILD_TYPE=Release .. && make -j$(nproc) && make install

# pybind11
# See https://pybind11.readthedocs.io/en/stable/installing.html#include-with-pypi
# pybind11 (global) for pybind11 available directly in your environment root, e.g. /usr/local
# This brings a different version as the one used in ROS Foxy (2.4.3) however the global version isn't provided
# in the latter.
RUN /opt/python/cp38-cp38/bin/pip install "pybind11[global]==2.11.1"

##########################################################################
# Install Colcon packages
##########################################################################

WORKDIR /colcon_builds/src/

# ament_cmake
RUN git clone -b foxy https://github.com/ament/ament_cmake.git

# ament_package
RUN git clone -b foxy https://github.com/ament/ament_package.git

# eigen3_cmake_module
RUN yum install eigen3 -y
RUN git clone -b foxy https://github.com/ros2/eigen3_cmake_module.git

# Build colcon packages
WORKDIR /colcon_builds/
RUN PATH=/opt/python/cp38-cp38/bin:$PATH /opt/python/cp38-cp38/bin/colcon build --cmake-args " -DBUILD_TESTING=Off"
RUN source /colcon_builds/install/setup.bash
RUN echo "source /colcon_builds/install/setup.bash" >> /root/.bashrc

##########################################################################
# Final config
##########################################################################

RUN mkdir -p /ws/src
WORKDIR /ws

CMD ["/bin/bash"]
23 changes: 23 additions & 0 deletions wheel_generation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Wheel generation

### Summary

A dockerfile is provided for creating a [manylinux](https://github.com/pypa/manylinux)-compatible wheels of maliput packages.


It is based on the `quay.io/pypa/manylinux2014_x86_64` image (See [manylinux#docker_images](https://github.com/pypa/manylinux#docker-images)) and adds the corresponding dependencies to build `maliput` packages.

It is verified for the following packages:
- maliput
- maliput_py
- maliput_malidrive

### Usage

```
docker build -t maliput_manylinux2014 .
```

```
docker run --rm -it maliput_manylinux2014 bash
```

0 comments on commit 570471a

Please sign in to comment.