Skip to content

Commit dbd04a1

Browse files
authored
blurhash-python: add build-blurhash-python.yml for riscv64 wheels (#1462)
* **Package**: `blurhash-python` * **Version**: `1.2.2` * **Source**: https://github.com/woltapp/blurhash-python * **Docs**: https://blurha.sh Compiles a CFFI extension implementing the BlurHash image-placeholder encode/decode algorithm. Upstream publishes no riscv64 wheel. Mirrors upstream's own wheel builder ([`build.sh`](https://github.com/woltapp/blurhash-python/blob/v1.2.2/build.sh)/[`container-build.sh`](https://github.com/woltapp/blurhash-python/blob/v1.2.2/container-build.sh)): per-interpreter `pip wheel` + `auditwheel repair`. **Differs from upstream** - Preinstalls cffi/setuptools-scm and disables build isolation - `setup.py`'s `setup_requires` can't see our registry. **Testing** - same as upstream **License**: OK Built on cp314; 18 passed.
1 parent d8837a1 commit dbd04a1

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# Based on upstream's own wheel builder (build.sh/container-build.sh):
5+
# https://github.com/woltapp/blurhash-python/blob/v1.2.2/container-build.sh
6+
name: Build blurhash-python wheels (riscv64)
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'blurhash-python version to build (git tag without leading v, e.g. 1.2.2)'
13+
required: true
14+
default: '1.2.2'
15+
pull_request:
16+
paths:
17+
- '.github/workflows/build-blurhash-python.yml'
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ inputs.version || '1.2.2' }}-${{ github.head_ref || github.run_id }}
21+
cancel-in-progress: true
22+
23+
permissions:
24+
contents: read # to fetch code (actions/checkout)
25+
26+
env:
27+
# `inputs.version` is empty on pull_request events; default to 1.2.2 there.
28+
BLURHASH_PYTHON_VERSION: ${{ inputs.version || '1.2.2' }}
29+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
30+
31+
jobs:
32+
setup:
33+
uses: $/.github/workflows/_setup.yml
34+
35+
build_wheels:
36+
needs: [setup]
37+
name: Build blurhash-python ${{ inputs.version || '1.2.2' }} ${{ matrix.python }}-manylinux_riscv64
38+
runs-on: ubuntu-24.04-riscv
39+
timeout-minutes: 60
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
python: ["cp312", "cp313", "cp314", "cp314t"]
44+
45+
steps:
46+
- name: Checkout blurhash-python v${{ env.BLURHASH_PYTHON_VERSION }}
47+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
48+
with:
49+
repository: woltapp/blurhash-python
50+
ref: v${{ env.BLURHASH_PYTHON_VERSION }}
51+
persist-credentials: false
52+
53+
- name: Build wheels
54+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
55+
with:
56+
output-dir: wheelhouse/
57+
env:
58+
CIBW_ARCHS: riscv64
59+
CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64
60+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
61+
# setup.py's setup_requires fetches cffi/setuptools-scm via
62+
# easy_install, which doesn't see our registry; preinstall and
63+
# build against them directly instead.
64+
CIBW_BUILD_FRONTEND: "pip; args: --no-build-isolation"
65+
CIBW_BEFORE_BUILD: pip install cffi setuptools setuptools-scm wheel
66+
CIBW_ENVIRONMENT: >-
67+
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
68+
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_BLURHASH_PYTHON=${{ env.BLURHASH_PYTHON_VERSION }}
69+
CIBW_TEST_EXTRAS: testing
70+
# test_invalid_image opens README.md as a non-image file; tests/
71+
# loads its fixture PNGs by relative path, matching upstream's own
72+
# `pytest` invocation from the repo root.
73+
CIBW_TEST_SOURCES: tests README.md
74+
CIBW_TEST_COMMAND: pytest tests
75+
76+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
77+
with:
78+
name: blurhash-python-${{ env.BLURHASH_PYTHON_VERSION }}-${{ matrix.python }}-manylinux_riscv64
79+
path: wheelhouse/*.whl
80+
if-no-files-found: error
81+
82+
publish:
83+
name: Publish blurhash-python ${{ inputs.version || '1.2.2' }}
84+
needs: [setup, build_wheels]
85+
permissions:
86+
contents: write
87+
pull-requests: write
88+
uses: $/.github/workflows/_publish-wheel.yml
89+
with:
90+
artifact-pattern: blurhash-python-${{ inputs.version || '1.2.2' }}-*-manylinux_riscv64

0 commit comments

Comments
 (0)