Skip to content
Merged
Show file tree
Hide file tree
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
98 changes: 98 additions & 0 deletions .github/workflows/build-intbitset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on the `build_wheels` job of
# https://github.com/inveniosoftware-contrib/intbitset/blob/v4.1.2/.github/workflows/test-and-build.yml
name: Build intbitset wheels (riscv64)

on:
workflow_dispatch:
inputs:
version:
description: 'intbitset version to build (git tag, e.g. v4.1.2)'
required: true
default: 'v4.1.2'
pull_request:
paths:
- '.github/workflows/build-intbitset.yml'

concurrency:
group: ${{ github.workflow }}-${{ inputs.version || 'v4.1.2' }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

env:
INTBITSET_VERSION: ${{ inputs.version || 'v4.1.2' }}
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64

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

build_wheels:
needs: [setup]
name: Build intbitset ${{ inputs.version || 'v4.1.2' }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
strategy:
fail-fast: false
matrix:
python:
- "cp312"
- "cp313"
- "cp314"
- "cp314t"

steps:
- name: Checkout intbitset ${{ env.INTBITSET_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: inveniosoftware-contrib/intbitset
ref: ${{ env.INTBITSET_VERSION }}
persist-credentials: false

- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: python-wheels
persist-credentials: false

- name: Patch intbitset source
run: git apply python-wheels/patches/intbitset/${{ env.INTBITSET_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_TEST_REQUIRES: pytest pytest-xdist
CIBW_TEST_COMMAND: pytest {package}/tests -n4

- name: Check the C 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("intbitset.") and n.endswith(".so") for n in names), (whl, names)
print(whl, "ok")
EOF

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: intbitset-${{ env.INTBITSET_VERSION }}-${{ matrix.python }}-manylinux_riscv64
path: wheelhouse/*.whl
if-no-files-found: error

publish:
name: Publish intbitset ${{ inputs.version || 'v4.1.2' }}
needs: [setup, build_wheels]
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
with:
artifact-pattern: intbitset-${{ inputs.version || 'v4.1.2' }}-*-manylinux_riscv64
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 8faa680140e0824c716c234b1e1401d85cd49579 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Mon, 7 Sep 2026 14:18:17 +0200
Subject: [PATCH] test_set_consistency: compare fastdump() by decompressed
content, not exact zlib bytes

fastdump() zlib-compresses intbitset's internal representation via the
stdlib zlib module (intbitset.pyx: return zlib.compress(tmp)), and
test_set_consistency hardcodes the exact compressed byte string it expects
back. deflate does not guarantee identical output across zlib builds - only
that decompressing it recovers the original bytes - so the test is only
stable on whatever zlib build produced the fixture data. manylinux_riscv64
(quay.io/pypa/manylinux_2_39_riscv64) links zlib-ng-compat, which compresses
this input to a functionally identical but byte-different stream, failing
the raw equality on every interpreter (cp313/cp314/cp314t all hit the same
single assertion, 13929/13930 tests otherwise passing).

Comparing zlib.decompress() of both sides keeps the real check - that
fastdump()'s output decodes back to the expected uncompressed
representation - without assuming a specific zlib build's compression
output. intbitset1 == intbitset3 and intbitset2 == intbitset4 (parsing the
same hardcoded dumped bytes back into a set) already cover fastload()'s
correctness independently.

Upstream-Status: To upstream [not submitted from this automated port run; needs a pull request against inveniosoftware-contrib/intbitset]
---
tests/test_intbitset.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/test_intbitset.py b/tests/test_intbitset.py
index 6418b38..c44b0b8 100644
--- a/tests/test_intbitset.py
+++ b/tests/test_intbitset.py
@@ -762,9 +762,9 @@ def test_set_consistency(original, dumped, dumped_trailing_bits):
check_bitset(intbitset3)
check_bitset(intbitset4)

- assert intbitset1.fastdump() == dumped
+ assert zlib.decompress(intbitset1.fastdump()) == zlib.decompress(dumped)
assert intbitset1 == intbitset3
- assert intbitset2.fastdump() == dumped_trailing_bits
+ assert zlib.decompress(intbitset2.fastdump()) == zlib.decompress(dumped_trailing_bits)
assert intbitset2 == intbitset4