diff --git a/.github/workflows/wheel_generation.yml b/.github/workflows/wheel_generation.yml new file mode 100644 index 0000000..0493141 --- /dev/null +++ b/.github/workflows/wheel_generation.yml @@ -0,0 +1,85 @@ +name: Wheel Generation + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +env: + PACKAGE_NAME: maliput_malidrive + COLCON_WS: maliput_ws + PYTHON_VERSION: cp38-cp38 + CMAKE_COMMAND_ENV: /opt/_internal/cpython-3.8.18/bin/cmake + RETENTION_DAYS: 7 + + # 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: + manylinux2014: + runs-on: ubuntu-latest + container: + image: ghcr.io/maliput/manylinux2014_maliput:latest + credentials: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + path: ${{ env.COLCON_WS }}/src/${{ env.PACKAGE_NAME }} + # clone public dependencies + - name: git clone maliput + shell: bash + working-directory: ${{ env.COLCON_WS }}/src + run: git clone https://github.com/maliput/maliput + - name: colcon graph + run: /opt/python/${PYTHON_VERSION}/bin/colcon graph + shell: bash + working-directory: ${{ env.COLCON_WS }} + # colcon build + - name: colcon build + shell: bash + working-directory: ${{ env.COLCON_WS }} + run: | + source /colcon_builds/install/setup.bash; + PATH=/opt/python/${PYTHON_VERSION}/bin:$PATH \ + /opt/python/${PYTHON_VERSION}/bin/colcon build --packages-up-to ${PACKAGE_NAME} \ + --cmake-args \ + ' -DWHEEL_GENERATION=On' \ + ' -DBUILD_TESTING=Off' \ + ' -DPython3_EXECUTABLE=/opt/python/${{ env.PYTHON_VERSION }}/bin/python3' \ + --event-handlers=console_direct+ + # List wheel output + - name: list wheel output + shell: bash + working-directory: ${{ env.COLCON_WS }} + run: ls build/${PACKAGE_NAME}/wheel + # Run auditwheel repair + - name: auditwheel repair + shell: bash + working-directory: ${{ env.COLCON_WS }} + run: | + source install/setup.bash; + auditwheel repair \ + --plat manylinux2014_x86_64 \ + --wheel-dir build/${PACKAGE_NAME}/wheel/repaired \ + build/${PACKAGE_NAME}/wheel/*.whl + # List repaired wheel output + - name: list repaired wheel output + shell: bash + working-directory: ${{ env.COLCON_WS }} + run: ls build/${PACKAGE_NAME}/wheel/repaired + # Upload repaired wheel as artifact + - name: upload wheels as artifact + uses: actions/upload-artifact@v3 + with: + name: maliput_malidrive_manylinux2014_x86_64 + path: ${{ env.COLCON_WS }}/build/${{ env.PACKAGE_NAME }}/wheel/repaired + retention-days: ${{ env.RETENTION_DAYS }} diff --git a/CMakeLists.txt b/CMakeLists.txt index a215377..b37d9ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ ############################################################################## cmake_minimum_required(VERSION 3.5 FATAL_ERROR) -project(maliput_malidrive LANGUAGES C CXX VERSION 1.0.0) +project(maliput_malidrive LANGUAGES C CXX VERSION 0.1.4) ############################################################################## # CMake Support @@ -19,7 +19,6 @@ include(GNUInstallDirs) message(STATUS "\n\n====== Finding 3rd Party Packages ======\n") find_package(ament_cmake REQUIRED) -find_package(gflags REQUIRED) find_package(maliput REQUIRED) @@ -76,6 +75,43 @@ else() message(STATUS "Doxygen generation - Disabled") endif() + +############################################################################## +# Wheel +############################################################################## + +if (WHEEL_GENERATION) + include(FetchContent) + message(STATUS "Wheel generation - Enabled") + FetchContent_Declare(python-cmake-wheel + GIT_REPOSITORY "https://github.com/maliput/python-cmake-wheel" + GIT_TAG "main" + GIT_SHALLOW ON) + + FetchContent_GetProperties(python-cmake-wheel) + FetchContent_MakeAvailable(python-cmake-wheel) + list(APPEND CMAKE_MODULE_PATH "${python-cmake-wheel_SOURCE_DIR}") + include(python-wheel) + set(WHEEL_DEPLOY_DIRECTORY "${CMAKE_BINARY_DIR}/wheel") + + set (DEPLOY_FILES "") + list(APPEND DEPLOY_FILES "${PROJECT_SOURCE_DIR}/maliput_malidrive/__init__.py") + # TODO(francocipollone): Deploy the resources folder as well + + add_wheel(road_network + NAME maliput_malidrive + AUTHOR "Franco Cipollone" + URL "https://github.com/maliput/maliput_malidrive" + VERSION "${PROJECT_VERSION}" + DESCRIPTION "OpenDRIVE-based maliput backend." + LICENSE_PATH "${PROJECT_SOURCE_DIR}/LICENSE" + DEPLOY_FILES ${DEPLOY_FILES} + MALIPUT_PLUGIN_ENTRY_POINT "maliput_malidrive = maliput_malidrive:get_plugin_path" + ) +else() + message(STATUS "Wheel generation - Disabled") +endif() + ############################################################################## # Export ############################################################################## diff --git a/maliput_malidrive/__init__.py b/maliput_malidrive/__init__.py new file mode 100644 index 0000000..c9739cf --- /dev/null +++ b/maliput_malidrive/__init__.py @@ -0,0 +1,5 @@ +import os + +def get_plugin_path(): + # return this location. It is expected to be the plugin located in this same location + return os.path.dirname(os.path.abspath(__file__)) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0b94509..96c9d6b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,7 +2,9 @@ # Directories ############################################################################## -add_subdirectory(applications) +if(NOT WHEEL_GENERATION) + add_subdirectory(applications) +endif() add_subdirectory(maliput_malidrive) add_subdirectory(plugin) add_subdirectory(utility) diff --git a/src/applications/CMakeLists.txt b/src/applications/CMakeLists.txt index dd86b14..99d2ec2 100644 --- a/src/applications/CMakeLists.txt +++ b/src/applications/CMakeLists.txt @@ -1,3 +1,5 @@ +find_package(gflags REQUIRED) + add_library(log_level_flag INTERFACE) target_sources( log_level_flag