From 23f6bddf732aca5340938b4321601211eccf0869 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Mon, 2 Nov 2026 13:37:02 +0000 Subject: [PATCH] camb: build 2.0.5 riscv64 wheel --- .github/workflows/build-camb.yml | 132 +++++++++++++++++++++++++++++++ docs/packages/camb.yaml | 5 ++ 2 files changed, 137 insertions(+) create mode 100644 .github/workflows/build-camb.yml create mode 100644 docs/packages/camb.yaml diff --git a/.github/workflows/build-camb.yml b/.github/workflows/build-camb.yml new file mode 100644 index 000000000000..6b403ef0d35a --- /dev/null +++ b/.github/workflows/build-camb.yml @@ -0,0 +1,132 @@ +# 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: '' + 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.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: 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 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 240 + + env: + CAMB_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout camb ${{ env.CAMB_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: cmbant/camb + ref: ${{ env.CAMB_VERSION }} + submodules: recursive + persist-credentials: false + + - name: Build wheel + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + # The wheel is py3-none (ctypes-loaded camblib.so), so one build serves every interpreter. + only: cp312-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + CIBW_ENVIRONMENT: >- + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + 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 + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: camb-${{ env.CAMB_VERSION }}-py3-none-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + 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: + artifact-pattern: camb-${{ matrix.version }}-*-manylinux_riscv64 + gpl-sources-artifact: camb-${{ matrix.version }}-gpl-sources + gpl-sources-description: gcc diff --git a/docs/packages/camb.yaml b/docs/packages/camb.yaml new file mode 100644 index 000000000000..b971a58e32a3 --- /dev/null +++ b/docs/packages/camb.yaml @@ -0,0 +1,5 @@ +package-name: camb +source-code: https://github.com/cmbant/camb +license: LicenseRef-LGPLv3-arxiv +versions: +- version: 2.0.5