Skip to content

Commit

Permalink
Imported upstream version '1.2.1' of 'upstream'
Browse files Browse the repository at this point in the history
  • Loading branch information
immel-f committed May 10, 2023
1 parent ee1e13a commit dc1f2ce
Show file tree
Hide file tree
Showing 45 changed files with 1,756 additions and 612 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.dockerignore
Dockerfile

.github
65 changes: 65 additions & 0 deletions .github/conan_dockerfile/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Uses gcc8 for glibc 2.28
ARG FROM=conanio/gcc10:latest
FROM ${FROM} AS lanelet2_conan_deps

ENV DEBIAN_FRONTEND noninteractive

# install requirements for python installation
RUN sudo -E apt-get update \
&& sudo -E apt-get install -y libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl \
libncursesw5-dev xz-utils libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

# setup python environment
ARG PY_VERSION=3.8
RUN pyenv install -s $PY_VERSION \
&& pyenv global $PY_VERSION
RUN pip install "conan==1.59.0" catkin_pkg numpy wheel auditwheel cmake

# install patchelf
RUN wget https://github.com/NixOS/patchelf/releases/download/0.17.2/patchelf-0.17.2-x86_64.tar.gz \
&& tar -xzf patchelf-0.17.2-x86_64.tar.gz \
&& sudo -E ln -s $HOME/bin/patchelf /bin/patchelf \
&& patchelf --version

# setup conan for python dependencies via bincrafters remote
RUN conan remote add bincrafters https://bincrafters.jfrog.io/artifactory/api/conan/public-conan \
&& conan config set general.revisions_enabled=1


FROM lanelet2_conan_deps as lanelet2_conan_src

# checkout code
RUN mkdir src
WORKDIR /home/conan/src
COPY --chown=1000:1001 . lanelet2/

FROM lanelet2_conan_src as lanelet2_conan

# compile
ARG CONAN_ARGS=""
WORKDIR /home/conan/src/lanelet2
RUN conan create . lanelet2/stable --build=missing ${CONAN_ARGS} \
&& export LANELET2_VERSION=$(conan inspect . --raw version) \
&& echo "Lanelet2 version: $LANELET2_VERSION" \
&& conan install lanelet2/$LANELET2_VERSION@lanelet2/stable --build=missing -g virtualenv
FROM lanelet2_conan as lanelet2_conan_with_pip_wheel

SHELL ["/bin/bash", "-c"]
WORKDIR /home/conan
RUN source /home/conan/src/lanelet2/activate.sh \
&& LANELET2_PACKAGE_DIR=$(python -c "import lanelet2; from pathlib import Path; print(Path(lanelet2.__file__).parent)") \
&& cp -r $LANELET2_PACKAGE_DIR .
RUN export LANELET2_VERSION=$(conan inspect ./src/lanelet2 --raw version) \
&& echo "Lanelet2 version: $LANELET2_VERSION" \
&& sed 's/{{ version }}/'"$LANELET2_VERSION"'/' /home/conan/src/lanelet2/lanelet2_python/setup.py.template > /home/conan/setup.py

