From 38a85ecace4d087be3b81782307c963f00d31144 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 15 Oct 2026 19:25:15 +0000 Subject: [PATCH] port: add chafa.py riscv64 wheel build Builds libchafa from source via upstream's own cibuildwheel recipe (pyproject.toml's [tool.cibuildwheel]), narrowed to manylinux_riscv64, dropping only the EPEL install (no riscv64 repo) from the before-all chain. --- .github/workflows/build-chafa-py.yml | 124 +++++++++++++++++++++++++++ docs/packages/chafa-py.yaml | 5 ++ 2 files changed, 129 insertions(+) create mode 100644 .github/workflows/build-chafa-py.yml create mode 100644 docs/packages/chafa-py.yaml diff --git a/.github/workflows/build-chafa-py.yml b/.github/workflows/build-chafa-py.yml new file mode 100644 index 000000000000..201a8f66924c --- /dev/null +++ b/.github/workflows/build-chafa-py.yml @@ -0,0 +1,124 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on: +# https://github.com/GuardKenzie/chafa.py/blob/main/.github/workflows/build_wheels.yml, +# which drives pyproject.toml's own [tool.cibuildwheel] config (clones and builds +# libchafa from source, then bundles it via a hatchling build hook). +name: Build chafa.py wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/chafa-py.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-chafa-py.yml' + - 'docs/packages/chafa-py.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-chafa-py.yml' + - 'docs/packages/chafa-py.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + # Latest tagged libchafa release (upstream's own CI floats CHAFA_VERSION=master, + # which isn't reproducible here). + CHAFA_VERSION: '1.18.3' + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: chafa-py + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build chafa.py ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 120 + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + python: ["cp312", "cp313", "cp314", "cp314t"] + + env: + CHAFA_PY_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout chafa.py v${{ env.CHAFA_PY_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: GuardKenzie/chafa.py + ref: v${{ env.CHAFA_PY_VERSION }} + persist-credentials: false + + - name: Install uv + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + python-version: '3.12' + activate-environment: true + enable-cache: false + + - name: Build and test wheel + env: + CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64 + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # Same as upstream's [tool.cibuildwheel.linux] before-all, minus + # epel-release: EPEL carries no riscv64 repo (gotcha 51), and it would + # otherwise abort the && chain before libchafa is even cloned. + CIBW_BEFORE_ALL_LINUX: >- + dnf group install -y 'Development Tools' && + dnf install -y ImageMagick-devel glib2-devel pkgconf-pkg-config && + cd libs && + git clone --branch $CHAFA_VERSION https://github.com/hpjansson/chafa libchafa_src && + cd libchafa_src && + mkdir m4 && + cp /usr/share/aclocal/pkg.m4 m4/ && + ./autogen.sh --without-tools && + make && + cd ../ && + cp libchafa_src/chafa/.libs/*chafa.so linux/ + CIBW_ENVIRONMENT_PASS_LINUX: CHAFA_VERSION + run: | + set -euo pipefail + uv pip install --upgrade cibuildwheel + python -m cibuildwheel --output-dir wheelhouse . + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: chafa-py-${{ env.CHAFA_PY_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: ./wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish chafa.py ${{ matrix.version }} + needs: [setup, build_wheels] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + secrets: + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} + with: + artifact-pattern: chafa-py-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/chafa-py.yaml b/docs/packages/chafa-py.yaml new file mode 100644 index 000000000000..2e80cf5f9df6 --- /dev/null +++ b/docs/packages/chafa-py.yaml @@ -0,0 +1,5 @@ +package-name: chafa.py +source-code: https://github.com/GuardKenzie/chafa.py +license: LGPL-3.0 +versions: +- version: 1.2.0