Skip to content

Build Pip Wheels

Build Pip Wheels #409

Workflow file for this run

name: Build Pip Wheels
on:
release:
types: [ published ]
workflow_dispatch:
env:
VCPKG-VERSION: '2024.07.12'
CUDA-VERSION: '11.4.2.47141'
CUDA-MAJOR: '11'
CUDA-MINOR: '4'
jobs:
setup:
timeout-minutes: 5
runs-on: ubuntu-latest
outputs:
version_tag: ${{ steps.get-latest-tag.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
manylinux-pip-build:
needs: setup
timeout-minutes: 80
runs-on: ${{ matrix.runner }}
container:
image: ${{ matrix.docker-image }}
options: ${{ matrix.container-options }}
strategy:
fail-fast: false
matrix:
platform: ["x86_64", "aarch64"]
py-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- platform: "x86_64"
docker-image: "meshlib/meshlib-ubuntu20:latest"
container-options: "--user root"
runner: ubuntu-latest
compiler: /usr/bin/clang++-11
- platform: "aarch64"
docker-image: "meshlib/meshlib-ubuntu-arm64:latest"
container-options: "--user root"
runner: [ 'self-hosted', 'linux-arm64' ]
# When using Clang 11 on Ubuntu Arm 20.04, we get some obscure ABI issues that fail some tests,
# see the comments in `test_regression/test_algorithms/test_decimate.py` for more details.
compiler: /usr/bin/clang++-18
- py-version: "3.8"
py-tag: "cp38"
py-cmd: "python3.8"
- py-version: "3.9"
py-tag: "cp39"
py-cmd: "python3.9"
- py-version: "3.10"
py-tag: "cp310"
py-cmd: "python3.10"
- py-version: "3.11"
py-tag: "cp311"
py-cmd: "python3.11"
- py-version: "3.12"
py-tag: "cp312"
py-cmd: "python3.12"
steps:
- name: Work-around possible permission issues
shell: bash
run: |
# NOTE: {GITHUB_WORKSPACE} != {{ github.workspace }}
# Related issue: https://github.com/actions/runner/issues/2058
if test -d $GITHUB_WORKSPACE && test -n "$(find ${GITHUB_WORKSPACE} -user root)" ; then
mv ${GITHUB_WORKSPACE} ${GITHUB_WORKSPACE}_${RANDOM}
mkdir ${GITHUB_WORKSPACE}
fi
- name: Checkout
uses: actions/checkout@v4
- name: Checkout third-party submodules
# Some of those safe.directory rules could be redudant.
run: |
# have to checkout selective submodules by our own
# related issue: https://github.com/actions/checkout/issues/1779
export HOME=${RUNNER_TEMP}
echo ${GITHUB_WORKSPACE}
git config --global --add safe.directory ${GITHUB_WORKSPACE}
git config --global --add safe.directory ${GITHUB_WORKSPACE}/thirdparty/imgui
git config --global --add safe.directory ${GITHUB_WORKSPACE}/thirdparty/parallel-hashmap
git submodule update --init --depth 1 thirdparty/imgui thirdparty/parallel-hashmap
- name: Python setup
if: ${{ matrix.py-version != '3.8' }}
run: |
apt -y update && apt -y upgrade && apt -y install software-properties-common
add-apt-repository -y ppa:deadsnakes/ppa && apt -y install ${{ matrix.py-cmd }}-dev ${{ matrix.py-cmd }}-distutils
- name: Pip setup
run: |
curl -sS https://bootstrap.pypa.io/get-pip.py | ${{ matrix.py-cmd }}
${{ matrix.py-cmd }} -m pip install --upgrade -r ./requirements/python.txt
${{ matrix.py-cmd }} -m pip install pytest
- name: Install thirdparty libs
# Also print the amount of RAM. If there's not enough RAM, building MRBind bindings can fail. Not doing it in that step, because OOM fails can erase logs from the current step.
run: |
ln -s /usr/local/lib/meshlib-thirdparty-lib/lib ./lib
ln -s /usr/local/lib/meshlib-thirdparty-lib/include ./include
./scripts/mrbind/install_mrbind_ubuntu.sh
free -h
- name: Build
run: ./scripts/build_source.sh
env:
MESHLIB_PYTHON_VERSION: ${{matrix.py-version}}
MESHLIB_BUILD_RELEASE: "ON"
MESHLIB_BUILD_DEBUG: "OFF"
# When using Clang 11 on Ubuntu Arm 20.04, we get some obscure ABI issues that fail some tests,
# see the comments in `test_regression/test_algorithms/test_decimate.py` for more details.
CMAKE_CXX_COMPILER: ${{matrix.compiler}}
# FIXME: OpenGL libraries are included to wheel packages when the XDE module is used
# Disabling CUDA at least because Clang 18 is too new for it on Ubuntu 20.04, and we're using Clang 18 for reasons
# explained in `MeshLib/scripts/mrbind/0001-Disable-tests-that-seem-to-expose-an-ABI-incompatibility.patch`.
MR_CMAKE_OPTIONS: >
-DMRIOEXTRAS_OPENCASCADE_USE_XDE=OFF
-DMRVIEWER_NO_GTK=ON
-DMESHLIB_BUILD_MRCUDA=OFF
- name: Generate and build MRBind bindings
run: |
make -f scripts/mrbind/generate.mk -B --trace PYTHON_PKGCONF_NAME=python-${{matrix.py-version}}-embed CXX_FOR_ABI=${{matrix.compiler}}
- name: Run Tests
run: MR_LOCAL_RESOURCES=1 xvfb-run -a ./build/Release/bin/MeshViewer -hidden -noEventLoop -unloadPluginsAtEnd
- name: Unit Tests
run: build/Release/bin/MRTest
- name: Python Tests
working-directory: ./build/Release/bin
run: ${{ matrix.py-cmd }} ./../../../scripts/run_python_test_script.py -cmd ${{ matrix.py-cmd }}
- name: Create and fix Wheel
run: |
${{ matrix.py-cmd }} ./scripts/wheel/build_wheel.py --version ${{needs.setup.outputs.version_tag}}
- name: Upload to Test Artifacts
uses: actions/upload-artifact@v4
with:
name: ManyLinux-${{matrix.py-cmd}}-${{matrix.platform}}
path: ./scripts/wheel/meshlib/wheelhouse/meshlib-*.whl
retention-days: 1
manylinux-pip-test:
needs: [manylinux-pip-build]
timeout-minutes: 20
runs-on: ${{ matrix.runner }}
container:
image: ${{matrix.container-prefix}}${{matrix.os}}
options: ${{ matrix.container-options }}
strategy:
fail-fast: false
matrix:
platform: ["x86_64", "aarch64"]
os: ["ubuntu:20.04", "ubuntu:22.04", "debian:11-slim", "fedora:37", "fedora:39"]
include:
- platform: "x86_64"
runner: ubuntu-latest
container-options: "--user root"
container-prefix: " "
- platform: "aarch64"
runner: [ 'self-hosted', 'linux-arm64' ]
container-options: "--user root"
container-prefix: "arm64v8/"
- os: "ubuntu:20.04"
py-version: "3.8"
py-cmd: "python3.8"
- os: "debian:11-slim"
py-version: "3.9"
py-cmd: "python3.9"
- os: "ubuntu:22.04"
py-version: "3.10"
py-cmd: "python3.10"
- os: "fedora:37"
py-version: "3.11"
py-cmd: "python3.11"
- os: "fedora:39"
py-version: "3.12"
py-cmd: "python3.12"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Ubuntu system setup
if: ${{ matrix.os == 'ubuntu:20.04' || matrix.os == 'ubuntu:22.04' || matrix.os == 'debian:11-slim' }}
run: apt -y update && apt -y upgrade && apt -y install curl libssl-dev python3-distutils python3-pip
- name: Fedora 37 system setup
if: ${{matrix.os == 'fedora:37' || matrix.os == 'fedora:39'}}
run: dnf -y install python3 pip
- name: Pip setup
run: |
${{ matrix.py-cmd }} -m pip install --upgrade pip
${{ matrix.py-cmd }} -m pip uninstall -y meshlib
${{ matrix.py-cmd }} -m pip install --upgrade -r ./requirements/python.txt
${{ matrix.py-cmd }} -m pip install pytest
- name: Download Meshlib wheel from Artifact
uses: actions/download-artifact@v4
with:
name: ManyLinux-${{matrix.py-cmd}}-${{matrix.platform}}
merge-multiple: true
- name: Meshlib wheel install
run: ${{ matrix.py-cmd }} -m pip install ${{ matrix.pip-options }} ./meshlib-*.whl
- name: Run Python tests
working-directory: test_python
run: ${{ matrix.py-cmd }} -m pytest -s -v
delete-artifacts:
timeout-minutes: 5
runs-on: ubuntu-20.04
needs: manylinux-pip-test
if: always()
steps:
- name: Delete all ManyLinux
uses: geekyeggo/delete-artifact@v5
with:
name: ManyLinux-*
failOnError: false
- name: Delete all Windows
uses: geekyeggo/delete-artifact@v5
with:
name: Windows-*
failOnError: false
- name: Delete all Macos
uses: geekyeggo/delete-artifact@v5
with:
name: Macos-*
failOnError: false