Skip to content

workflows: migrate canonical cibuildwheel builds #14

workflows: migrate canonical cibuildwheel builds

workflows: migrate canonical cibuildwheel builds #14

Workflow file for this run

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on the `build_wheels` and `test_wheels` jobs of
# https://github.com/cmbant/camb/blob/2.0.5/.github/workflows/build_wheels.yml
name: Build camb wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/camb.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-camb.yml'
- 'docs/packages/camb.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-camb.yml'
- 'docs/packages/camb.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: camb
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Build camb ${{ matrix.version }} py3-none-manylinux_riscv64
uses: $/.github/workflows/_build-cibuildwheel.yml
with:
package: "camb"
version: "${{ matrix.version }}"
repository: "cmbant/camb"
ref: "${{ matrix.version }}"
artifact-tag: "py3-none-manylinux_riscv64"
timeout-minutes: 240
checkout-submodules: "recursive"
# The wheel is py3-none (ctypes-loaded camblib.so), so one build serves every interpreter.
cibw-build: "cp312-manylinux_riscv64"
cibw-environment-linux: "PIP_ONLY_BINARY=numpy,scipy"
# Two camb_test cases read fortran/tests and inifiles relative to the test file.
cibw-test-sources: "camb/tests fortran/tests inifiles"
cibw-test-command: "cd camb/tests && python -m unittest camb_test mathutils_test"
gpl_sources:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Collect GPL sources (gcc) for camb ${{ matrix.version }}
runs-on: ubuntu-24.04-riscv
env:
CAMB_VERSION: ${{ matrix.version }}
steps:
# auditwheel vendors the image's libgfortran and libgomp into the wheel.
- name: Collect gcc source RPM from manylinux_riscv64
uses: riseproject-dev/python-wheels/actions/collect-gpl-sources@main
with:
image: ${{ env.MANYLINUX_RISCV64_IMAGE }}
packages: gcc
output: gpl-sources.tar
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: camb-${{ env.CAMB_VERSION }}-gpl-sources
path: gpl-sources.tar
if-no-files-found: error
publish:
name: Publish camb ${{ 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: camb-${{ matrix.version }}-*-manylinux_riscv64
gpl-sources-artifact: camb-${{ matrix.version }}-gpl-sources
gpl-sources-description: gcc