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
102 changes: 102 additions & 0 deletions .github/workflows/build-ncompress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# Based on upstream's own wheel build:
# https://github.com/valgur/ncompress/blob/v1.0.2/.github/workflows/publish.yml
name: Build ncompress wheels (riscv64)

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

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

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

env:
NCOMPRESS_VERSION: ${{ inputs.version || '1.0.2' }}
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
MUSLLINUX_RISCV64_IMAGE: quay.io/pypa/musllinux_1_2_riscv64

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

build_wheels:
needs: [setup]
name: Build ncompress ${{ inputs.version || '1.0.2' }} ${{ matrix.python }}-${{ matrix.libc }}_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
# cp312 wheel is abi3, so only cp314t needs a separate build
python: ["cp312", "cp314t"]
libc: [manylinux, musllinux]

steps:
- name: Checkout ncompress v${{ env.NCOMPRESS_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: valgur/ncompress
ref: v${{ env.NCOMPRESS_VERSION }}
persist-credentials: false

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

# pyproject.toml's build-system.requires floors scikit-build-core at
# >=0.4.3 with no upper bound; 0.8+ removed cmake.minimum-version outright,
# so an isolated build always fails on any architecture.
- name: Patch ncompress source
run: git apply python-wheels/patches/ncompress/${{ env.NCOMPRESS_VERSION }}/00*.patch

- uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
env:
CIBW_ARCHS: riscv64
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.libc }}_riscv64
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }}

- name: Check wheel contents
run: |
python3 - wheelhouse/*.whl <<'EOF'
import sys, zipfile
path = sys.argv[1]
names = zipfile.ZipFile(path).namelist()
exts = [n for n in names if n.endswith(".so")]
assert exts and all("ncompress_core" in n for n in exts), exts
licences = {n.split(".dist-info/licenses/", 1)[1] for n in names
if ".dist-info/licenses/" in n and not n.endswith("/")}
assert licences == {"LICENSE"}, licences
EOF

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

publish:
name: Publish ncompress ${{ inputs.version || '1.0.2' }}
needs: [setup, build_wheels]
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish-wheel.yml
with:
artifact-pattern: ncompress-${{ inputs.version || '1.0.2' }}-*riscv64
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From 582eab15369516c8e0c6ddac0d1be404f2624fe1 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Mon, 7 Sep 2026 14:27:18 +0200
Subject: [PATCH] pyproject.toml: use cmake.version instead of
cmake.minimum-version

scikit-build-core removed the cmake.minimum-version config key
outright at 0.8.0 in favour of cmake.version. pyproject.toml's
build-system.requires only floors scikit-build-core at >=0.4.3 with
no upper bound, so an isolated build always resolves the newest
release and dies at "Getting requirements to build wheel" with:

ERROR: Use cmake.version instead of cmake.minimum-version with
scikit-build-core >= 0.8

Reproduces on any architecture (confirmed on macOS/arm64): this is a
packaging defect in the 1.0.2 release, not a riscv64 gap.
scikit-build-core reads cmake.version the same way
cmake.minimum-version was read.

Upstream-Status: To upstream [not filed against valgur/ncompress from this automated port; a maintainer should report it upstream]
---
pyproject.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index e0b8b74..6c65046 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -41,7 +41,7 @@ build-backend = "scikit_build_core.build"
# after editing C++ files.

[tool.scikit-build]
-cmake.minimum-version = "3.18"
+cmake.version = ">=3.18"
wheel.license-files = ["LICENSE"]
build-dir = "build/{wheel_tag}"
# Build stable ABI wheels for CPython 3.12+
--
2.50.1 (Apple Git-155)

Loading