From 89eda0b973269f87f3d1cd02be6758fe07e1ff31 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 10 Sep 2026 09:37:55 +0200 Subject: [PATCH] openexr: add build-openexr.yml for riscv64 wheels Builds the pybind11/CMake OpenEXR Python bindings via scikit-build-core and cibuildwheel, mirroring upstream's python-wheels.yml. Imath, libdeflate and OpenJPH are statically linked in but their licences never reach dist-info, so the workflow stages them at the project root for scikit-build-core's default licence glob to pick up. --- .github/workflows/build-openexr.yml | 96 +++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 .github/workflows/build-openexr.yml diff --git a/.github/workflows/build-openexr.yml b/.github/workflows/build-openexr.yml new file mode 100644 index 000000000..0a39df00e --- /dev/null +++ b/.github/workflows/build-openexr.yml @@ -0,0 +1,96 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `build_wheels` job of +# https://github.com/AcademySoftwareFoundation/openexr/blob/v3.4.15/.github/workflows/python-wheels.yml +name: Build openexr wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'openexr version to build (git tag without the leading v, e.g. 3.4.15)' + required: true + default: '3.4.15' + pull_request: + paths: + - '.github/workflows/build-openexr.yml' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '3.4.15' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + # `inputs.version` is empty on pull_request events; default to 3.4.15 there. + OPENEXR_VERSION: ${{ inputs.version || '3.4.15' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + # CMakeLists.txt FetchContent-pulls Imath at this tag when OPENEXR_FORCE_INTERNAL_IMATH + # is set; bump alongside it if upstream ever moves the pin. + IMATH_TAG: v3.2.2 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + build_wheels: + needs: [setup] + name: Build openexr ${{ inputs.version || '3.4.15' }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 90 + strategy: + fail-fast: false + matrix: + python: ["cp312", "cp313", "cp314", "cp314t"] + + steps: + - name: Checkout openexr v${{ env.OPENEXR_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: AcademySoftwareFoundation/openexr + ref: v${{ env.OPENEXR_VERSION }} + persist-credentials: false + + # Imath, libdeflate and OpenJPH are statically linked in (OPENEXR_FORCE_INTERNAL_*), + # but upstream's own wheel only ships LICENSE.md; libdeflate/OpenJPH are vendored + # under external/ while Imath is git-fetched at configure time (gotcha 53), so none + # of the three licences reach dist-info without staging them at the project root. + - name: Stage vendored licences + run: | + cp external/deflate/COPYING LICENSE.deflate + cp external/OpenJPH/LICENSE LICENSE.openjph + curl -fsSL --retry 5 "https://raw.githubusercontent.com/AcademySoftwareFoundation/Imath/${{ env.IMATH_TAG }}/LICENSE.md" -o LICENSE.imath + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + only: ${{ matrix.python }}-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + # OpenEXR's compiled extension has no Py_mod_gil slot, so cp314t + # re-enables the GIL at import and the test suite's warnings-as-errors + # config turns that into a collection error (gotcha 127). + CIBW_TEST_ENVIRONMENT: PIP_ONLY_BINARY=numpy PYTHON_GIL=1 + CIBW_TEST_COMMAND: >- + python -c "import importlib.metadata as m; f = sorted(str(p).split('licenses/', 1)[1] for p in m.files('openexr') if '.dist-info/licenses/' in str(p)); assert f == ['LICENSE.deflate', 'LICENSE.imath', 'LICENSE.md', 'LICENSE.openjph'], f" && + pytest -s {project}/src/wrappers/python/tests + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: openexr-${{ env.OPENEXR_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish openexr ${{ inputs.version || '3.4.15' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: openexr-${{ inputs.version || '3.4.15' }}-*-manylinux_riscv64