From cc467cdd34f50218e05ec6586813dd40cb3e3c91 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Mon, 7 Sep 2026 00:13:45 +0200 Subject: [PATCH] cwcwidth: add build-cwcwidth.yml for riscv64 wheels Mirrors upstream's own two-pass cibuildwheel setup: one abi3 wheel built on cp311 (upstream's own py_limited_api floor, hardcoded in setup.py) and reused on cp312/cp313/cp314, plus a separate cp314t free-threaded build. --- .github/workflows/build-cwcwidth.yml | 117 +++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 .github/workflows/build-cwcwidth.yml diff --git a/.github/workflows/build-cwcwidth.yml b/.github/workflows/build-cwcwidth.yml new file mode 100644 index 000000000000..5a66018b10a1 --- /dev/null +++ b/.github/workflows/build-cwcwidth.yml @@ -0,0 +1,117 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on upstream's own wheel builder: +# https://github.com/sebastinas/cwcwidth/blob/v0.1.12/.github/workflows/publish-twine.yaml +name: Build cwcwidth wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'cwcwidth version to build (git tag without leading v, e.g. 0.1.12)' + required: true + default: '0.1.12' + pull_request: + paths: + - '.github/workflows/build-cwcwidth.yml' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '0.1.12' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + # `inputs.version` is empty on pull_request events; default to 0.1.12 there. + CWCWIDTH_VERSION: ${{ inputs.version || '0.1.12' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + # setup.py hardcodes py_limited_api="cp311" whenever USE_LIMITED_API is set, so + # the wheel is tagged cp311-abi3 regardless of which interpreter builds it. + # Build on cp311 itself (CLAUDE.md gotcha 96) rather than our usual cp312 floor, + # then reuse+test that wheel on cp312/cp313/cp314 (find_compatible_wheel). + build_abi3: + needs: [setup] + name: Build cwcwidth ${{ inputs.version || '0.1.12' }} cp311-abi3-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 90 + steps: + - name: Checkout cwcwidth v${{ env.CWCWIDTH_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: sebastinas/cwcwidth + ref: v${{ env.CWCWIDTH_VERSION }} + persist-credentials: false + + - name: Build and test wheel + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + env: + CIBW_ARCHS: riscv64 + CIBW_BUILD: 'cp311-* cp312-* cp313-* cp314-*' + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + CIBW_ENVIRONMENT: USE_LIMITED_API=1 + # tests/ is a package (has __init__.py): pytest's prepend import mode + # would otherwise put the checkout root on sys.path[0] and shadow the + # installed wheel with the uncompiled cwcwidth/ source tree. + CIBW_TEST_SOURCES: tests + CIBW_TEST_REQUIRES: pytest + CIBW_TEST_COMMAND: pytest tests -v + CIBW_TEST_ENVIRONMENT: LC_ALL=C.UTF-8 LANG=C.UTF-8 + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: cwcwidth-${{ env.CWCWIDTH_VERSION }}-cp311-abi3-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + # Free-threaded wheel: setup.py's py_limited_api flag has no free-threaded ABI + # to target, so this is an ordinary per-interpreter build. + build_freethreaded: + needs: [setup] + name: Build cwcwidth ${{ inputs.version || '0.1.12' }} cp314t-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 90 + steps: + - name: Checkout cwcwidth v${{ env.CWCWIDTH_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: sebastinas/cwcwidth + ref: v${{ env.CWCWIDTH_VERSION }} + persist-credentials: false + + - name: Build and test wheel + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + env: + CIBW_ARCHS: riscv64 + CIBW_BUILD: 'cp314t-*' + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + CIBW_TEST_SOURCES: tests + CIBW_TEST_REQUIRES: pytest + CIBW_TEST_COMMAND: pytest tests -v + CIBW_TEST_ENVIRONMENT: LC_ALL=C.UTF-8 LANG=C.UTF-8 + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: cwcwidth-${{ env.CWCWIDTH_VERSION }}-cp314t-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish cwcwidth ${{ inputs.version || '0.1.12' }} + needs: [setup, build_abi3, build_freethreaded] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: cwcwidth-${{ inputs.version || '0.1.12' }}-*-manylinux_riscv64