diff --git a/.github/workflows/build-edlib.yml b/.github/workflows/build-edlib.yml new file mode 100644 index 000000000..2b6c4c0bb --- /dev/null +++ b/.github/workflows/build-edlib.yml @@ -0,0 +1,110 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# Based on the `python_edlib`/`wheels` targets of +# https://github.com/Martinsos/edlib/blob/1.3.9.post1/.github/workflows/ci.yaml +# and https://github.com/Martinsos/edlib/blob/1.3.9.post1/bindings/python/Makefile +name: Build edlib wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'edlib version to build (git tag, e.g. 1.3.9.post1)' + required: true + default: '1.3.9.post1' + pull_request: + paths: + - '.github/workflows/build-edlib.yml' + - 'patches/edlib/**' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '1.3.9.post1' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + EDLIB_VERSION: ${{ inputs.version || '1.3.9.post1' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + MUSLLINUX_RISCV64_IMAGE: quay.io/pypa/musllinux_1_2_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + build_wheels: + needs: [setup] + name: Build edlib ${{ inputs.version || '1.3.9.post1' }} ${{ matrix.python }}-${{ matrix.libc }}_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + python: ["cp312", "cp313", "cp314", "cp314t"] + libc: [manylinux, musllinux] + + steps: + - name: Checkout edlib ${{ env.EDLIB_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: Martinsos/edlib + ref: ${{ env.EDLIB_VERSION }} + persist-credentials: false + + - name: Checkout python-wheels + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: python-wheels + persist-credentials: false + + - name: Patch edlib source + run: git apply python-wheels/patches/edlib/${{ env.EDLIB_VERSION }}/00*.patch + + # setup.py's Extension() sources/include_dirs are relative to itself and + # expect a local edlib/ subdir (edlib/src/edlib.cpp, edlib/include/edlib.h) + # -- exactly what bindings/python/Makefile's own `edlib` target populates by + # copying the top-level C++ core in before invoking cibuildwheel. + - name: Copy the edlib C++ core and LICENSE into the Python binding dir + run: | + cp -r edlib bindings/python/edlib + cp LICENSE bindings/python/LICENSE + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + package-dir: bindings/python + output-dir: wheelhouse/ + env: + CIBW_ARCHS: riscv64 + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.libc }}_riscv64 + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }} + # setup.py builds from the pre-generated edlib.bycython.cpp, which + # isn't checked in (upstream's own Makefile regenerates it before + # every build too); no pyproject.toml means no long_description + # source either (README.rst is cog-generated, requires a built wheel). + # {package}, not a bare filename: before-build's cwd is {project} + # (the whole checkout), not {package} (gotcha 5). + CIBW_BEFORE_BUILD: >- + pip install cython && + cython --cplus {package}/edlib.pyx -o {package}/edlib.bycython.cpp + CIBW_ENVIRONMENT: EDLIB_OMIT_README_RST=1 + CIBW_TEST_COMMAND: python3 {package}/test.py + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: edlib-${{ env.EDLIB_VERSION }}-${{ matrix.python }}-${{ matrix.libc }}_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish edlib ${{ inputs.version || '1.3.9.post1' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: edlib-${{ inputs.version || '1.3.9.post1' }}-*riscv64 diff --git a/patches/edlib/1.3.9.post1/0001-ship-the-MIT-LICENSE-in-the-wheel-s-dist-info.patch b/patches/edlib/1.3.9.post1/0001-ship-the-MIT-LICENSE-in-the-wheel-s-dist-info.patch new file mode 100644 index 000000000..9a47719d8 --- /dev/null +++ b/patches/edlib/1.3.9.post1/0001-ship-the-MIT-LICENSE-in-the-wheel-s-dist-info.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Mon, 7 Sep 2026 06:43:09 +0200 +Subject: [PATCH] ship the MIT LICENSE in the wheel's dist-info + +setup.py declares `license = "MIT"` but never lists a `license_files` +glob, and there is no pyproject.toml for setuptools' PEP 639 +auto-detection to fall back to. As a result every wheel upstream +publishes (verified against the real +edlib-1.3.9.post1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl +from PyPI) carries no LICENSE file at all. + +Declaring `license_files = ["LICENSE"]` makes setuptools copy the +repository's root LICENSE into dist-info/licenses/LICENSE. The build +also copies that file into bindings/python/ first (see +build-edlib.yml), since setup.py's own directory is the wheel-build +context and the license otherwise lives two directories up. + +Upstream-Status: To upstream [not yet submitted; no fork of Martinsos/edlib to push from] +--- + bindings/python/setup.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/bindings/python/setup.py b/bindings/python/setup.py +index 136fd8f..86d31bb 100644 +--- a/bindings/python/setup.py ++++ b/bindings/python/setup.py +@@ -35,6 +35,7 @@ setup( + author = "Martin Sosic", + author_email = "sosic.martin@gmail.com", + license = "MIT", ++ license_files = ["LICENSE"], + keywords = "edit distance levenshtein align sequence bioinformatics", + # Build instructions + ext_modules = [Extension("edlib", +-- +2.50.1