pynng: add build-pynng.yml for riscv64 wheels #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: 2026 The RISE Project | |
| # SPDX-License-Identifier: MIT | |
| --- | |
| # Based on upstream's own wheel build: | |
| # https://github.com/codypiersall/pynng/blob/v0.9.0/.github/workflows/cibuildwheel.yml | |
| name: Build pynng wheels (riscv64) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'pynng version to build (git tag without leading v, e.g. 0.9.0)' | |
| required: true | |
| default: '0.9.0' | |
| pull_request: | |
| paths: | |
| - '.github/workflows/build-pynng.yml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ inputs.version || '0.9.0' }}-${{ 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.9.0 there. | |
| PYNNG_VERSION: ${{ inputs.version || '0.9.0' }} | |
| # setup.cfg's own [build_nng]/[build_mbedtls] pins; keep in lockstep with it. | |
| NNG_VERSION: v1.11 | |
| MBEDTLS_VERSION: v3.6.3.1 | |
| MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 | |
| jobs: | |
| setup: | |
| uses: $/.github/workflows/_setup.yml | |
| build_wheels: | |
| needs: [setup] | |
| name: Build pynng ${{ inputs.version || '0.9.0' }} ${{ matrix.python }}-manylinux_riscv64 | |
| runs-on: ubuntu-24.04-riscv | |
| timeout-minutes: 90 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ["cp312", "cp313", "cp314", "cp314t"] | |
| steps: | |
| - name: Checkout pynng v${{ env.PYNNG_VERSION }} | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: codypiersall/pynng | |
| ref: v${{ env.PYNNG_VERSION }} | |
| submodules: recursive | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| # setup.py's build_nng/build_mbedtls commands `git clone` the nng and | |
| # mbedtls C libraries at build time (not submodules); their licences never | |
| # land in the checkout, so fetch them straight from the pinned tags above. | |
| - name: Stage the nng and mbedtls licences | |
| run: | | |
| curl -fsSL -o LICENSE.nng https://raw.githubusercontent.com/nanomsg/nng/${{ env.NNG_VERSION }}/LICENSE.txt | |
| curl -fsSL -o LICENSE.mbedtls https://raw.githubusercontent.com/ARMmbed/mbedtls/${{ env.MBEDTLS_VERSION }}/LICENSE | |
| - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 | |
| env: | |
| CIBW_ARCHS: riscv64 | |
| # cffi has no manylinux musllinux_riscv64 wheel on our registry, so | |
| # musllinux is dropped here too (accepted per the porting playbook). | |
| CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64 | |
| CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} | |
| # cffi, needed to build and to import the extension, has no riscv64 wheel on PyPI. | |
| CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ | |
| CIBW_TEST_REQUIRES: pytest pytest-asyncio pytest-trio trio | |
| CIBW_TEST_COMMAND: >- | |
| python -c "import importlib.metadata as m; l = sorted(str(p).rsplit('/', 1)[-1] for p in m.files('pynng') if '.dist-info/licenses/' in str(p)); assert l == ['LICENSE', 'LICENSE.mbedtls', 'LICENSE.nng'], l" | |
| && pytest {project}/test | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: pynng-${{ env.PYNNG_VERSION }}-${{ matrix.python }}-manylinux_riscv64 | |
| path: ./wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish: | |
| name: Publish pynng ${{ inputs.version || '0.9.0' }} | |
| needs: [setup, build_wheels] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| uses: $/.github/workflows/_publish-wheel.yml | |
| with: | |
| artifact-pattern: pynng-${{ inputs.version || '0.9.0' }}-*-manylinux_riscv64 |