Skip to content
Merged
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
91 changes: 91 additions & 0 deletions .github/workflows/build-plotext.yml
Original file line number Diff line number Diff line change
@@ -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-<platform>: 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