diff --git a/.github/workflows/build-clickhouse-cityhash.yml b/.github/workflows/build-clickhouse-cityhash.yml new file mode 100644 index 000000000..6ce4a04be --- /dev/null +++ b/.github/workflows/build-clickhouse-cityhash.yml @@ -0,0 +1,88 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# Based on the `wheels-linux`/`wheels-linux-non-x86` jobs of +# https://github.com/xzkostyan/clickhouse-cityhash/blob/1.0.2.6/.github/workflows/actions.yml +name: Build clickhouse-cityhash wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'clickhouse-cityhash version to build (e.g. 1.0.2.6)' + required: true + default: '1.0.2.6' + pull_request: + paths: + - '.github/workflows/build-clickhouse-cityhash.yml' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '1.0.2.6' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + CLICKHOUSE_CITYHASH_VERSION: ${{ inputs.version || '1.0.2.6' }} + # Upstream's "1.0.2.6" tag predates the setup.py version bump (still reads + # VERSION = '1.0.2.5'); the bump landed one commit later, tagged "1.0.2.6post1". + # Update alongside CLICKHOUSE_CITYHASH_VERSION. + CLICKHOUSE_CITYHASH_REF: 1.0.2.6post1 + 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 clickhouse-cityhash ${{ inputs.version || '1.0.2.6' }} ${{ matrix.python }}-${{ matrix.libc }}_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + # cp314t dropped: upstream's pinned Cython<3.1 generates __pyx_vectorcallfunc + # code that doesn't compile against the free-threaded CPython headers. + python: ["cp312", "cp313", "cp314"] + libc: [manylinux, musllinux] + + steps: + - name: Checkout clickhouse-cityhash ${{ env.CLICKHOUSE_CITYHASH_REF }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: xzkostyan/clickhouse-cityhash + ref: ${{ env.CLICKHOUSE_CITYHASH_REF }} + persist-credentials: false + + - 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 }} + CIBW_TEST_REQUIRES: pytest + # The checkout root ships clickhouse_cityhash/__init__.py alongside tests/, + # which would shadow the installed wheel (gotcha 25); stage only tests/. + CIBW_TEST_SOURCES: tests + CIBW_TEST_COMMAND: >- + python -c "import clickhouse_cityhash.cityhash as m; assert m.__file__.endswith('.so'), m.__file__" && + python -m pytest tests + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: clickhouse-cityhash-${{ env.CLICKHOUSE_CITYHASH_VERSION }}-${{ matrix.python }}-${{ matrix.libc }}_riscv64 + path: ./wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish clickhouse-cityhash ${{ inputs.version || '1.0.2.6' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: clickhouse-cityhash-${{ inputs.version || '1.0.2.6' }}-*riscv64