Skip to content

Commit 58536b5

Browse files
authored
cmeel-zlib: Add version 1.3.2 (#2153)
1 parent c34d2f2 commit 58536b5

2 files changed

Lines changed: 140 additions & 0 deletions

File tree

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow is based on: https://github.com/cmake-wheel/cmeel-zlib/blob/v1.3.2.c0/.github/workflows/release.yml
5+
name: Build cmeel-zlib wheels (riscv64)
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
version:
11+
description: 'Version glob to (re)build; empty builds every version of docs/packages/cmeel-zlib.yaml not released yet'
12+
required: false
13+
default: ''
14+
pull_request:
15+
branches: [main]
16+
paths:
17+
- '.github/workflows/build-cmeel-zlib.yml'
18+
- 'docs/packages/cmeel-zlib.yaml'
19+
push:
20+
branches: [main]
21+
paths:
22+
- '.github/workflows/build-cmeel-zlib.yml'
23+
- 'docs/packages/cmeel-zlib.yaml'
24+
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
27+
cancel-in-progress: true
28+
29+
permissions:
30+
contents: read # to fetch code (actions/checkout)
31+
32+
env:
33+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
34+
35+
jobs:
36+
setup:
37+
uses: $/.github/workflows/_setup.yml
38+
with:
39+
package: cmeel-zlib
40+
version: ${{ inputs.version }}
41+
42+
build_wheels:
43+
needs: [setup]
44+
if: needs.setup.outputs.versions != '[]'
45+
name: Build cmeel-zlib ${{ matrix.version }} manylinux_riscv64
46+
runs-on: ubuntu-24.04-riscv
47+
timeout-minutes: 120
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
52+
53+
env:
54+
CMEEL_ZLIB_VERSION: ${{ matrix.version }}
55+
56+
steps:
57+
# The wheel holds no Python extension ([tool.cmeel] has-sitelib = false), so one
58+
# py3-none-manylinux_riscv64 wheel covers every interpreter.
59+
- name: Checkout cmeel-zlib v${{ env.CMEEL_ZLIB_VERSION }}.c0
60+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
61+
with:
62+
repository: cmake-wheel/cmeel-zlib
63+
ref: v${{ env.CMEEL_ZLIB_VERSION }}.c0
64+
submodules: true
65+
persist-credentials: false
66+
67+
- name: Build wheels
68+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
69+
with:
70+
output-dir: wheelhouse/
71+
only: cp312-manylinux_riscv64
72+
env:
73+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
74+
CIBW_ENVIRONMENT: CMEEL_LOG_LEVEL=DEBUG
75+
# cmeel installs into a shared prefix with an $ORIGIN RPATH it sets itself.
76+
CIBW_REPAIR_WHEEL_COMMAND: ""
77+
78+
- name: Check wheel contents
79+
run: |
80+
python3 - wheelhouse/*.whl <<'EOF'
81+
import sys, zipfile
82+
names = zipfile.ZipFile(sys.argv[1]).namelist()
83+
assert "cmeel.prefix/lib64/libz.so.1.3.2" in names, names
84+
assert "cmeel.prefix/include/zlib.h" in names, names
85+
EOF
86+
87+
- name: Smoke-test the built library
88+
run: |
89+
sudo apt-get update -qq
90+
sudo apt-get install -y -qq --no-install-recommends python3-venv
91+
python3 -m venv .venv
92+
. .venv/bin/activate
93+
# gotcha 234: stock Ubuntu 24.04 apt pip (24.0) has zero manylinux_*_riscv64
94+
# tags, so it rejects the riscv64 wheel outright without upgrading first.
95+
pip install -q --upgrade pip
96+
pip install -q wheelhouse/*.whl
97+
python3 -c "
98+
import ctypes, pathlib, sysconfig
99+
lib = pathlib.Path(sysconfig.get_paths()['purelib']) / 'cmeel.prefix/lib64/libz.so'
100+
z = ctypes.CDLL(str(lib))
101+
z.zlibVersion.restype = ctypes.c_char_p
102+
assert z.zlibVersion() == b'1.3.2', z.zlibVersion()
103+
raw = b'riscv64 ' * 4096
104+
buf = ctypes.create_string_buffer(len(raw) * 2)
105+
size = ctypes.c_ulong(len(buf))
106+
assert z.compress2(buf, ctypes.byref(size), raw, len(raw), 9) == 0
107+
out = ctypes.create_string_buffer(len(raw))
108+
outsize = ctypes.c_ulong(len(out))
109+
assert z.uncompress(out, ctypes.byref(outsize), buf, size) == 0
110+
assert out.raw[:outsize.value] == raw
111+
print(lib, z.zlibVersion(), size.value)
112+
"
113+
114+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
115+
with:
116+
name: cmeel-zlib-${{ env.CMEEL_ZLIB_VERSION }}-py3-none-manylinux_riscv64
117+
path: wheelhouse/*.whl
118+
if-no-files-found: error
119+
120+
publish:
121+
name: Publish cmeel-zlib ${{ matrix.version }}
122+
needs: [setup, build_wheels]
123+
if: needs.setup.outputs.versions != '[]'
124+
strategy:
125+
fail-fast: false
126+
matrix:
127+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
128+
permissions:
129+
contents: write
130+
pull-requests: write
131+
uses: $/.github/workflows/_publish-wheel.yml
132+
secrets:
133+
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
134+
with:
135+
artifact-pattern: cmeel-zlib-${{ matrix.version }}-py3-none-manylinux_riscv64

‎docs/packages/cmeel-zlib.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package-name: cmeel-zlib
2+
source-code: https://github.com/cmake-wheel/cmeel-zlib.git
3+
license: Zlib
4+
versions:
5+
- version: 1.3.2

0 commit comments

Comments
 (0)