diff --git a/.github/workflows/build-qutip.yml b/.github/workflows/build-qutip.yml new file mode 100644 index 000000000000..52855a985e6c --- /dev/null +++ b/.github/workflows/build-qutip.yml @@ -0,0 +1,112 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `build_wheels` job of +# https://github.com/qutip/qutip/blob/v5.3.1/.github/workflows/build.yml +# and the test step of +# https://github.com/qutip/qutip/blob/v5.3.1/.github/workflows/tests.yml +name: Build qutip wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/qutip.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-qutip.yml' + - 'docs/packages/qutip.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-qutip.yml' + - 'docs/packages/qutip.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +env: + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: qutip + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build qutip ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 360 + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + # Upstream's CIBW_BUILD `cp3{11,12,13,14}-*` ships no free-threaded wheel. + python: ["cp312", "cp313", "cp314"] + env: + QUTIP_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout qutip ${{ env.QUTIP_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: qutip/qutip + ref: v${{ env.QUTIP_VERSION }} + persist-credentials: false + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + only: ${{ matrix.python }}-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,matplotlib + CIBW_TEST_ENVIRONMENT: MPLBACKEND=Agg PYTHONUNBUFFERED=1 + CIBW_TEST_REQUIRES: >- + pytest pytest-rerunfailures pytest-timeout ipython loky!=3.5.0 tqdm mpmath + setuptools cython filelock matplotlib + # Coverage and --fail-slow dropped: the former feeds Coveralls, the latter's 300 s cap is tuned for x86 runners. + # cp313 hung silently at 54% twice; the thread-method timeout dumps every stack and exits (gotcha 565). + CIBW_TEST_COMMAND: >- + python -c "import qutip; qutip.about()" && + python -m pytest -Werror --strict-config --strict-markers + --timeout=900 --timeout-method=thread + --durations=0 --durations-min=1.0 --verbosity=1 --color=yes + "$(python -c 'import os, qutip; print(os.path.dirname(qutip.__file__))')/tests" + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: qutip-${{ env.QUTIP_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish qutip ${{ 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: + artifact-pattern: qutip-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/qutip.yaml b/docs/packages/qutip.yaml new file mode 100644 index 000000000000..2bfef917a4af --- /dev/null +++ b/docs/packages/qutip.yaml @@ -0,0 +1,5 @@ +package-name: qutip +source-code: https://github.com/qutip/qutip +license: BSD-3-Clause +versions: +- version: 5.3.1