Repository navigation
pyroaring: add build-pyroaring.yml for riscv64 wheels #2
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 | |
| --- | |
| # This workflow is based on the `build_wheels` job of | |
| # https://github.com/Ezibenroc/PyRoaringBitMap/blob/1.1.0/.github/workflows/buildwheels.yml | |
| name: Build pyroaring wheels (riscv64) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'pyroaring version to build (git tag, e.g. 1.1.0)' | |
| required: true | |
| default: '1.1.0' | |
| pull_request: | |
| paths: | |
| - '.github/workflows/build-pyroaring.yml' | |
| - 'patches/pyroaring/**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ inputs.version || '1.1.0' }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read # to fetch code (actions/checkout) | |
| env: | |
| PYROARING_VERSION: ${{ inputs.version || '1.1.0' }} | |
| MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 | |
| jobs: | |
| build_wheels: | |
| name: Build pyroaring ${{ inputs.version || '1.1.0' }} ${{ matrix.python }}-manylinux_riscv64 | |
| runs-on: ubuntu-24.04-riscv | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - python: "cp312" | |
| hypothesis: "hypothesis" | |
| - python: "cp313" | |
| hypothesis: "hypothesis" | |
| - python: "cp314" | |
| hypothesis: "hypothesis" | |
| # hypothesis is a Rust extension since 6.156 and its riscv64 wheels are | |
| # abi3-only, so free-threaded builds fall back to the sdist, whose backend | |
| # asks rustup for a target triple it does not name. 6.155.7 is the last | |
| # pure-Python release. | |
| - python: "cp314t" | |
| hypothesis: "hypothesis<6.156" | |
| steps: | |
| - name: Checkout pyroaring ${{ env.PYROARING_VERSION }} | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| repository: Ezibenroc/PyRoaringBitMap | |
| ref: ${{ env.PYROARING_VERSION }} | |
| persist-credentials: false | |
| - name: Checkout python-wheels | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| path: python-wheels | |
| persist-credentials: false | |
| # The wheel statically links the bundled CRoaring amalgamation but ships only | |
| # pyroaring's own LICENSE. | |
| - name: Patch pyroaring source | |
| run: | | |
| git apply python-wheels/patches/pyroaring/${{ env.PYROARING_VERSION }}/00*.patch | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 | |
| with: | |
| output-dir: wheelhouse/ | |
| only: ${{ matrix.python }}-manylinux_riscv64 | |
| env: | |
| CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} | |
| CIBW_BUILD_FRONTEND: build | |
| CIBW_TEST_REQUIRES: ${{ matrix.hypothesis }} pytest | |
| CIBW_TEST_COMMAND: >- | |
| python -c "import importlib.metadata as m; n=sorted(p.name for p in m.files('pyroaring') if 'licenses/' in str(p)); assert n == ['LICENSE', 'LICENSE.CRoaring'], n" && | |
| pytest {project}/test.py -v && | |
| python {project}/cydoctest.py -v | |
| - name: Check the compiled extension made it into the wheel | |
| run: | | |
| python3 - wheelhouse/*.whl <<'EOF' | |
| import sys, zipfile | |
| for whl in sys.argv[1:]: | |
| names = zipfile.ZipFile(whl).namelist() | |
| assert any(n.startswith("pyroaring.") and n.endswith(".so") for n in names), whl | |
| print(whl, "ok") | |
| EOF | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: pyroaring-${{ env.PYROARING_VERSION }}-${{ matrix.python }}-manylinux_riscv64 | |
| path: wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish: | |
| name: Publish pyroaring ${{ inputs.version || '1.1.0' }} to GitLab | |
| needs: [build_wheels] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Publish wheels and open docs PR | |
| uses: riseproject-dev/python-wheels/actions/publish-wheels@main | |
| with: | |
| artifact-pattern: pyroaring-${{ env.PYROARING_VERSION }}-*-manylinux_riscv64 | |
| gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }} | |
| gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }} | |
| gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }} | |
| gh-token: ${{ secrets.GITHUB_TOKEN }} |