|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# Mirrors the Linux core of upstream's .github/workflows/build_wheels.yml. |
| 5 | +name: Build datasketches wheels (riscv64) |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + version: |
| 11 | + description: 'datasketches version to build (git tag, e.g. 5.2.0)' |
| 12 | + required: true |
| 13 | + default: '5.2.0' |
| 14 | + pull_request: |
| 15 | + paths: |
| 16 | + - '.github/workflows/build-datasketches.yml' |
| 17 | + - 'patches/datasketches/**' |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ inputs.version || '5.2.0' }}-${{ github.head_ref || github.run_id }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: read # to fetch code (actions/checkout) |
| 25 | + |
| 26 | +env: |
| 27 | + DATASKETCHES_VERSION: ${{ inputs.version || '5.2.0' }} |
| 28 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 29 | + MUSLLINUX_RISCV64_IMAGE: quay.io/pypa/musllinux_1_2_riscv64 |
| 30 | + |
| 31 | +jobs: |
| 32 | + setup: |
| 33 | + uses: $/.github/workflows/_setup.yml |
| 34 | + |
| 35 | + build_wheels: |
| 36 | + needs: [setup] |
| 37 | + name: Build datasketches ${{ inputs.version || '5.2.0' }} ${{ matrix.python }}-${{ matrix.libc }}_riscv64 |
| 38 | + runs-on: ubuntu-24.04-riscv |
| 39 | + timeout-minutes: 120 |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + matrix: |
| 43 | + python: ["cp312", "cp313", "cp314", "cp314t"] |
| 44 | + libc: [manylinux, musllinux] |
| 45 | + |
| 46 | + steps: |
| 47 | + - name: Checkout apache/datasketches-python ${{ env.DATASKETCHES_VERSION }} |
| 48 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 49 | + with: |
| 50 | + repository: apache/datasketches-python |
| 51 | + ref: ${{ env.DATASKETCHES_VERSION }} |
| 52 | + persist-credentials: false |
| 53 | + |
| 54 | + - name: Checkout python-wheels |
| 55 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 56 | + with: |
| 57 | + path: python-wheels |
| 58 | + persist-credentials: false |
| 59 | + |
| 60 | + # vector_of_kll_sketches's own operator= assigns to its const k_/d_ members, |
| 61 | + # which GCC 13 rejects when instantiating the nanobind bindings (not riscv64-specific, |
| 62 | + # reproduces on any manylinux arch; gotcha 23 shape). |
| 63 | + - name: Patch datasketches source |
| 64 | + run: git apply python-wheels/patches/datasketches/${{ env.DATASKETCHES_VERSION }}/00*.patch |
| 65 | + |
| 66 | + - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 67 | + env: |
| 68 | + CIBW_ARCHS: riscv64 |
| 69 | + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.libc }}_riscv64 |
| 70 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 71 | + CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }} |
| 72 | + CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ |
| 73 | + CIBW_TEST_REQUIRES: pytest |
| 74 | + # tests/ has __init__.py, and the checkout root's own datasketches/ package |
| 75 | + # (source, no compiled _datasketches) would shadow the installed wheel if |
| 76 | + # pytest ran from the checkout (gotcha 25); stage only tests/ into an empty cwd. |
| 77 | + CIBW_TEST_SOURCES: tests |
| 78 | + CIBW_TEST_COMMAND: python -m pytest tests |
| 79 | + |
| 80 | + - name: Check wheel contents |
| 81 | + run: | |
| 82 | + python3 - wheelhouse/*.whl <<'EOF' |
| 83 | + import sys, zipfile |
| 84 | + path = sys.argv[1] |
| 85 | + names = zipfile.ZipFile(path).namelist() |
| 86 | + exts = [n for n in names if n.endswith(".so")] |
| 87 | + assert exts and all("_datasketches" in n for n in exts), exts |
| 88 | + licences = {n.split(".dist-info/licenses/", 1)[1] for n in names |
| 89 | + if ".dist-info/licenses/" in n and not n.endswith("/")} |
| 90 | + assert "LICENSE" in licences, licences |
| 91 | + EOF |
| 92 | +
|
| 93 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 94 | + with: |
| 95 | + name: datasketches-${{ env.DATASKETCHES_VERSION }}-${{ matrix.python }}-${{ matrix.libc }}_riscv64 |
| 96 | + path: ./wheelhouse/*.whl |
| 97 | + if-no-files-found: error |
| 98 | + |
| 99 | + publish: |
| 100 | + name: Publish datasketches ${{ inputs.version || '5.2.0' }} |
| 101 | + needs: [setup, build_wheels] |
| 102 | + permissions: |
| 103 | + contents: write |
| 104 | + pull-requests: write |
| 105 | + uses: $/.github/workflows/_publish-wheel.yml |
| 106 | + with: |
| 107 | + artifact-pattern: datasketches-${{ inputs.version || '5.2.0' }}-*riscv64 |
0 commit comments