Skip to content

workflows: migrate canonical cibuildwheel builds #37

workflows: migrate canonical cibuildwheel builds

workflows: migrate canonical cibuildwheel builds #37

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# Based on the Linux jobs of
# https://github.com/o-murphy/py-ballisticcalc/blob/v2.3.1/.github/workflows/pypi-publish.yml
# and the cythonized-engine test runs of
# https://github.com/o-murphy/py-ballisticcalc/blob/v2.3.1/.github/workflows/pytest-reusable.yml
name: Build py-ballisticcalc-exts wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/py-ballisticcalc-exts.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-py-ballisticcalc-exts.yml'
- 'docs/packages/py-ballisticcalc-exts.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-py-ballisticcalc-exts.yml'
- 'docs/packages/py-ballisticcalc-exts.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
MUSLLINUX_RISCV64_IMAGE: quay.io/pypa/musllinux_1_2_riscv64
jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: py-ballisticcalc-exts
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build py-ballisticcalc-exts ${{ matrix.version }} ${{ matrix.tag }}-${{ matrix.libc }}_riscv64
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
libc: [manylinux, musllinux]
tag: [cp311-abi3, cp314t]
# setup.py hardcodes py_limited_api="cp311", so build on cp311 itself (gotcha 96)
# and reuse+retest that wheel on cp312-cp314; cp314t is a per-interpreter build.
include:
- tag: cp311-abi3
build: '{cp311,cp312,cp313,cp314}'
- tag: cp314t
build: cp314t
uses: $/.github/workflows/_build-cibuildwheel.yml
with:
package: "py-ballisticcalc-exts"
version: "${{ matrix.version }}"
repository: "o-murphy/py-ballisticcalc"
ref: "v${{ matrix.version }}"
artifact-tag: "${{ matrix.tag }}-${{ matrix.libc }}_riscv64"
timeout-minutes: 120
checkout-submodules: "recursive"
cibw-package-dir: "py_ballisticcalc.exts"
cibw-build: "${{ matrix.build }}-${{ matrix.libc }}_riscv64"
cibw-musllinux-riscv64-image: "quay.io/pypa/musllinux_1_2_riscv64"
# Upstream's build[uv] needs a host uv the riscv64 runner does not have (gotcha 13).
cibw-build-frontend: "build"
cibw-environment-linux: "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PY_BALLISTICCALC_EXTS=${{ matrix.version }}"
cibw-test-sources: "pyproject.toml tests py_ballisticcalc.exts/pyproject.toml py_ballisticcalc.exts/tests"
cibw-test-requires: "pytest py-ballisticcalc==${{ matrix.version }}"
cibw-test-command: >
for engine in cythonized_euler_engine cythonized_rk4_engine cythonized_verlet_engine; do
python -m pytest py_ballisticcalc.exts/tests -v --engine=$engine &&
python -m pytest tests -v --engine=$engine || exit 1; done
gpl_sources:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Collect GPL sources
runs-on: ubuntu-24.04-riscv
env:
PY_BALLISTICCALC_EXTS_VERSION: ${{ matrix.version }}
steps:
- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# auditwheel's musllinux policy does not allowlist the GCC runtime, so the
# musllinux wheels vendor libstdc++ and libgcc_s (gotcha 409).
- uses: ./actions/collect-gpl-sources
with:
image: ${{ env.MANYLINUX_RISCV64_IMAGE }}
packages: gcc
output: gpl-sources.tar
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: py-ballisticcalc-exts-${{ env.PY_BALLISTICCALC_EXTS_VERSION }}-gpl-sources
path: gpl-sources.tar
if-no-files-found: error
publish:
name: Publish py-ballisticcalc-exts ${{ matrix.version }}
needs: [setup, build_wheels, gpl_sources]
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: py-ballisticcalc-exts-${{ matrix.version }}-*riscv64
gpl-sources-artifact: py-ballisticcalc-exts-${{ matrix.version }}-gpl-sources
gpl-sources-description: gcc