Add Mac OS wheel build action (#69) #74
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
name: Python Wheels | |
on: | |
push: | |
branches: | |
- master | |
- 'dev**' | |
pull_request: | |
release: | |
types: | |
- created | |
env: | |
VCPKG_PKGS: >- | |
boost-dll boost-program-options | |
boost-serialization boost-filesystem | |
tinyxml2 console-bridge assimp | |
urdfdom octomap orocos-kdl pcl | |
gtest benchmark flann jsoncpp | |
yaml-cpp eigen3 | |
openblas | |
fcl ompl taskflow | |
bullet3[multithreading,double-precision,rtti] | |
ccd[double-precision] gperftools | |
jobs: | |
build-ubuntu: | |
runs-on: ${{ matrix.config.runs_on }} | |
container: ${{ matrix.config.container }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- os: ubuntu-20.04 | |
runs_on: ubuntu-20.04 | |
container: ubuntu:20.04 | |
py_platform: manylinux_2_31_x86_64 | |
python_version: "3.7" | |
docs: false | |
docs_cmake: OFF | |
- os: ubuntu-20.04 | |
runs_on: ubuntu-20.04 | |
container: ubuntu:20.04 | |
py_platform: manylinux_2_31_x86_64 | |
python_version: "3.8" | |
docs: true | |
docs_cmake: ON | |
- os: ubuntu-20.04 | |
runs_on: ubuntu-20.04 | |
container: ubuntu:20.04 | |
py_platform: manylinux_2_31_x86_64 | |
python_version: "3.9" | |
docs: true | |
docs_cmake: ON | |
- os: ubuntu-20.04 | |
runs_on: ubuntu-20.04 | |
container: ubuntu:20.04 | |
py_platform: manylinux_2_31_x86_64 | |
python_version: "3.10" | |
docs: true | |
docs_cmake: ON | |
- os: ubuntu-20.04 | |
runs_on: ubuntu-20.04 | |
container: ubuntu:20.04 | |
py_platform: manylinux_2_31_x86_64 | |
python_version: "3.11.0" | |
docs: true | |
docs_cmake: ON | |
- os: ubuntu-20.04 | |
runs_on: ubuntu-20.04 | |
container: ubuntu:20.04 | |
py_platform: manylinux_2_31_x86_64 | |
python_version: "3.12.0" | |
docs: true | |
docs_cmake: ON | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
path: ws/src/tesseract_python | |
- name: install sudo, tzdata, keyboard-configuration | |
shell: bash | |
run: | | |
echo -en "XKBMODEL=\"pc105\"\nXKBLAYOUT=\"us\"\nXKBVARIANT=\"\"\nXKBOPTIONS=\"\"\nBACKSPACE=\"guess\"\n" > /etc/default/keyboard | |
apt update | |
apt install sudo tzdata python3 keyboard-configuration -y -qq | |
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime | |
dpkg-reconfigure --frontend noninteractive tzdata | |
- name: apt | |
run: > | |
sudo apt-get install python3-pip libboost-all-dev | |
libeigen3-dev libtinyxml2-dev libconsole-bridge-dev libassimp-dev | |
liburdfdom-dev liboctomap-dev liborocos-kdl-dev libpcl-dev | |
libflann-dev libjsoncpp-dev libyaml-cpp-dev git cmake ninja-build | |
build-essential autoconf automake libtool bison libpcre2-dev libpcre3-dev | |
lcov libbullet-dev libbullet-extras-dev python3-venv curl -y -qq | |
- name: build-swig | |
uses: johnwason/swig-build-action@v1 | |
with: | |
cache-key: ${{ matrix.config.os }}-${{ matrix.config.python_version }} | |
version: "4.1.1" | |
- uses: actions/setup-python@v4 | |
id: setup-python | |
with: | |
python-version: '${{ matrix.config.python_version }}' | |
- name: pip | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install auditwheel wheel numpy setuptools colcon-common-extensions vcstool patchelf | |
- name: pip | |
if: matrix.config.docs == true | |
run: | | |
python -m pip install -r ws/src/tesseract_python/docs/requirements.txt | |
- name: vcs import | |
working-directory: ws/src | |
run: vcs import --input tesseract_python/dependencies_with_ext.rosinstall | |
- name: colcon build | |
working-directory: ws | |
run: > | |
colcon build --packages-up-to tesseract_python --merge-install | |
--cmake-force-configure | |
--packages-ignore bullet | |
--event-handlers console_cohesion+ | |
--cmake-args -DCMAKE_BUILD_TYPE=Release | |
-DBUILD_IPOPT=OFF -DBUILD_SNOPT=OFF | |
-DPYTHON_EXECUTABLE="${{ steps.setup-python.outputs.python-path }}" | |
-DTESSERACT_PYTHON_BUILD_WHEEL=ON | |
-DTESSERACT_PYTHON_WHEEL_PLATFORM=${{ matrix.config.py_platform }} | |
-DTESSERACT_ENABLE_EXAMPLES=OFF -DTESSERACT_PLUGIN_FACTORY_CALLBACKS=ON | |
-DTESSERACT_PYTHON_BUILD_DOCUMENTATION=${{ matrix.config.docs_cmake }} | |
- name: test | |
shell: bash | |
run: | | |
python3 -m venv venv | |
source venv/bin/activate | |
python -m pip install --upgrade pip | |
python -m pip install ws/build/tesseract_python/python/wheelhouse/* | |
python -m pip install pytest | |
export TESSERACT_SUPPORT_DIR=$GITHUB_WORKSPACE/ws/src/tesseract/tesseract_support | |
export TESSERACT_TASK_COMPOSER_DIR=$GITHUB_WORKSPACE/ws/src/tesseract_planning/tesseract_task_composer | |
cd ws/src/tesseract_python/tesseract_python | |
pytest -s | |
- name: build docs | |
if: matrix.config.docs == true | |
shell: bash | |
working-directory: ws/build/tesseract_python | |
run: | | |
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/ws/install/lib | |
cmake --build . --config Release --target tesseract_python_doc | |
- name: archive wheels | |
uses: actions/upload-artifact@v2 | |
with: | |
name: 'python-wheels-${{ matrix.config.os }}-${{ matrix.config.python_version }}' | |
path: ws/build/tesseract_python/python/* | |
- name: archive docs | |
uses: actions/upload-artifact@v2 | |
with: | |
name: 'python-docs-${{ matrix.config.os }}-${{ matrix.config.python_version }}' | |
path: ws/build/tesseract_python/docs/* | |
build-win: | |
runs-on: windows-2019 | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- arch: x64 | |
vcpkg_triplet: x64-windows-release | |
cmake_arch: x64 | |
python_version: "3.7" | |
- arch: x64 | |
vcpkg_triplet: x64-windows-release | |
cmake_arch: x64 | |
python_version: "3.8" | |
- arch: x64 | |
vcpkg_triplet: x64-windows-release | |
cmake_arch: x64 | |
python_version: "3.9" | |
- arch: x64 | |
vcpkg_triplet: x64-windows-release | |
cmake_arch: x64 | |
python_version: "3.10" | |
- arch: x64 | |
vcpkg_triplet: x64-windows-release | |
cmake_arch: x64 | |
python_version: "3.11.0" | |
- arch: x64 | |
vcpkg_triplet: x64-windows-release | |
cmake_arch: x64 | |
python_version: "3.12.0" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
path: ws/src/tesseract_python | |
- uses: actions/setup-python@v4 | |
id: setup-python | |
with: | |
python-version: '${{ matrix.config.python_version }}' | |
architecture: ${{ matrix.config.arch }} | |
- name: vcpkg build | |
uses: johnwason/vcpkg-action@v5 | |
with: | |
pkgs: >- | |
${{ env.VCPKG_PKGS }} | |
triplet: ${{ matrix.config.vcpkg_triplet }} | |
extra-args: --clean-after-build | |
token: ${{ github.token }} | |
cache-key: win-${{ matrix.config.arch }}-python-${{ matrix.config.python_version }} | |
revision: master | |
- name: pip3 | |
run: | | |
python -m pip install numpy setuptools wheel pytest delvewheel colcon-common-extensions vcstool | |
- name: choco | |
run: | | |
choco install swig ninja -r | |
- name: vcs import | |
working-directory: ws/src | |
run: vcs import --input tesseract_python\dependencies.rosinstall | |
- name: colcon build | |
working-directory: ws | |
shell: cmd | |
run: | | |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 | |
set CXXFLAGS=%CXXFLAGS% -DEIGEN_DONT_ALIGN=1 -DEIGEN_DONT_VECTORIZE=1 | |
set CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%\vcpkg\installed\${{ matrix.config.vcpkg_triplet }} | |
set PATH=%PATH%;%GITHUB_WORKSPACE%\vcpkg\installed\${{ matrix.config.vcpkg_triplet }}\bin | |
set CC=cl | |
set CCX=cl | |
colcon build --packages-up-to tesseract_python --merge-install ^ | |
--cmake-force-configure ^ | |
--event-handlers console_cohesion+ ^ | |
--packages-ignore tesseract_examples trajopt_ifopt trajopt_sqp gtest ^ | |
--cmake-args -GNinja -DCMAKE_BUILD_TYPE=Release ^ | |
-DPYTHON_EXECUTABLE="${{ steps.setup-python.outputs.python-path }}" ^ | |
-DTESSERACT_PYTHON_BUILD_WHEEL=ON ^ | |
-DTESSERACT_ENABLE_EXAMPLES=OFF -DTESSERACT_PLUGIN_FACTORY_CALLBACKS=ON ^ | |
-DVCPKG_APPLOCAL_DEPS=OFF ^ | |
-DTESSERACT_BUILD_TRAJOPT_IFOPT=OFF | |
if %ERRORLEVEL% GEQ 1 exit 1 | |
- name: test | |
shell: cmd | |
run: | | |
python -m venv venv | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
call venv\Scripts\activate | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
python --version | |
python -m pip install --upgrade pip | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
for %%I in ("%GITHUB_WORKSPACE%\ws\build\tesseract_python\python\wheelhouse\*") do set WHEEL_FILE=%%~I | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
echo WHEEL_FILE=%WHEEL_FILE% | |
python -m pip install %WHEEL_FILE% | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
python -m pip install pytest | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
set TESSERACT_SUPPORT_DIR=%GITHUB_WORKSPACE%\ws\src\tesseract\tesseract_support | |
set TESSERACT_TASK_COMPOSER_DIR=%GITHUB_WORKSPACE%\ws\src\tesseract_planning\tesseract_task_composer | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
cd %GITHUB_WORKSPACE%\ws\src\tesseract_python\tesseract_python | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
python -m pytest -s | |
if %errorlevel% neq 0 exit /b %errorlevel% | |
- name: archive wheels | |
if: always() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: 'python-wheels-win-${{matrix.config.python_version}}' | |
path: ws/build/tesseract_python/python | |
- name: archive logs | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: 'build-logs-win-${{ matrix.config.arch }}-python-${{ matrix.config.python_version }}' | |
path: "**/*.log" | |
retention-days: 2 | |
build-macos: | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- py_platform: macosx-10.9-x86_64 | |
python_version: "3.12" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
path: ws/src/tesseract_python | |
- uses: actions/setup-python@v4 | |
id: setup-python | |
with: | |
python-version: '${{ matrix.config.python_version }}' | |
- name: brew | |
run: | | |
brew install libomp cmake automake autoconf libtool gcc ninja | |
- name: vcpkg build | |
uses: johnwason/vcpkg-action@v5 | |
with: | |
pkgs: >- | |
${{ env.VCPKG_PKGS }} | |
triplet: x64-osx-dynamic-release | |
extra-args: --clean-after-build --overlay-triplets=${{ github.workspace }}/ws/src/tesseract_python/.github/workflows/vcpkg_triplets | |
token: ${{ github.token }} | |
cache-key: osx-x64-vcpkg | |
revision: master | |
- name: pip3 | |
run: | | |
python3 -m pip install numpy setuptools wheel pytest delvewheel colcon-common-extensions vcstool delocate | |
- name: vcs import | |
working-directory: ws/src | |
run: vcs import --input tesseract_python/dependencies.rosinstall | |
- name: colcon build | |
working-directory: ws | |
run: | | |
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GITHUB_WORKSPACE/vcpkg/installed/x64-osx-dynamic-release/lib:$GITHUB_WORKSPACE/ws/install/lib | |
export CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/vcpkg/installed/x64-osx-dynamic-release | |
colcon build --merge-install \ | |
--packages-ignore tesseract_examples trajopt_ifopt trajopt_sqp ifopt vhacd \ | |
--event-handlers console_cohesion+ \ | |
--cmake-force-configure \ | |
--cmake-args -GNinja -DCMAKE_BUILD_TYPE=Release \ | |
-DINSTALL_OMPL=OFF -DINSTALL_OMPL_TAG=master -DBUILD_IPOPT=OFF -DBUILD_SNOPT=OFF \ | |
-DBUILD_SHARED_LIBS=ON -DTESSERACT_ENABLE_EXAMPLES=OFF -DTESSERACT_BUILD_TRAJOPT_IFOPT=OFF \ | |
-DVCPKG_APPLOCAL_DEPS=OFF -DTESSERACT_ENABLE_TESTING=ON \ | |
-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 \ | |
-DOpenMP_CXX_INCLUDE_DIR=/usr/local/opt/libomp/include \ | |
-DOpenMP_C_INCLUDE_DIR=/usr/local/opt/libomp/include \ | |
-DOpenMP_CXX_LIB_NAMES=libomp -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp" \ | |
-DOpenMP_C_LIB_NAMES=libomp -DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp" \ | |
-DOpenMP_libomp_LIBRARY=/usr/local/opt/libomp/lib/libomp.dylib \ | |
-Dtcmalloc_minimal_LIBRARY=${{ github.workspace }}/vcpkg/installed/x64-osx-dynamic-release/lib/libtcmalloc_minimal.dylib \ | |
-DPYTHON_EXECUTABLE="${{ steps.setup-python.outputs.python-path }}" \ | |
-DTESSERACT_PYTHON_WHEEL_PLATFORM=${{ matrix.config.py_platform }} \ | |
-DTESSERACT_PYTHON_BUILD_WHEEL=ON | |
- name: test | |
shell: bash | |
run: | | |
${{ steps.setup-python.outputs.python-path }} -m venv venv | |
source venv/bin/activate | |
python -m pip install --upgrade pip | |
python -m pip install ws/build/tesseract_python/python/wheelhouse/* | |
python -m pip install pytest | |
export TESSERACT_SUPPORT_DIR=$GITHUB_WORKSPACE/ws/src/tesseract/tesseract_support | |
export TESSERACT_TASK_COMPOSER_DIR=$GITHUB_WORKSPACE/ws/src/tesseract_planning/tesseract_task_composer | |
cd ws/src/tesseract_python/tesseract_python | |
pytest -s | |
- name: archive wheels | |
if: always() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: 'python-macos-win-${{matrix.config.python_version}}' | |
path: ws/build/tesseract_python/python | |
- name: archive logs | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: 'build-logs-macos-${{ matrix.config.arch }}-python-${{ matrix.config.python_version }}' | |
path: "**/*.log" | |
retention-days: 2 | |
collect-wheels: | |
needs: | |
- build-win | |
- build-ubuntu | |
- build-macos | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
path: robotraconteur | |
- name: Download CI artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
path: artifacts/main | |
- name: archive wheels | |
uses: actions/upload-artifact@v2 | |
with: | |
name: 'python-wheels-all' | |
path: artifacts/**/wheelhouse/*.whl |