Skip to content

Commit fe286e7

Browse files
committed
hdiffpatch: add build-hdiffpatch.yml for riscv64 wheels
Adds a cibuildwheel-based riscv64 build for hdiffpatch 2.6.0, mirroring upstream's own build_wheels.yaml linux job. Stages the vendored third-party codec licences (zstd, tinyuz, brotli, lzham_codec, tamp, bzip2, zlib, lz4, libdeflate, libmd5, lzma) at the project root so the default license-files glob picks them up, since upstream's own wheel ships only its wrapper LICENSE. Signed-off-by: Ludovic Henry <git@ludovic.dev>
1 parent 03dcc33 commit fe286e7

2 files changed

Lines changed: 129 additions & 0 deletions

File tree

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow is based on the `build_wheels_linux` job of
5+
# https://github.com/BrianPugh/hdiffpatch-python/blob/v2.6.0/.github/workflows/build_wheels.yaml
6+
name: Build hdiffpatch wheels (riscv64)
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'Version glob to (re)build; empty builds every version of docs/packages/hdiffpatch.yaml not released yet'
13+
required: false
14+
default: ''
15+
pull_request:
16+
branches: [main]
17+
paths:
18+
- '.github/workflows/build-hdiffpatch.yml'
19+
- 'docs/packages/hdiffpatch.yaml'
20+
push:
21+
branches: [main]
22+
paths:
23+
- '.github/workflows/build-hdiffpatch.yml'
24+
- 'docs/packages/hdiffpatch.yaml'
25+
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
28+
cancel-in-progress: true
29+
30+
permissions:
31+
contents: read # to fetch code (actions/checkout)
32+
33+
env:
34+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
35+
36+
jobs:
37+
setup:
38+
uses: $/.github/workflows/_setup.yml
39+
with:
40+
package: hdiffpatch
41+
version: ${{ inputs.version }}
42+
43+
build_wheels:
44+
needs: [setup]
45+
if: needs.setup.outputs.versions != '[]'
46+
name: Build hdiffpatch ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
47+
runs-on: ubuntu-24.04-riscv
48+
timeout-minutes: 90
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
53+
python: ["cp312", "cp313", "cp314", "cp314t"]
54+
55+
env:
56+
HDIFFPATCH_VERSION: ${{ matrix.version }}
57+
58+
steps:
59+
- name: Checkout hdiffpatch v${{ env.HDIFFPATCH_VERSION }}
60+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
61+
with:
62+
repository: BrianPugh/hdiffpatch-python
63+
ref: v${{ env.HDIFFPATCH_VERSION }}
64+
submodules: recursive
65+
persist-credentials: false
66+
67+
# setup.py compiles HDiffPatch core, zstd, tinyuz, brotli, lzham_codec,
68+
# tamp, lzma, bzip2, zlib, lz4 and libdeflate straight from their
69+
# vendored submodules, but the wheel ships only hdiffpatch-python's own
70+
# Apache-2.0 LICENSE at the project root. The default LICEN[CS]E*/
71+
# COPYING* glob (PEP 639, no license-files override in pyproject.toml)
72+
# picks up anything added here with no packaging change.
73+
- name: Stage the vendored dependencies' licences
74+
run: |
75+
set -euo pipefail
76+
cp hdiffpatch/_c_src/HDiffPatch/LICENSE LICENSE.hdiffpatch-core
77+
cp hdiffpatch/_c_src/zstd/LICENSE LICENSE.zstd
78+
cp hdiffpatch/_c_src/zstd/COPYING COPYING.zstd
79+
cp hdiffpatch/_c_src/tinyuz/LICENSE LICENSE.tinyuz
80+
cp hdiffpatch/_c_src/brotli/LICENSE LICENSE.brotli
81+
cp hdiffpatch/_c_src/lzham_codec/LICENSE LICENSE.lzham-codec
82+
cp hdiffpatch/_c_src/tamp/LICENSE LICENSE.tamp
83+
cp hdiffpatch/_c_src/bzip2/LICENSE LICENSE.bzip2
84+
cp hdiffpatch/_c_src/zlib/LICENSE LICENSE.zlib
85+
cp hdiffpatch/_c_src/lz4/LICENSE LICENSE.lz4
86+
cp hdiffpatch/_c_src/libdeflate/COPYING COPYING.libdeflate
87+
# libmd5 and the lzma submodule carry no standalone LICENSE file;
88+
# reproduce the notice each actually carries (zlib-style header
89+
# comment, LZMA SDK's public-domain doc section).
90+
sed -n '1,21p' hdiffpatch/_c_src/libmd5/md5.h > LICENSE.libmd5
91+
sed -n '27,38p' hdiffpatch/_c_src/lzma/DOC/lzma-sdk.txt > LICENSE.lzma
92+
93+
- uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
94+
env:
95+
CIBW_ARCHS: riscv64
96+
CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64
97+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
98+
CIBW_TEST_REQUIRES: pytest
99+
CIBW_TEST_COMMAND: >-
100+
python -c "import hdiffpatch._c_extension as m; assert m.__file__.endswith('.so'), m.__file__" &&
101+
python -m pytest {package}/tests
102+
103+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
104+
with:
105+
name: hdiffpatch-${{ env.HDIFFPATCH_VERSION }}-${{ matrix.python }}-manylinux_riscv64
106+
path: ./wheelhouse/*.whl
107+
if-no-files-found: error
108+
109+
publish:
110+
name: Publish hdiffpatch ${{ matrix.version }}
111+
needs: [setup, build_wheels]
112+
if: needs.setup.outputs.versions != '[]'
113+
strategy:
114+
fail-fast: false
115+
matrix:
116+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
117+
permissions:
118+
contents: write
119+
pull-requests: write
120+
uses: $/.github/workflows/_publish-wheel.yml
121+
secrets:
122+
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
123+
with:
124+
artifact-pattern: hdiffpatch-${{ matrix.version }}-*-manylinux_riscv64

‎docs/packages/hdiffpatch.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package-name: hdiffpatch
2+
source-code: https://github.com/BrianPugh/hdiffpatch-python
3+
license: Apache-2.0
4+
versions:
5+
- version: 2.6.0

0 commit comments

Comments
 (0)