Skip to content

Commit 39d1783

Browse files
authored
aiokafka: add build-aiokafka.yml for riscv64 wheels (#858)
* **Package**: `aiokafka` * **Version**: `0.14.0` * **Source**: https://github.com/aio-libs/aiokafka * **Docs**: http://aiokafka.readthedocs.org Compiles the Cython `_crecords` extension (Kafka record batch encode/decode); the rest of the asyncio Kafka client is pure Python. Upstream publishes no riscv64 wheel. Mirrors the `package-wheel` job of [upstream's `publish.yml`](https://github.com/aio-libs/aiokafka/blob/v0.14.0/.github/workflows/publish.yml). **Differs from upstream** - Test dep versions pinned to `requirements-ci.txt` - newer pytest fails `test_requests.py` under this project's `filterwarnings = ["error"]`. - `gssapi` dropped from test deps - needs krb5 headers and is only reached by the docker-backed SASL tests, which are skipped anyway (see Testing). **Testing** - No `--docker-image`, same as upstream's own wheel-test jobs (none run a Kafka broker either); tests needing one skip via upstream's own `kafka_image` fixture. - `CIBW_TEST_SOURCES` stages `tests` + `pyproject.toml` so the repo-root `aiokafka/` can't shadow the installed wheel; upstream's own CI does the equivalent by `rm -rf aiokafka` before testing. - `cramjam` (snappy/lz4/zstd codec backend) is on the registry for riscv64, so those tests run instead of being skipped. **License**: OK Built on cp312; 749 passed, 332 skipped.
1 parent 7f7e6b8 commit 39d1783

1 file changed

Lines changed: 98 additions & 0 deletions

File tree

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow is based on the `package-wheel` job of:
5+
# https://github.com/aio-libs/aiokafka/blob/v0.14.0/.github/workflows/publish.yml
6+
name: Build aiokafka wheels (riscv64)
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'aiokafka version to build (git tag without leading v, e.g. 0.14.0)'
13+
required: true
14+
default: '0.14.0'
15+
pull_request:
16+
paths:
17+
- '.github/workflows/build-aiokafka.yml'
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ inputs.version || '0.14.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+
# `inputs.version` is empty on pull_request events; default to 0.14.0 there.
28+
AIOKAFKA_VERSION: ${{ inputs.version || '0.14.0' }}
29+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
30+
31+
jobs:
32+
setup:
33+
uses: $/.github/workflows/_setup.yml
34+
35+
build_wheels:
36+
needs: [setup]
37+
name: Build aiokafka ${{ inputs.version || '0.14.0' }} ${{ matrix.python }}-manylinux_riscv64
38+
runs-on: ubuntu-24.04-riscv
39+
timeout-minutes: 60
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
# Per-interpreter (not abi3): the Cython extensions link the version-specific ABI.
44+
python:
45+
- "cp312"
46+
- "cp313"
47+
- "cp314"
48+
- "cp314t"
49+
50+
steps:
51+
- name: Checkout aiokafka v${{ env.AIOKAFKA_VERSION }}
52+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
53+
with:
54+
repository: aio-libs/aiokafka
55+
ref: v${{ env.AIOKAFKA_VERSION }}
56+
persist-credentials: false
57+
58+
- name: Build wheels
59+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
60+
with:
61+
output-dir: wheelhouse/
62+
only: ${{ matrix.python }}-manylinux_riscv64
63+
env:
64+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
65+
CIBW_BEFORE_BUILD_LINUX: pip install -r requirements-cython.txt && yum install -y zlib-devel
66+
CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
67+
# The repo-root aiokafka/ would otherwise shadow the installed wheel's
68+
# compiled extension; stage only the suite and its pytest config.
69+
CIBW_TEST_SOURCES: tests pyproject.toml
70+
# Pin to upstream's own requirements-ci.txt versions: newer pytest turns
71+
# test_requests.py's generator-based parametrize into a hard failure under
72+
# this project's `filterwarnings = ["error"]`. gssapi is skipped - it needs
73+
# krb5 headers and is only exercised by the docker-backed SASL tests below.
74+
CIBW_TEST_REQUIRES: >-
75+
pytest==9.0.2 pytest-asyncio==1.3.0 pytest-cov==7.0.0 pytest-mock==3.15.1
76+
docker cramjam
77+
# cp314t: the Cython extensions use single-phase init, so 3.14t re-enables
78+
# the GIL on import and warns; fatal under filterwarnings=["error"] (gotcha 127).
79+
CIBW_TEST_ENVIRONMENT: PIP_ONLY_BINARY=cramjam PYTHON_GIL=1
80+
# No --docker-image: upstream's own wheel-test jobs run this same way, since
81+
# none of them have a Kafka broker either. Tests needing one skip themselves.
82+
CIBW_TEST_COMMAND: python -m pytest tests
83+
84+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
85+
with:
86+
name: aiokafka-${{ env.AIOKAFKA_VERSION }}-${{ matrix.python }}-manylinux_riscv64
87+
path: wheelhouse/*.whl
88+
if-no-files-found: error
89+
90+
publish:
91+
name: Publish aiokafka ${{ inputs.version || '0.14.0' }}
92+
needs: [setup, build_wheels]
93+
permissions:
94+
contents: write
95+
pull-requests: write
96+
uses: $/.github/workflows/_publish-wheel.yml
97+
with:
98+
artifact-pattern: aiokafka-${{ inputs.version || '0.14.0' }}-*-manylinux_riscv64

0 commit comments

Comments
 (0)