|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on |
| 5 | +# https://github.com/astropy/photutils/blob/3.0.0/.github/workflows/publish.yml, |
| 6 | +# which calls OpenAstronomy/github-actions-workflows' publish.yml. |
| 7 | +name: Build photutils wheels (riscv64) |
| 8 | + |
| 9 | +on: |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + version: |
| 13 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/photutils.yaml not released yet' |
| 14 | + required: false |
| 15 | + default: '' |
| 16 | + pull_request: |
| 17 | + branches: [main] |
| 18 | + paths: |
| 19 | + - '.github/workflows/build-photutils.yml' |
| 20 | + - 'docs/packages/photutils.yaml' |
| 21 | + push: |
| 22 | + branches: [main] |
| 23 | + paths: |
| 24 | + - '.github/workflows/build-photutils.yml' |
| 25 | + - 'docs/packages/photutils.yaml' |
| 26 | + |
| 27 | +concurrency: |
| 28 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 29 | + cancel-in-progress: true |
| 30 | + |
| 31 | +permissions: |
| 32 | + contents: read # to fetch code (actions/checkout) |
| 33 | + |
| 34 | +env: |
| 35 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 36 | + |
| 37 | +jobs: |
| 38 | + setup: |
| 39 | + uses: $/.github/workflows/_setup.yml |
| 40 | + with: |
| 41 | + package: photutils |
| 42 | + version: ${{ inputs.version }} |
| 43 | + |
| 44 | + build_wheels: |
| 45 | + needs: [setup] |
| 46 | + if: needs.setup.outputs.versions != '[]' |
| 47 | + strategy: |
| 48 | + fail-fast: false |
| 49 | + matrix: |
| 50 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 51 | + name: Build photutils ${{ matrix.version }} cp311-abi3-manylinux_riscv64 |
| 52 | + runs-on: ubuntu-24.04-riscv |
| 53 | + timeout-minutes: 240 |
| 54 | + |
| 55 | + env: |
| 56 | + PHOTUTILS_VERSION: ${{ matrix.version }} |
| 57 | + |
| 58 | + steps: |
| 59 | + - name: Checkout photutils ${{ env.PHOTUTILS_VERSION }} |
| 60 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 61 | + with: |
| 62 | + repository: astropy/photutils |
| 63 | + ref: ${{ env.PHOTUTILS_VERSION }} |
| 64 | + persist-credentials: false |
| 65 | + |
| 66 | + - name: Build wheels |
| 67 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 68 | + with: |
| 69 | + output-dir: wheelhouse/ |
| 70 | + env: |
| 71 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 72 | + # pyproject.toml pins py-limited-api = "cp311": built once on cp311, the |
| 73 | + # oldest interpreter the tag claims, and re-tested on the newer ones. |
| 74 | + CIBW_BUILD: >- |
| 75 | + cp311-manylinux_riscv64 cp312-manylinux_riscv64 |
| 76 | + cp313-manylinux_riscv64 cp314-manylinux_riscv64 |
| 77 | + CIBW_ENVIRONMENT: >- |
| 78 | + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ |
| 79 | + PIP_ONLY_BINARY=numpy |
| 80 | + SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PHOTUTILS=${{ env.PHOTUTILS_VERSION }} |
| 81 | + CIBW_TEST_EXTRAS: test |
| 82 | + CIBW_TEST_COMMAND: pytest -p no:warnings --pyargs photutils |
| 83 | + CIBW_TEST_ENVIRONMENT: >- |
| 84 | + PIP_ONLY_BINARY=numpy,scipy,astropy,pyerfa,pyyaml,hypothesis |
| 85 | +
|
| 86 | + - name: Check wheel contents |
| 87 | + run: | |
| 88 | + python3 - wheelhouse/*.whl <<'EOF' |
| 89 | + import sys, zipfile |
| 90 | + path = sys.argv[1] |
| 91 | + assert "-cp311-abi3-" in path, path |
| 92 | + names = zipfile.ZipFile(path).namelist() |
| 93 | + exts = {n.rsplit("/", 1)[1] for n in names if n.endswith(".so")} |
| 94 | + assert exts == {"compiler_version.abi3.so", "core.abi3.so", |
| 95 | + "circular_overlap.abi3.so", "elliptical_overlap.abi3.so", |
| 96 | + "rectangular_overlap.abi3.so", "ellipse_model.abi3.so"}, exts |
| 97 | + licences = {n.split(".dist-info/licenses/", 1)[1] for n in names |
| 98 | + if ".dist-info/licenses/" in n and not n.endswith("/")} |
| 99 | + assert licences == {"LICENSE.rst"}, licences |
| 100 | + EOF |
| 101 | +
|
| 102 | + - name: Store wheels |
| 103 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 104 | + with: |
| 105 | + name: photutils-${{ env.PHOTUTILS_VERSION }}-cp311-abi3-manylinux_riscv64 |
| 106 | + path: ./wheelhouse/*.whl |
| 107 | + if-no-files-found: error |
| 108 | + |
| 109 | + publish: |
| 110 | + name: Publish photutils ${{ matrix.version }} |
| 111 | + needs: [setup, build_wheels] |
| 112 | + if: needs.setup.outputs.versions != '[]' |
| 113 | + strategy: |
| 114 | + fail-fast: false |
| 115 | + matrix: |
| 116 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 117 | + permissions: |
| 118 | + contents: write |
| 119 | + pull-requests: write |
| 120 | + uses: $/.github/workflows/_publish-wheel.yml |
| 121 | + secrets: |
| 122 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 123 | + with: |
| 124 | + artifact-pattern: photutils-${{ matrix.version }}-*-manylinux_riscv64 |
0 commit comments