diff --git a/.github/workflows/build-edt.yml b/.github/workflows/build-edt.yml new file mode 100644 index 000000000..a8f477fd5 --- /dev/null +++ b/.github/workflows/build-edt.yml @@ -0,0 +1,105 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# Based on: https://github.com/seung-lab/euclidean-distance-transform-3d/blob/3.1.2/.github/workflows/build_wheels.yml +name: Build edt wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'edt version to build (git tag, e.g. 3.1.2)' + required: true + default: '3.1.2' + pull_request: + paths: + - '.github/workflows/build-edt.yml' + - 'patches/edt/**' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '3.1.2' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + EDT_VERSION: ${{ inputs.version || '3.1.2' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + build_wheels: + needs: [setup] + name: Build edt ${{ inputs.version || '3.1.2' }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + python: ["cp312", "cp313", "cp314", "cp314t"] + + steps: + - name: Checkout edt ${{ env.EDT_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: seung-lab/euclidean-distance-transform-3d + ref: ${{ env.EDT_VERSION }} + persist-credentials: false + + - name: Checkout python-wheels + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: python-wheels + persist-credentials: false + + - name: Apply patches + run: git apply python-wheels/patches/edt/${{ env.EDT_VERSION }}/*.patch + + - 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 }} + # numpy is a build-time requirement (headers, via pyproject.toml's + # build-system.requires) and, despite not being declared as a + # runtime dependency by name, an implicit one too (the compiled + # extension calls numpy's C API at import time). Only our registry + # has it for riscv64; only-binary keeps a newer PyPI release from + # winning the resolution and then compiling from sdist. + CIBW_ENVIRONMENT: >- + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + PIP_ONLY_BINARY=numpy + CIBW_TEST_REQUIRES: pytest numpy scipy + CIBW_TEST_COMMAND: python -m pytest -v {project}/automated_test.py + + - name: Check wheel contents + run: | + python3 - wheelhouse/*.whl <<'EOF' + import sys, zipfile + names = zipfile.ZipFile(sys.argv[1]).namelist() + exts = {n.split("/")[-1].split(".")[0] for n in names if n.endswith(".so")} + assert exts == {"edt"}, exts + licences = {n.rsplit("/", 1)[-1] for n in names if ".dist-info/licenses/" in n} - {""} + assert licences == {"COPYING", "COPYING.LESSER"}, licences + EOF + + - name: Store wheels + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: edt-${{ env.EDT_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: ./wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish edt ${{ inputs.version || '3.1.2' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: edt-${{ inputs.version || '3.1.2' }}-*-manylinux_riscv64 diff --git a/patches/edt/3.1.2/0001-Ship-the-LGPL-license-files-in-the-wheel.patch b/patches/edt/3.1.2/0001-Ship-the-LGPL-license-files-in-the-wheel.patch new file mode 100644 index 000000000..04c05d790 --- /dev/null +++ b/patches/edt/3.1.2/0001-Ship-the-LGPL-license-files-in-the-wheel.patch @@ -0,0 +1,39 @@ +From 28d7662d54333ee225c4567fb26a22f7608a8479 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Mon, 7 Sep 2026 16:03:48 +0200 +Subject: [PATCH] Ship the LGPL license files in the wheel + +setup.cfg names license_files = LICENSE, but the project has no LICENSE +file at the root -- only COPYING (GPLv3 text) and COPYING.LESSER (the +LGPLv3 addendum, per the standard GNU dual-file convention). An explicit +license_files list turns off setuptools' default LICEN[CS]E*/COPYING* +glob, so the mismatch means every published wheel (verified on PyPI's +edt-3.1.2 manylinux wheels) ships no license file at all in +dist-info/licenses/. + +Point license_files at the files that actually exist so the wheel +carries the LGPL-3.0-or-later text it declares. + +Upstream-Status: To upstream [not yet submitted; same gap exists in every edt wheel on PyPI historically, needs maintainer discussion not a drive-by PR] +--- + setup.cfg | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/setup.cfg b/setup.cfg +index 43efb4b..464890d 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -7,7 +7,9 @@ description_file = README.md + author = William Silversmith + author_email = ws9@princeton.edu + home_page = https://github.com/seung-lab/euclidean-distance-transform-3d/ +-license_files = LICENSE ++license_files = ++ COPYING ++ COPYING.LESSER + license = LGPL-3.0-or-later + classifier = + Intended Audience :: Developers +-- +2.50.1 (Apple Git-155) +