Skip to content

Commit 176984e

Browse files
committed
datasketches: add build-datasketches.yml for riscv64 wheels
1 parent db3db74 commit 176984e

2 files changed

Lines changed: 154 additions & 0 deletions

File tree

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
From 3a3ab48c3cae8ccb6c07db0a728cec4060821f7c Mon Sep 17 00:00:00 2001
2+
From: Ludovic Henry <git@ludovic.dev>
3+
Date: Tue, 8 Sep 2026 18:46:43 +0200
4+
Subject: [PATCH] Drop const from vector_of_kll_sketches k_/d_ so assignment
5+
operators compile
6+
7+
vector_of_kll_sketches declares k_ and d_ const, but its own out-of-line
8+
operator= (copy) and operator= (move) both assign to them
9+
(k_ = copy.k_; d_ = copy.d_;), which is ill-formed - assigning to a
10+
const member outside of initialization. GCC 13 (the manylinux_riscv64
11+
image's compiler) instantiates and rejects both operators while
12+
building the vector_of_kll_ints_sketches/vector_of_kll_floats_sketches
13+
nanobind bindings:
14+
15+
src/vector_of_kll.cpp:146:6: error: assignment of read-only member
16+
'datasketches::vector_of_kll_sketches<T, C>::k_'
17+
18+
Reproduces identically with the same compiler on manylinux_2_39_aarch64
19+
(no riscv64 involvement) and is unrelated to nanobind's version: this
20+
tag's CMakeLists.txt pins no nanobind ceiling, main is unchanged since
21+
this file was last touched, and it is not riscv64-specific.
22+
23+
Upstream-Status: To upstream [python-wheels only files issues/PRs against riseproject-dev/python-wheels; not yet reported to apache/datasketches-python]
24+
25+
Signed-off-by: Ludovic Henry <git@ludovic.dev>
26+
---
27+
src/vector_of_kll.cpp | 4 ++--
28+
1 file changed, 2 insertions(+), 2 deletions(-)
29+
30+
diff --git a/src/vector_of_kll.cpp b/src/vector_of_kll.cpp
31+
index 3bbe17b..7013915 100644
32+
--- a/src/vector_of_kll.cpp
33+
+++ b/src/vector_of_kll.cpp
34+
@@ -104,8 +104,8 @@ class vector_of_kll_sketches {
35+
template<typename TT>
36+
Array2D<TT> make_ndarray(size_t rows, size_t cols) const;
37+
38+
- const uint32_t k_; // kll sketch k parameter
39+
- const uint32_t d_; // number of dimensions (here: sketches) to hold
40+
+ uint32_t k_; // kll sketch k parameter
41+
+ uint32_t d_; // number of dimensions (here: sketches) to hold
42+
std::vector<kll_sketch<T, C>> sketches_;
43+
};
44+
45+
--
46+
2.50.1 (Apple Git-155)
47+

0 commit comments

Comments
 (0)