Skip to content

Commit

Permalink
Merge pull request #4 from scalableminds/update_numpy
Browse files Browse the repository at this point in the history
Patch Onnxruntime, Sortednp, and DracoPy
  • Loading branch information
Tobias314 authored Oct 24, 2024
2 parents 7ecf9dd + 7c009e5 commit 9cc210b
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 35 deletions.
37 changes: 26 additions & 11 deletions .github/workflows/dracopy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
dracopyVersion:
description: "DracoPy version"
required: true
default: "0.5.0"
default: "1.4.0"
numpyVersion:
description: "numpy version"
required: true
Expand All @@ -17,12 +17,12 @@ jobs:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
CIBW_BUILD: "cp310-* cp311-* cp312-*"
CIBW_BUILD: "cp310-* cp311-*"
DRACOPY_VERSION: ${{ inputs.dracopyVersion }}
NUMPY_VERSION: ${{ inputs.numpyVersion }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, macos-latest]
defaults:
run:
shell: bash
Expand All @@ -32,27 +32,42 @@ jobs:

- name: Download DracoPy
run: |
git clone https://gitlab.sauerburger.com/frank/sortednp.git \
--branch "release-${DRACOPY_VERSION}" --single-branch
git clone https://github.com/seung-lab/DracoPy \
--branch "${DRACOPY_VERSION}" --single-branch
- name: Install CMake
uses: ssrobins/install-cmake@v1
- name: Patch Numpy version Linux
if: ${{ matrix.os == 'ubuntu-latest'}}
run: |
cd DracoPy
sed -i "s/oldest-supported-numpy/numpy>=${{ inputs.numpyVersion }}/g" pyproject.toml
cat pyproject.toml
- name: Patch Numpy version MacOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
cd DracoPy
sed -i '' 's/oldest-supported-numpy/numpy>=${{ inputs.numpyVersion }}/g' pyproject.toml
- name: Build wheels
uses: pypa/[email protected]
# uses: pypa/[email protected]
# to supply options, put them in 'env', like:
env:
CIBW_BEFORE_BUILD: git submodule init && git submodule update && pip install cython numpy==${{ inputs.numpyVersion }} scikit-build
CPPFLAGS: -I/usr/local/opt/zlib/include
LDFLAGS: -L/usr/local/opt/zlib/lib
CIBW_SKIP: "*-musllinux*"
CIBW_ARCHS_MACOS: "universal2"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_WINDOWS: "AMD64"
run: |
cd DracoPy
python -m pip install cibuildwheel==2.16.5
python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
name: wheels
path: ./DracoPy/wheelhouse/*.whl

publish:
name: Publish wheels to pypi.scm.io
Expand All @@ -71,4 +86,4 @@ jobs:
user: ${{ secrets.PYPI_SCM_USERNAME }}
password: ${{ secrets.PYPI_SCM_PASSWORD }}
repository-url: https://pypi.scm.io/simple/
skip-existing: true
skip-existing: false
44 changes: 27 additions & 17 deletions .github/workflows/onnxruntime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,37 @@ jobs:
build_wheels:
name: Build onnxruntime wheel for
runs-on: ubuntu-latest
container:
image: quay.io/pypa/manylinux2010_x86_64
env:
PYBIN: /opt/python/cp310-cp310/bin

strategy:
matrix:
python_version: ["3.10", "3.11"]
steps:
- name: Build wheel
run: |
$PYBIN/python -m venv /venv
source /venv/bin/activate
python3 -m pip install cmake
yum install -y centos-release-scl
yum install -y devtoolset-9
export PATH=/opt/rh/devtoolset-9/root/usr/bin:$PATH
pip install numpy==2.0 onnx packaging wheel
git clone --depth 1 --branch ${{ inputs.onnxruntimeBranch }} --recursive https://github.com/Microsoft/onnxruntime.git
cd onnxruntime/
./build.sh --config Release --build_shared_lib --parallel --compile_no_warning_as_error --skip_submodule_sync --allow_running_as_root --build_wheel
- name: Build Wheel
uses: addnab/docker-run-action@v3
with:
image: quay.io/pypa/manylinux2010_x86_64 #We use the outdated manylinux2010 to build the wheels to ensure compatibility with older systems (e.g. CentOS 6 and glibc 2.12)
options: -v ${{ github.workspace }}:/dist
shell: bash
run: |
yum install -y wget centos-release-scl devtoolset-9
export PATH=/opt/rh/devtoolset-9/root/usr/bin:$PATH
wget https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Mambaforge-24.3.0-0-Linux-x86_64.sh
chmod +x ./Mambaforge-24.3.0-0-Linux-x86_64.sh
./Mambaforge-24.3.0-0-Linux-x86_64.sh -b
export PATH=/root/mambaforge/bin/:$PATH
mamba create -n pyenv python==${{ matrix.python_version }} -y
mamba init
source ~/.bashrc
mamba activate pyenv
pip install cmake numpy==2.0 onnx packaging wheel auditwheel sympy pytest
git clone --depth 1 --branch ${{ inputs.onnxruntimeBranch }} --recursive https://github.com/Microsoft/onnxruntime.git
cd onnxruntime/
./build.sh --build --update --config Release --build_shared_lib --parallel --compile_no_warning_as_error --skip_submodule_sync --allow_running_as_root --build_wheel
cp ./build/Linux/Release/dist/*.whl /dist
- uses: actions/upload-artifact@v3
with:
name: wheels
path: /onnxruntime/build/Linux/Release/dist/*.whl
path: ${{ github.workspace }}/*.whl

publish:
name: Publish wheels to pypi.scm.io
Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/sortednp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
cibwVersion:
description: "cibuildwheel version"
default: "2.12.3"
newVersionTag:
description: "The name/tag of the version published"
required: true
default: "0.5.0.1"

jobs:
build_wheels:
Expand All @@ -26,7 +30,7 @@ jobs:
CIBW_VERSION: ${{ inputs.cibwVersion }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, macos-latest]
defaults:
run:
shell: bash
Expand All @@ -48,19 +52,23 @@ jobs:
run: |
cd sortednp
sed -i 's/.*numpy>.*/ install_requires=["numpy>=${{ inputs.numpyVersion }}"],/g' setup.py
sed -i 's/.*version=.*/ version="${{ inputs.newVersionTag }}",/g' setup.py
sed -i 's/.*__version__=.*/__version__ = "${{ inputs.newVersionTag }}"/g' src/sortednp/__init__.py
cat setup.py
cat src/sortednp/__init__.py
sed -i "s/oldest-supported-numpy/numpy>=${{ inputs.numpyVersion }}/g" pyproject.toml
cat pyproject.toml
- name: Patch Numpy version MacOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
cd sortednp
sed -i '' 's/.*numpy>.*/ install_requires=["numpy>=${{ inputs.numpyVersion }}"],/g' setup.py
- name: Patch Numpy version Windows
if: ${{ matrix.os == 'windows-latest'}}
run: |
cd sortednp
powershell -command "(Get-Content setup.py) -replace '.*numpy>.*', ' install_requires=[\"numpy>=${{ inputs.numpyVersion }}\"],' | Set-Content setup.py"
sed -i '' 's/.*version=.*/ version="${{ inputs.newVersionTag }}",/g' setup.py
sed -i '' 's/.*__version__=.*/__version__ = "${{ inputs.newVersionTag }}"/g' src/sortednp/__init__.py
cat setup.py
cat src/sortednp/__init__.py
sed -i '' 's/oldest-supported-numpy/numpy>=${{ inputs.numpyVersion }}/g' pyproject.toml
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==${CIBW_VERSION}
Expand Down

0 comments on commit 9cc210b

Please sign in to comment.