Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .github/workflows/build-rocksdict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on: https://github.com/rocksdict/RocksDict/blob/v0.3.29/.github/workflows/CI.yml
name: Build rocksdict wheels (riscv64)

on:
workflow_dispatch:
inputs:
version:
description: 'rocksdict version to build (git tag without leading v, e.g. 0.3.29)'
required: true
default: '0.3.29'
pull_request:
paths:
- '.github/workflows/build-rocksdict.yml'

concurrency:
group: ${{ github.workflow }}-${{ inputs.version || '0.3.29' }}-${{ 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.3.29 there.
ROCKSDICT_VERSION: ${{ inputs.version || '0.3.29' }}
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10

jobs:
setup:
uses: $/.github/workflows/_setup.yml

build_wheels:
needs: [setup]
name: Build rocksdict ${{ inputs.version || '0.3.29' }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 1440
strategy:
fail-fast: false
matrix:
# pyo3 carries no abi3 feature here, so upstream ships one cp3x-cp3x
# wheel per interpreter (like build-fastuuid.yml) - repo-standard set.
# musllinux is dropped: rustup.rs ships no riscv64 musl toolchain.
python: ["cp312", "cp313", "cp314", "cp314t"]

steps:
- name: Checkout rocksdict v${{ env.ROCKSDICT_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: rocksdict/RocksDict
ref: v${{ env.ROCKSDICT_VERSION }}
submodules: recursive
persist-credentials: false

# Same OOM guard build-deltalake.yml/build-lancedb.yml need on these
# runners for a large native C++ build (RocksDB itself, here).
- name: Set swap space
uses: pierotofy/set-swap-space@fc79b3f67fa8a838184ce84a674ca12238d2c761 # master
with:
swap-size-gb: 10

- name: Build wheel
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 }}
# librocksdb-sys's build.rs always runs bindgen against RocksDB's C
# header; clang-devel supplies the libclang.so it dlopens (same as
# build-pymupdf.yml). Toolchain version pinned to match upstream's
# own CI (actions-rs/toolchain: 1.91.1).
CIBW_BEFORE_ALL_LINUX: >-
dnf install -y clang-devel &&
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs |
sh -s -- -y --default-toolchain 1.91.1
# Upstream's own manylinux/macOS/musllinux jobs build with the
# default `lto` Cargo feature on, but that requires `CC=clang` or
# librocksdb-sys's build.rs panics ("LTO is only supported with
# clang") and upstream's own manylinux jobs only get it because of a
# bespoke prebuilt clang+lld container we don't have for riscv64.
# Their own Windows job hits the same constraint and ships the
# identical `--no-default-features --features bindgen-runtime`
# shape used here, so this is upstream's own fallback, not an
# invented one.
CIBW_ENVIRONMENT_LINUX: >-
PATH="$PATH:$HOME/.cargo/bin"
MATURIN_PEP517_ARGS="--no-default-features --features bindgen-runtime"
CARGO_BUILD_JOBS=2
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
CIBW_TEST_COMMAND: >-
python -m unittest discover -v {package}/test
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: rocksdict-${{ env.ROCKSDICT_VERSION }}-${{ matrix.python }}-manylinux_riscv64
path: wheelhouse/*.whl
if-no-files-found: error

publish:
name: Publish rocksdict ${{ inputs.version || '0.3.29' }}
needs: [setup, build_wheels]
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
with:
artifact-pattern: rocksdict-${{ inputs.version || '0.3.29' }}-*-manylinux_riscv64