Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 158 additions & 6 deletions .github/workflows/pip-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag

manylinux-pip:
manylinux-pip-build:
needs: setup
timeout-minutes: 25
runs-on: ubuntu-latest
Expand All @@ -44,6 +44,7 @@ jobs:
uses: actions/checkout@v3
with:
submodules: recursive
ref: ${{needs.setup.outputs.version_tag}}

- name: Python setup
if: ${{ matrix.py-version != '3.8' }}
Expand Down Expand Up @@ -101,7 +102,7 @@ jobs:
path: ./scripts/wheel/meshlib/wheelhouse/meshlib-*.whl
retention-days: 1

windows-pip:
windows-pip-build:
needs: setup
timeout-minutes: 60
runs-on: windows-2019
Expand Down Expand Up @@ -131,6 +132,7 @@ jobs:
uses: actions/checkout@v3
with:
submodules: recursive
ref: ${{needs.setup.outputs.version_tag}}

- name: Start container
run: docker run -d --name meshlib-win --workdir C:\workspace\MeshLib\MeshLib -v ${{ github.workspace }}\..\..:C:\workspace meshrus/meshlib-windows:latest ping -t localhost
Expand Down Expand Up @@ -193,8 +195,91 @@ jobs:
if: always()
run: docker rm -f meshlib-win

linux-pip-test:
needs: [setup, manylinux-pip]
macos-pip-build:
needs: setup
timeout-minutes: 40
runs-on: ${{ matrix.instance }}
strategy:
fail-fast: false
matrix:
platform: ["arm64", "x86"]
py-version: ["3.8", "3.9", "3.10" ]
include:
- platform: "x86"
plat-name: macosx_12_0_x86_64
instance: macos-12
- platform: "arm64"
plat-name: macosx_12_0_arm64
instance: macos-arm-build
- 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"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add
ref: ${{needs.setup.outputs.version_tag}}

ref: ${{needs.setup.outputs.version_tag}}

- name: Python setup
run: |
brew install python@${{matrix.py-version}}
curl -sS https://bootstrap.pypa.io/get-pip.py | ${{ matrix.py-cmd }}
${{ matrix.py-cmd }} -m pip install --upgrade -r ./requirements/python.txt

- name: Install thirdparty libs
run: ./scripts/build_thirdparty.sh

- name: Build
run: ./scripts/build_source.sh
env:
MESHLIB_PYTHON_VERSION: ${{matrix.py-version}}
MESHRUS_BUILD_RELEASE: "ON"
MESHRUS_BUILD_DEBUG: "OFF"
CMAKE_CXX_COMPILER: /usr/bin/clang++
# not realy needed
CMAKE_C_COMPILER: /usr/bin/clang

