Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions .github/workflows/build-chafa-py.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions docs/packages/chafa-py.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading