From 439241749c76dfa46128d7e484a374ff95300a0e Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 15 Oct 2026 11:09:03 +0000 Subject: [PATCH] apache-flink: add build-apache-flink.yml for riscv64 wheels flink-python's .pyx/.pxd files cimport compiled apache-beam internals (apache_beam.coders.coder_impl, .runners.worker.operations, .utils.windowed_value), size-checked Cython type imports that fail at wheel-import time, not build time, on an ABI mismatch. Blocked until a riscv64 apache-beam/pyarrow/grpcio/pemja land inside flink's declared windows (apache-beam>=2.54.0,<=2.61.0, pemja>=0.5.7,<0.5.8) - tracked separately. No native deps, no JVM at build time: apache-flink-libraries (the 329MB jar bundle) is a separate py2.py3-none-any wheel. Mirrors upstream's own build_python_wheels job (nightly.yml): plain cibuildwheel over the flink-python subdirectory of a full checkout, riscv64 substituted for its hardcoded x86_64 archs. The glibc_version_fix.h CFLAGS shim upstream adds for manylinux2014 x86_64 is dropped - the GLIBC_2.2.5 symbol version it force-links doesn't exist in riscv64's glibc symbol history. --- .github/workflows/build-apache-flink.yml | 113 +++++++++++++++++++++++ docs/packages/apache-flink.yaml | 5 + 2 files changed, 118 insertions(+) create mode 100644 .github/workflows/build-apache-flink.yml create mode 100644 docs/packages/apache-flink.yaml diff --git a/.github/workflows/build-apache-flink.yml b/.github/workflows/build-apache-flink.yml new file mode 100644 index 00000000000..20be6fb9e27 --- /dev/null +++ b/.github/workflows/build-apache-flink.yml @@ -0,0 +1,113 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# Based on upstream's own wheel build: +# https://github.com/apache/flink/blob/release-2.3.0/.github/workflows/nightly.yml +# (build_python_wheels job) +name: Build apache-flink wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/apache-flink.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-apache-flink.yml' + - 'docs/packages/apache-flink.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-apache-flink.yml' + - 'docs/packages/apache-flink.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: apache-flink + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build apache-flink ${{ matrix.version }} cp312-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + + env: + APACHE_FLINK_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout apache/flink release-${{ env.APACHE_FLINK_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: apache/flink + ref: release-${{ env.APACHE_FLINK_VERSION }} + persist-credentials: false + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + package-dir: flink-python + output-dir: wheelhouse/ + only: cp312-manylinux_riscv64 + env: + CIBW_ARCHS: riscv64 + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # apache-beam/pyarrow/grpcio/pemja, each pinned to the exact + # version inside flink's declared windows, are riscv64-only on our + # own registry. + CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + # The cimport'd apache_beam.runners.worker.operations.Operation (and + # the other Beam cdef classes beam_operations_fast/beam_coder_impl_fast/ + # beam_stream_fast cimport) is a Cython size-checked type import: it + # fails at import time, not at build time, if the installed apache-beam + # wheel's ABI doesn't match what this wheel was compiled against. + CIBW_TEST_COMMAND: >- + python -c " + import pyflink; + from pyflink.fn_execution import coder_impl_fast, stream_fast; + from pyflink.fn_execution.beam import beam_coder_impl_fast, beam_operations_fast, beam_stream_fast; + from pyflink.table import aggregate_fast, window_aggregate_fast; + print('pyflink compiled extensions OK') + " + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: apache-flink-${{ env.APACHE_FLINK_VERSION }}-cp312-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish apache-flink ${{ matrix.version }} + needs: [setup, build_wheels] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + secrets: + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} + with: + artifact-pattern: apache-flink-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/apache-flink.yaml b/docs/packages/apache-flink.yaml new file mode 100644 index 00000000000..91981c4297b --- /dev/null +++ b/docs/packages/apache-flink.yaml @@ -0,0 +1,5 @@ +package-name: apache-flink +source-code: https://github.com/apache/flink +license: Apache-2.0 +versions: +- version: 2.3.0