ARG PLATFORM="manylinux_2_31_x86_64"
RUN source /home/conan/src/lanelet2/activate.sh \
&& pip wheel -w broken-dist/ . \
&& auditwheel repair -w dist/ --plat ${PLATFORM} broken-dist/*.whl

# to extract the wheel manually run:
# $ docker run -it -v /path/to/some/local/folder:/dist <image> /bin/bash
# then inside the container:
# $ sudo cp dist/lanelet2-<...>.whl /dist/.
124 changes: 124 additions & 0 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Lanelet2 CD

on:
push:
branches:
- master
tags:
- '*'
workflow_dispatch:

permissions:
contents: write

jobs:
build:
strategy:
matrix:
# this should be kept in sync with ci.yaml
python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- python-version: "3.8"
boost-version: "1.75.0"
platform-version: manylinux_2_27_x86_64
image-version: conanio/gcc7:latest
- python-version: "3.9"
boost-version: "1.75.0"
platform-version: manylinux_2_27_x86_64
image-version: conanio/gcc7:latest
- python-version: "3.10"
boost-version: "1.81.0"
platform-version: manylinux_2_31_x86_64
image-version: conanio/gcc10:latest
- python-version: "3.11"
boost-version: "1.81.0"
platform-version: manylinux_2_31_x86_64
image-version: conanio/gcc10:latest
runs-on: ubuntu-latest
steps:
- name: Setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Create build container
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
file: .github/conan_dockerfile/Dockerfile
tags: lanelet2_conan_with_pip_wheel
load: true
target: lanelet2_conan_with_pip_wheel
build-args: |
FROM=${{ matrix.image-version }}
PY_VERSION=${{ matrix.python-version }}
PLATFORM=${{ matrix.platform-version }}
CONAN_ARGS=--require-override=boost/${{ matrix.boost-version }}
- name: Create output directory
run: mkdir -p ${{ github.workspace }}/output

- name: Package lanelet2 in build container
uses: addnab/docker-run-action@v3
with:
image: lanelet2_conan_with_pip_wheel
shell: bash
options: -v ${{ github.workspace }}/dist:/dist
run: |
set -e
# set env variables
export HOME=/home/conan
# copy wheel to dist directory
sudo cp -r $HOME/dist/* /dist
- name: Store wheel
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/

test:
needs: build
strategy:
matrix:
# test only on currently supported version
python-version: ["3.8", "3.9", "3.10", "3.11"]
os: ["ubuntu-22.04", "ubuntu-20.04"]
runs-on: ${{ matrix.os }}
steps:
- name: Restore wheel
uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install wheel
# use dist/ directory as package source instead of pypi.org
run: pip install lanelet2 --no-index --find-links dist/
- name: Test wheel
run: python -c "import lanelet2; assert lanelet2.core.Point2d(0, 0, 0) is not None"

publish:
if: contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [build, test]
steps:
- name: Restore wheel
uses: actions/download-artifact@v3
with:
name: dist
path: dist/

- name: Release
uses: softprops/action-gh-release@v1
with:
files: dist/*

- name: Publish package to PyPI
if: github.repository == 'fzi-forschungszentrum-informatik/Lanelet2'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
45 changes: 45 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,48 @@ jobs:
coverage-files: ./lcov/full_coverage.lcov
artifact-name: code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}

full_conan_installation:
needs: lint
strategy:
matrix:
# to reach 2_27, we need a gcc7.
# to build python>3.10, we need boost>1.75.
# to build boost>1.81 we need a gcc>10.
python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- python-version: "3.8"
boost-version: "1.75.0"
platform-version: manylinux_2_27_x86_64
image-version: conanio/gcc7:latest
- python-version: "3.9"
boost-version: "1.75.0"
platform-version: manylinux_2_27_x86_64
image-version: conanio/gcc7:latest
- python-version: "3.10"
boost-version: "1.81.0"
platform-version: manylinux_2_31_x86_64
image-version: conanio/gcc10:latest
- python-version: "3.11"
boost-version: "1.81.0"
platform-version: manylinux_2_31_x86_64
image-version: conanio/gcc10:latest
runs-on: ubuntu-latest
steps:
- name: Setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Build dependencies
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
file: .github/conan_dockerfile/Dockerfile
tags: lanelet2_conan_with_pip_wheel
load: true
target: lanelet2_conan_with_pip_wheel
build-args: |
FROM=${{ matrix.image-version }}
PY_VERSION=${{ matrix.python-version }}
PLATFORM=${{ matrix.platform-version }}
CONAN_ARGS=--require-override=boost/${{ matrix.boost-version }}
39 changes: 35 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
# Lanelet2

| [ROS focal/noetic](https://build.ros.org/job/Ndev__lanelet2__ubuntu_focal_amd64/lastBuild) | [ROS focal/foxy](https://build.ros2.org/job/Fdev__lanelet2__ubuntu_focal_amd64/lastBuild) | Gitlab CI | Coverage |
| --------- | --------- | -------- | -------- |
| [![](https://build.ros.org/job/Ndev__lanelet2__ubuntu_focal_amd64/lastBuild/badge/icon)](https://build.ros.org/job/Ndev__lanelet2__ubuntu_focal_amd64/lastBuild) | [![](https://build.ros2.org/job/Fdev__lanelet2__ubuntu_focal_amd64/lastBuild//badge/icon)](https://build.ros2.org/job/Fdev__lanelet2__ubuntu_focal_amd64/lastBuild) | ![build](https://www.mrt.kit.edu/z/gitlab/lanelet2/pipeline.svg) | ![coverage](https://www.mrt.kit.edu/z/gitlab/lanelet2/coverage.svg) |
[![CI](https://github.com/fzi-forschungszentrum-informatik/lanelet2/actions/workflows/ci.yaml/badge.svg)](
https://github.com/fzi-forschungszentrum-informatik/lanelet2/actions/workflows/ci.yaml)
[![CD](https://github.com/fzi-forschungszentrum-informatik/lanelet2/actions/workflows/cd.yaml/badge.svg)](
https://github.com/fzi-forschungszentrum-informatik/lanelet2/actions/workflows/cd.yaml)
[![Build Status ROS focal/noetic](https://build.ros.org/job/Ndev__lanelet2__ubuntu_focal_amd64/lastBuild/badge/icon?subject=ROS%20noetic%20%28on%20focal%29)](
https://build.ros.org/job/Ndev__lanelet2__ubuntu_focal_amd64/lastBuild/)
[![Build Status ROS2 focal/foxy](https://build.ros2.org/job/Fdev__lanelet2__ubuntu_focal_amd64/lastBuild/badge/icon?subject=ROS2%20foxy%20%28on%20focal%29)](
https://build.ros2.org/job/Fdev__lanelet2__ubuntu_focal_amd64/lastBuild/)
[![Build Status ROS2 jammy/humble](https://build.ros2.org/job/Hdev__lanelet2__ubuntu_jammy_amd64/lastBuild/badge/icon?subject=ROS2%20humble%20%28on%20jammy%29)](
https://build.ros2.org/job/Hdev__lanelet2__ubuntu_jammy_amd64/lastBuild/)
[![PyPI Downloads](https://img.shields.io/pypi/dm/lanelet2.svg?label=PyPI%20downloads)](
https://pypi.org/project/lanelet2/)

## Overview

Expand Down Expand Up @@ -43,6 +52,29 @@ Lanelet2 has been released for ROS. Just install `ros-[distribution]-lanelet2`,
sudo apt install ros-noetic-lanelet2
```

### Without ROS
Outside of ROS, Lanelet2 can be installed from PyPI. Note that currently only Python 3.8-3.11 linux builds are available and that Python 3.10+ is only supported for recent linux distributions such as Ubuntu 20.04+.
```
pip install lanelet2
```
#### Note:

If you receive the error

```
ERROR: Could not find a version that satisfies the requirement lanelet2 (from versions: none)
ERROR: No matching distribution found for lanelet2
```

during installation, even when using e.g. python 3.9 or 3.8 on a somewhat recent linux such as Ubuntu 18.04 or newer, your pip version is probably too old,
as e.g. the pip version that comes with apt on Ubuntu 20.04 (20.0.2) is not recent enough for the provided package.

In this case you need to simply update pip with

```
pip3 install -U pip
```

### Using Docker

There is a Docker container from which you can test things out:
Expand Down Expand Up @@ -167,4 +199,3 @@ If you are using Lanelet2 for scientific research, we would be pleased if you wo
}
```


13 changes: 8 additions & 5 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
conan_basic_setup(SKIP_STD)
# hint to gtest
set(GOOGLETEST_VERSION 1.0.0)
set(MRT_GTEST_DIR ${CMAKE_CURRENT_LIST_DIR})
enable_testing()
Expand Down Expand Up @@ -69,11 +70,13 @@ class Lanelet2Conan(ConanFile):
options = {"shared": [True, False], "fPIC": [True]}
default_options = {"shared": True, "fPIC": True, "boost:shared": True, "boost:python_version": get_py_version(), "boost:without_python": False, "python_dev_config:python": get_py_exec()}

requires = ("python_dev_config/0.6@bincrafters/stable",
"boost/1.75.0",
"eigen/3.3.9",
"geographiclib/1.50.1",
"pugixml/1.11")
requires = (
"python_dev_config/0.6@bincrafters/stable",
"boost/[>=1.75.0 <=1.81.0]",
"eigen/3.4.0",
"geographiclib/1.52",
"pugixml/1.13",
)

exports_sources = "*"
exports = "lanelet2_core/package.xml"
Expand Down
3 changes: 3 additions & 0 deletions lanelet2/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Changelog for package lanelet2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1.2.1 (2023-05-10)
------------------

1.2.0 (2023-01-30)
------------------
* Add CI using GitHub Actions (`#256 <https://github.com/fzi-forschungszentrum-informatik/Lanelet2/issues/256>`_)
Expand Down
2 changes: 1 addition & 1 deletion lanelet2/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>lanelet2</name>
<version>1.2.0</version>
<version>1.2.1</version>
<description>Meta-package for lanelet2</description>

<license>BSD</license>
Expand Down
6 changes: 6 additions & 0 deletions lanelet2_core/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Changelog for package lanelet2_core
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1.2.1 (2023-05-10)
------------------
* Update thirdparty deps, rework projected point, enable python 3.10/3.11 (`#300 <https://github.com/immel-f/Lanelet2/issues/300>`_)
* Fix typos in documentation (`#286 <https://github.com/immel-f/Lanelet2/issues/286>`_)
* Contributors: Johannes Schmitz, poggenhans

1.2.0 (2023-01-30)
------------------
* Add zero-width character after colon to avoid markdown emoji
Expand Down
Loading

0 comments on commit dc1f2ce

Please sign in to comment.