-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python wheels for AD Map library (#60)
* Added python wheels build * Publishing to pypi on Release * Removed static linking on general python build and remove the additional not required module shared library Co-authored-by: Bernd Gassmann <bernd.gassmann@intel.com>
- Loading branch information
1 parent
2f7d2f2
commit 78a4c01
Showing
29 changed files
with
566 additions
and
432 deletions.
There are no files selected for viewing
This file contains 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 file contains 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 file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Build and Publish wheels for AD-Map Library | ||
|
||
on: | ||
release: | ||
types: [published] | ||
push: | ||
branches: master | ||
pull_request: | ||
branches: master | ||
|
||
jobs: | ||
wheels: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python_binding_version: [2.7, 3.6, 3.7, 3.8] | ||
container: | ||
image: joelmb/map:${{ matrix.python_binding_version }} | ||
env: | ||
WHEEL_PLATFORM: manylinux_2_27_x86_64 | ||
PYTHON_BINDING_VERSION: ${{ matrix.python_binding_version }} | ||
steps: | ||
# We currently cannot use checkout@v2 because git version on the docker images is below 2.18 | ||
- uses: actions/checkout@v1 | ||
with: | ||
fetch-depth: 1 | ||
submodules: true | ||
- name: Build wheels | ||
run: | | ||
colcon build --packages-up-to ad_map_access --meta colcon_python.meta --event-handlers console_direct+ --cmake-args -DPYTHON_BINDING_VERSION=${PYTHON_BINDING_VERSION} | ||
- name: Repair wheels | ||
shell: bash | ||
run: | | ||
source install/setup.bash | ||
for whl in install/ad_physics/dist/*.whl; do | ||
auditwheel repair $whl --plat ${WHEEL_PLATFORM} --wheel-dir wheelhouse | ||
done | ||
for whl in install/ad_map_access/dist/*.whl; do | ||
auditwheel repair $whl --plat ${WHEEL_PLATFORM} --wheel-dir wheelhouse | ||
done | ||
- name: Publish wheels to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: ${{ github.event_name == 'release'}} | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
packages_dir: wheelhouse/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
ARG PYTHON_BINDING_VERSION | ||
|
||
FROM ubuntu:18.04 AS ubuntu | ||
|
||
ARG PYTHON_BINDING_VERSION | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
ca-certificates \ | ||
cmake \ | ||
git \ | ||
unzip \ | ||
wget \ | ||
autoconf \ | ||
automake \ | ||
castxml \ | ||
libpugixml-dev && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN \ | ||
if [ ${PYTHON_BINDING_VERSION} = "2.7" ]; then \ | ||
PYTHON3_VERSION=3.6 ; \ | ||
else \ | ||
PYTHON3_VERSION=${PYTHON_BINDING_VERSION} ; \ | ||
fi ; \ | ||
# Install python libraries | ||
apt-get update && apt-get install -y --no-install-recommends \ | ||
python$PYTHON3_VERSION-dev \ | ||
python3-pip \ | ||
python-dev \ | ||
python-pip \ | ||
&& rm -rf /var/lib/apt/lists/* ; \ | ||
# Install python packages | ||
python$PYTHON3_VERSION -m pip install --upgrade pip ; \ | ||
python$PYTHON3_VERSION -m pip install setuptools ; \ | ||
python$PYTHON3_VERSION -m pip install wheel auditwheel twine pygccxml pyplusplus colcon-common-extensions ; \ | ||
if [ "$PYTHON_BINDING_VERSION" = "2.7" ]; then \ | ||
python2.7 -m pip install --upgrade pip; \ | ||
python2.7 -m pip install setuptools; \ | ||
python2.7 -m pip install install wheel pygccxml pyplusplus; \ | ||
fi | ||
|
||
WORKDIR /workspace | ||
|
||
COPY ./utils . | ||
|
||
RUN bash install_patchelf.sh | ||
RUN bash install_boost.sh --python-version $PYTHON_BINDING_VERSION | ||
|
||
ENV LD_LIBRARY_PATH "$LD_LIBRARY_PATH:/usr/local/lib" | ||
|
||
CMD ["/bin/bash"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
DOC_STRING="Build Docker image for building manylinux wheels." | ||
|
||
USAGE_STRING=$(cat <<- END | ||
Usage: $0 [-h|--help] [-p|--python-version PYTHON_VERSION] | ||
The following python versions are supported: | ||
* 2.7 | ||
* 3.6 | ||
* 3.7 | ||
* 3.8 | ||
END | ||
) | ||
|
||
usage() { echo "${DOC_STRING}"; echo "${USAGE_STRING}"; exit 1; } | ||
|
||
# Defaults | ||
PYTHON_VERSION="3.6" | ||
|
||
while [[ $# -gt 0 ]]; do | ||
case "$1" in | ||
-p |--python-version ) | ||
PYTHON_VERSION=$2 | ||
if [ "${PYTHON_VERSION}" != "2.7" ] && [ "${PYTHON_VERSION}" != "3.6" ] && [ "${PYTHON_VERSION}" != "3.7" ] && [ "${PYTHON_VERSION}" != "3.8" ]; then | ||
usage | ||
fi | ||
shift 2 ;; | ||
-h | --help ) | ||
usage | ||
;; | ||
* ) | ||
shift ;; | ||
esac | ||
done | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
docker build \ | ||
-t map:${PYTHON_VERSION} \ | ||
-f Dockerfile ${SCRIPT_DIR} \ | ||
--build-arg PYTHON_BINDING_VERSION=${PYTHON_VERSION} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
DOC_STRING="Run Docker image for building manylinux wheels." | ||
|
||
USAGE_STRING=$(cat <<- END | ||
Usage: $0 [-h|--help] [-p|--python-version PYTHON_VERSION] | ||
The following python versions are supported: | ||
* 2.7 | ||
* 3.6 | ||
* 3.7 | ||
* 3.8 | ||
END | ||
) | ||
|
||
usage() { echo "${DOC_STRING}"; echo "${USAGE_STRING}"; exit 1; } | ||
|
||
# Defaults | ||
PYTHON_VERSION="3.6" | ||
|
||
while [[ $# -gt 0 ]]; do | ||
case "$1" in | ||
-p |--python-version ) | ||
PYTHON_VERSION=$2 | ||
if [ "${PYTHON_VERSION}" != "2.7" ] && [ "${PYTHON_VERSION}" != "3.6" ] && [ "${PYTHON_VERSION}" != "3.7" ] && [ "${PYTHON_VERSION}" != "3.8" ]; then | ||
usage | ||
fi | ||
shift 2 ;; | ||
-h | --help ) | ||
usage | ||
;; | ||
* ) | ||
shift ;; | ||
esac | ||
done | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
docker run \ | ||
-it \ | ||
--rm \ | ||
-v ${SCRIPT_DIR}/../../../..:/workspace/map \ | ||
map:${PYTHON_VERSION} /bin/bash |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
|
||
BOOST_VERSION=1.72.0 | ||
BOOST_BASENAME="boost-${BOOST_VERSION}" | ||
BOOST_PACKAGE_BASENAME=boost_${BOOST_VERSION//./_} | ||
|
||
DOC_STRING="Build boost." | ||
|
||
USAGE_STRING=$(cat <<- END | ||
Usage: $0 [-h|--help] [-p|--python-version PYTHON_VERSION] | ||
The following python versions are supported: | ||
* 2.7 | ||
* 3.6 | ||
* 3.7 | ||
* 3.8 | ||
END | ||
) | ||
|
||
usage() { echo "${DOC_STRING}"; echo "${USAGE_STRING}"; exit 1; } | ||
|
||
# Defaults | ||
PYTHON_VERSION="3.6" | ||
|
||
while [[ $# -gt 0 ]]; do | ||
case "$1" in | ||
-p |--python-version ) | ||
PYTHON_VERSION=$2 | ||
if [ "${PYTHON_VERSION}" != "2.7" ] && [ "${PYTHON_VERSION}" != "3.6" ] && [ "${PYTHON_VERSION}" != "3.7" ] && [ "${PYTHON_VERSION}" != "3.8" ]; then | ||
usage | ||
fi | ||
shift 2 ;; | ||
-h | --help ) | ||
usage | ||
;; | ||
* ) | ||
shift ;; | ||
esac | ||
done | ||
|
||
wget "https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION}/source/${BOOST_PACKAGE_BASENAME}.tar.gz" || true | ||
|
||
tar -xzf ${BOOST_PACKAGE_BASENAME}.tar.gz | ||
|
||
pushd ${BOOST_PACKAGE_BASENAME} >/dev/null | ||
|
||
BOOST_CFLAGS="-fPIC -std=c++14 -DBOOST_ERROR_CODE_HEADER_ONLY" | ||
|
||
py="/usr/bin/env python${PYTHON_VERSION}" | ||
py_root=`${py} -c "import sys; print(sys.prefix)"` | ||
pyv=`$py -c "import sys;x='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(x)";` | ||
./bootstrap.sh \ | ||
--with-libraries=python,filesystem,system,program_options \ | ||
--with-python=${py} --with-python-root=${py_root} | ||
|
||
echo "using python : ${pyv} : ${py_root}/bin/python${PYTHON_VERSION} ;" > project-config.jam | ||
|
||
./b2 install | ||
|
||
popd >/dev/null | ||
|
||
rm -rf ${BOOST_PACKAGE_BASENAME} | ||
rm -rf ${BOOST_PACKAGE_BASENAME}.tar.gz |
Oops, something went wrong.