- 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 }} -m pip install --upgrade pip
${{ matrix.py-cmd }} -m pip install wheel setuptools delocate
${{ matrix.py-cmd }} ./scripts/wheel/setup_workspace.py
cd ./scripts/wheel/meshlib
${{ matrix.py-cmd }} setup.py bdist_wheel --plat-name=${{matrix.plat-name}} --python-tag=${{matrix.py-tag}} --version ${{needs.setup.outputs.version_tag}}
delocate-path meshlib
cd ../../..
delocate-wheel -w . -v ./scripts/wheel/meshlib/dist/*.whl

- name: Upload to Test Artifacts
uses: actions/upload-artifact@v3
with:
name: Macos-${{ matrix.py-cmd }}
path: meshlib-*.whl
retention-days: 1

- name: Upload to Release Artifacts
uses: actions/upload-artifact@v3
with:
name: Wheelhouse
path: meshlib-*.whl
retention-days: 1

manylinux-pip-test:
needs: [setup, manylinux-pip-build]
timeout-minutes: 20
runs-on: ubuntu-latest
container:
Expand Down Expand Up @@ -253,7 +338,7 @@ jobs:
run: ${{ matrix.py-cmd }} -m pytest -s -v

windows-pip-test:
needs: [setup, windows-pip]
needs: [setup, windows-pip-build]
timeout-minutes: 20
runs-on: windows-latest
strategy:
Expand Down Expand Up @@ -290,8 +375,57 @@ jobs:
working-directory: test_python
run: py -${{matrix.py-version}} -m pytest -s -v

macos-pip-test:
needs: [setup, macos-pip-build]
timeout-minutes: 20
runs-on: ${{ matrix.instance }}
strategy:
fail-fast: false
matrix:
platform: ["arm64", "x86"]
py-version: ["3.8", "3.9", "3.10" ]
include:
- platform: "x86"
plat-name: macosx_12_0_x86_64
instance: macos-12
- platform: "arm64"
plat-name: macosx_12_0_arm64
instance: macos-arm-build
- py-version: "3.8"
py-cmd: "python3.8"
- py-version: "3.9"
py-cmd: "python3.9"
- py-version: "3.10"
py-cmd: "python3.10"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{needs.setup.outputs.version_tag}}

- name: Python setup
run: brew install python@${{matrix.py-version}}

- 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

- name: Download Meshlib wheel from Artifact
uses: actions/download-artifact@v3
with:
name: Macos-${{ matrix.py-cmd }}

- name: Meshlib wheel install
run: ${{ matrix.py-cmd }} -m pip install ${{ matrix.pip-options }} ./meshlib-*${{matrix.platform}}*.whl

- name: Run Python tests
working-directory: test_python
run: ${{ matrix.py-cmd }} -m pytest -s -v

upload-to-release:
needs: [linux-pip-test, windows-pip-test]
needs: [manylinux-pip-test, windows-pip-test, macos-pip-test]
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -357,3 +491,21 @@ jobs:
with:
name: Windows-python3.10
failOnError: false

- name: Delete Macos Python3.8
uses: geekyeggo/delete-artifact@v1
with:
name: Macos-python3.8
failOnError: false

- name: Delete Macos Python3.9
uses: geekyeggo/delete-artifact@v1
with:
name: Macos-python3.9
failOnError: false

- name: Delete Windows Python3.10
uses: geekyeggo/delete-artifact@v1
with:
name: Macos-python3.10
failOnError: false
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ IF(APPLE)
ENDIF()
# Fix linking on 10.14+. See https://stackoverflow.com/questions/54068035
LINK_DIRECTORIES(${HOMEBREW_PREFIX}/lib)
LINK_DIRECTORIES(${HOMEBREW_PREFIX}/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/)
set(CPPFLAGS "-I${HOMEBREW_PREFIX}/opt/llvm/include -I${HOMEBREW_PREFIX}/include")
set(LDFLAGS "-L${HOMEBREW_PREFIX}/opt/llvm/lib -Wl,-rpath,${HOMEBREW_PREFIX}/opt/llvm/lib")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -std=c++20-stdlib=libc++ -undefined dynamic_lookup -framework Cocoa -framework IOKit") # https://github.com/pybind/pybind11/issues/382
Expand Down Expand Up @@ -104,6 +103,10 @@ IF ($ENV{MESHLIB_PYTHON_VERSION})
SET(PYTHON_VERSION $ENV{MESHLIB_PYTHON_VERSION})
ENDIF()

IF(APPLE)
LINK_DIRECTORIES(${HOMEBREW_PREFIX}/opt/python@${PYTHON_VERSION}/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/lib/)
ENDIF()

set(PYTHON_VAR "python")
string(CONCAT PYTHON_LIB ${PYTHON_VAR}${PYTHON_VERSION})

Expand Down
14 changes: 12 additions & 2 deletions scripts/build_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ if [[ $OSTYPE != 'darwin'* ]]; then
CMAKE_CXX_COMPILER=/usr/bin/g++-10
fi
fi
else # darwin
PYTHON_PREFIX=$(python3-config --prefix)
PYTHON_VERSION="3.10"
if [ "${MESHLIB_PYTHON_VERSION}" != "" ]; then
PYTHON_PREFIX=$(python"${MESHLIB_PYTHON_VERSION}"-config --prefix)
PYTHON_VERSION="${MESHLIB_PYTHON_VERSION}"
fi
echo "PYTHON_PREFIX=${PYTHON_PREFIX}"
PYTHON_LIBRARY=${PYTHON_PREFIX}/lib/libpython${PYTHON_VERSION}.dylib
PYTHON_INCLUDE_DIR=${PYTHON_PREFIX}/include/python${PYTHON_VERSION}
fi

MR_EMSCRIPTEN_SINGLETHREAD=0
Expand Down Expand Up @@ -102,7 +112,7 @@ if [ "${MESHRUS_BUILD_RELEASE}" = "ON" ]; then
fi
cd Release
if [[ $OSTYPE == 'darwin'* ]]; then
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DPYTHON_LIBRARY=$(python3-config --prefix)/lib/libpython3.10.dylib -DPYTHON_INCLUDE_DIR=$(python3-config --prefix)/include/python3.10 | tee ${logfile}
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DPYTHON_LIBRARY="${PYTHON_LIBRARY}" -DPYTHON_INCLUDE_DIR="${PYTHON_INCLUDE_DIR}" | tee ${logfile}
else
if [ "${MR_EMSCRIPTEN}" != "ON" ]; then
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | tee ${logfile}
Expand All @@ -125,7 +135,7 @@ if [ "${MESHRUS_BUILD_DEBUG}" = "ON" ]; then
fi
cd Debug
if [[ $OSTYPE == 'darwin'* ]]; then
cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DPYTHON_LIBRARY=$(python3-config --prefix)/lib/libpython3.10.dylib -DPYTHON_INCLUDE_DIR=$(python3-config --prefix)/include/python3.10 | tee ${logfile}
cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DPYTHON_LIBRARY="${PYTHON_LIBRARY}" -DPYTHON_INCLUDE_DIR="${PYTHON_INCLUDE_DIR}" | tee ${logfile}
else
if [ "${MR_EMSCRIPTEN}" != "ON" ]; then
cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | tee ${logfile}
Expand Down
1 change: 1 addition & 0 deletions scripts/wheel/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"License :: Free For Educational Use",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
],
python_requires='>=3.8',
install_requires=[
Expand Down