Skip to content

workflows: migrate canonical cibuildwheel builds #17

workflows: migrate canonical cibuildwheel builds

workflows: migrate canonical cibuildwheel builds #17

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# Based on the `build-wheels` job of
# https://github.com/Canner/WrenAI/blob/wren-core-py-v0.8.2/.github/workflows/publish-wren-core-py.yml
name: Build wren-core-py wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/wren-core-py.yaml not released yet'
required: false
default: ''
cancel-in-progress:
description: Cancel an in-progress run in the same concurrency group.
required: false
type: boolean
default: true
pull_request:
branches: [main]
paths:
- '.github/workflows/build-wren-core-py.yml'
- 'docs/packages/wren-core-py.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-wren-core-py.yml'
- 'docs/packages/wren-core-py.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ case(github.event_name == 'pull_request', true, github.event_name == 'workflow_dispatch', inputs['cancel-in-progress'], false) }}
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: wren-core-py
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
# Cargo.toml carries `abi3-py311` unconditionally, so one wheel serves
# every GIL-ful interpreter >=3.11; our registry has no riscv64 pyarrow
# (a test-only dependency here) below cp312, so the build floor is
# cp312 instead -- the wheel is still tagged cp311-abi3 regardless of
# which interpreter compiles it (CLAUDE.md gotcha 96).
name: Build wren-core-py ${{ matrix.version }} cp311-abi3-manylinux_riscv64
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
# wren-core-py is not itself a Cargo workspace member; it path-depends
# on ../wren-core/core and ../wren-core-base, both siblings in the
# Canner/WrenAI monorepo, so the checkout root has to be the repo
# root, not core/wren-core-py itself.
uses: $/.github/workflows/_build-cibuildwheel.yml
with:
package: "wren-core-py"
version: "${{ matrix.version }}"
repository: "Canner/WrenAI"
ref: "wren-core-py-v${{ matrix.version }}"
artifact-tag: "cp311-abi3-manylinux_riscv64"
timeout-minutes: 360
cibw-package-dir: "core/wren-core-py"
# musllinux is dropped: rustup.rs ships no riscv64 musl toolchain.
cibw-build: "cp312-manylinux_riscv64 cp313-manylinux_riscv64 cp314-manylinux_riscv64"
# No [tool.cibuildwheel] table upstream, so the Rust toolchain
# maturin needs is installed in-container here.
cibw-before-all-linux: >
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
cibw-environment-linux: "PATH=\"$PATH:$HOME/.cargo/bin\""
cibw-test-environment: "PIP_ONLY_BINARY=pyarrow,numpy"
cibw-test-requires: "pytest pyarrow"
cibw-test-sources: "core/wren-core-py/tests"
# Upstream runs pytest from core/wren-core-py; tests open tests/functions.csv relative to it.
cibw-test-command: "cd core/wren-core-py && python -m pytest tests -v"
publish:
name: Publish wren-core-py ${{ 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:
matrix: ${{ needs.setup.outputs.matrix }}
artifact-pattern: wren-core-py-${{ matrix.version }}-*-manylinux_riscv64