Skip to content

Commit 0b81729

Browse files
committed
Run both tests pybind11 and nanobind in CI
Assisted-by: Cursor/Composer-2 Signed-off-by: Aleksandr Motsjonov <soswow@gmail.com>
1 parent 2cdaedc commit 0b81729

6 files changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/build-steps.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ on:
8888
type: string
8989
build_local_deps:
9090
type: string
91+
# When set (e.g. `both`), CMake builds pybind11 and/or nanobind per OIIO
92+
# docs; dependency scripts install the `nanobind` pip package when needed.
93+
oiio_python_bindings_backend:
94+
type: string
95+
default: ''
9196
secrets:
9297
PASSED_GITHUB_TOKEN:
9398
required: false
@@ -136,6 +141,7 @@ jobs:
136141
OpenImageIO_BUILD_LOCAL_DEPS: ${{inputs.build_local_deps}}
137142
SETENVS: ${{inputs.setenvs}}
138143
DEPCMDS: ${{inputs.depcmds}}
144+
OIIO_PYTHON_BINDINGS_BACKEND: ${{ inputs.oiio_python_bindings_backend }}
139145

140146
steps:
141147
- name: install nodejs20glibc2.17

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,7 @@ jobs:
355355
required_deps: ${{ matrix.required_deps || 'all' }}
356356
optional_deps: ${{ matrix.optional_deps || 'CUDAToolkit;DCMTK;JXL;Nuke;OpenGL;openjph;OpenVDB;Ptex;pystring;Qt5;R3DSDK;' }}${{matrix.optional_deps_append}}
357357
build_local_deps: ${{ matrix.build_local_deps }}
358+
oiio_python_bindings_backend: ${{ matrix.oiio_python_bindings_backend || '' }}
358359
strategy:
359360
fail-fast: false
360361
matrix:
@@ -381,6 +382,7 @@ jobs:
381382

382383
- desc: latest releases gcc13 C++20 py3.12 avx2 exr3.4 ocio2.4
383384
nametag: linux-latest-releases
385+
oiio_python_bindings_backend: both
384386
runner: ubuntu-24.04
385387
cc_compiler: gcc-13
386388
cxx_compiler: g++-13
@@ -656,6 +658,7 @@ jobs:
656658
required_deps: ${{ matrix.required_deps || 'all' }}
657659
optional_deps: ${{ matrix.optional_deps || 'Nuke;R3DSDK;' }}${{matrix.optional_deps_append}}
658660
build_local_deps: ${{ matrix.build_local_deps }}
661+
oiio_python_bindings_backend: ${{ matrix.oiio_python_bindings_backend || '' }}
659662
strategy:
660663
fail-fast: false
661664
matrix:
@@ -676,6 +679,7 @@ jobs:
676679
- desc: MacOS-14-ARM aclang15/C++20/py3.13
677680
runner: macos-14
678681
nametag: macos14-arm-py313
682+
oiio_python_bindings_backend: both
679683
cc_compiler: /usr/bin/clang
680684
cxx_compiler: /usr/bin/clang++
681685
cxx_std: 20
@@ -739,6 +743,7 @@ jobs:
739743
required_deps: ${{ matrix.required_deps || 'all' }}
740744
optional_deps: ${{ matrix.optional_deps || 'BZip2;CUDAToolkit;DCMTK;FFmpeg;GIF;JXL;Libheif;LibRaw;Nuke;OpenCV;OpenGL;OpenJPEG;openjph;OpenCV;OpenVDB;Ptex;pystring;Qt5;Qt6;TBB;R3DSDK;${{matrix.optional_deps_append}}' }}
741745
build_local_deps: ${{ matrix.build_local_deps }}
746+
oiio_python_bindings_backend: ${{ matrix.oiio_python_bindings_backend || '' }}
742747
strategy:
743748
fail-fast: false
744749
matrix:
@@ -753,6 +758,7 @@ jobs:
753758
- desc: Windows-2025 VS2022
754759
runner: windows-2025
755760
nametag: windows-2025
761+
oiio_python_bindings_backend: both
756762
generator: "Visual Studio 17 2022"
757763
python_ver: "3.12"
758764
ctest_test_timeout: "240"

src/build-scripts/ci-build.bash

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ if [[ "$USE_SIMD" != "" ]] ; then
2525
OIIO_CMAKE_FLAGS="$OIIO_CMAKE_FLAGS -DUSE_SIMD=$USE_SIMD"
2626
fi
2727

28+
if [[ -n "${OIIO_PYTHON_BINDINGS_BACKEND:-}" ]] ; then
29+
OIIO_CMAKE_FLAGS="$OIIO_CMAKE_FLAGS -DOIIO_PYTHON_BINDINGS_BACKEND=${OIIO_PYTHON_BINDINGS_BACKEND}"
30+
fi
31+
2832
if [[ -n "$CODECOV" ]] ; then
2933
OIIO_CMAKE_FLAGS="$OIIO_CMAKE_FLAGS -DCODECOV=${CODECOV}"
3034
fi

src/build-scripts/gh-installdeps.bash

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,5 +230,14 @@ fi
230230
df -h .
231231
df -h /host/root || true
232232

233+
# nanobind's CMake config is discovered via `python -m nanobind --cmake_dir`.
234+
if [[ "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "both" || "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "nanobind" ]] ; then
235+
if [[ "$ASWF_ORG" != "" ]] ; then
236+
time pip3 install nanobind || true
237+
else
238+
time pip3${PIP_SUFFIX} install nanobind
239+
fi
240+
fi
241+
233242
# Save the env for use by other stages
234243
src/build-scripts/save-env.bash

src/build-scripts/gh-win-installdeps.bash

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ elif [[ "$PYTHON_VERSION" == "3.14" ]] ; then
3939
fi
4040
pip install numpy
4141

42+
if [[ "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "both" || "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "nanobind" ]] ; then
43+
"${Python_EXECUTABLE:-python}" -m pip install nanobind
44+
fi
45+
4246

4347
# In case we need vcpkg, example:
4448
# echo "All pre-installed VCPkg installs:"

src/build-scripts/install_homebrew_deps.bash

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ echo ""
6464
echo "After brew installs:"
6565
brew list --versions
6666

67+
if [[ "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "both" || "${OIIO_PYTHON_BINDINGS_BACKEND:-}" == "nanobind" ]] ; then
68+
python3 -m pip install nanobind
69+
fi
70+
6771
# Set up paths. These will only affect the caller if this script is
6872
# run with 'source' rather than in a separate shell.
6973
export PATH=${HOMEBREW_PREFIX}/opt/qt5/bin:$PATH

0 commit comments

Comments
 (0)