From 20bf14310583bf1aaacf45e7cb7e3e48a633ad6e Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sun, 6 Sep 2026 19:11:13 +0200 Subject: [PATCH] plotext: add build-plotext.yml for riscv64 wheels plotext's py3-none- wheels are tagged this way because the C++ kernel setup.py compiles is loaded by ctypes rather than an import, not because nothing is compiled (verified: the published Linux wheels carry a real per-arch ELF kernel.so). One cp312 build serves every interpreter. --- .github/workflows/build-plotext.yml | 91 +++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/workflows/build-plotext.yml diff --git a/.github/workflows/build-plotext.yml b/.github/workflows/build-plotext.yml new file mode 100644 index 00000000000..4298fc0a488 --- /dev/null +++ b/.github/workflows/build-plotext.yml @@ -0,0 +1,91 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on: https://github.com/piccolomo/plotext/blob/6.0.0/.github/workflows/wheels.yml +name: Build plotext wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'plotext version to build (git tag, e.g. 6.0.0)' + required: true + default: '6.0.0' + pull_request: + paths: + - '.github/workflows/build-plotext.yml' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '6.0.0' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + PLOTEXT_VERSION: ${{ inputs.version || '6.0.0' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + build_wheels: + needs: [setup] + name: Build plotext ${{ inputs.version || '6.0.0' }} py3-none-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + + steps: + - name: Checkout plotext ${{ env.PLOTEXT_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: piccolomo/plotext + ref: ${{ env.PLOTEXT_VERSION }} + persist-credentials: false + + - name: Build wheel + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + # setup.py's wheel_of_this_system.get_tag() tags the wheel py3-none-: the + # C++ kernel it compiles is loaded by ctypes, not tied to any interpreter, so one + # build serves every Python. + only: cp312-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # Mirrors upstream's own windows.yml unit-test invocation (the Linux wheels.yml + # job only runs pyproject.toml's one-line import smoke test). + CIBW_TEST_COMMAND: >- + python -m unittest plotext._tests.primitives plotext._tests.plots + plotext._tests.dates plotext._tests.fixed_bugs plotext._tests.hashes + plotext.prettydoc._tests.docs plotext.prettydoc._tests.hashes -v + + - name: Check the wheel carries a riscv64 kernel.so + run: | + whl=$(ls wheelhouse/*.whl) + python3 - "$whl" <<'EOF' + import sys, zipfile + whl = sys.argv[1] + target = "plotext/_kernel/cpp/kernel.so" + names = zipfile.ZipFile(whl).namelist() + if target not in names: + raise SystemExit(f"error: {target} missing from {whl}") + zipfile.ZipFile(whl).extract(target, "kernel_check") + EOF + file kernel_check/plotext/_kernel/cpp/kernel.so | tee /dev/stderr | grep -q 'RISC-V' + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: plotext-${{ env.PLOTEXT_VERSION }}-py3-none-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish plotext ${{ inputs.version || '6.0.0' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: plotext-${{ inputs.version || '6.0.0' }}-*-manylinux_riscv64