|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on: https://github.com/obspy/obspy/blob/1.5.1/.github/workflows/build_wheels.yml |
| 5 | +name: Build obspy wheels (riscv64) |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + version: |
| 11 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/obspy.yaml not released yet' |
| 12 | + required: false |
| 13 | + default: '' |
| 14 | + pull_request: |
| 15 | + branches: [main] |
| 16 | + paths: |
| 17 | + - '.github/workflows/build-obspy.yml' |
| 18 | + - 'docs/packages/obspy.yaml' |
| 19 | + push: |
| 20 | + branches: [main] |
| 21 | + paths: |
| 22 | + - '.github/workflows/build-obspy.yml' |
| 23 | + - 'docs/packages/obspy.yaml' |
| 24 | + |
| 25 | +concurrency: |
| 26 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 27 | + cancel-in-progress: true |
| 28 | + |
| 29 | +permissions: |
| 30 | + contents: read # to fetch code (actions/checkout) |
| 31 | + |
| 32 | +env: |
| 33 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 34 | + |
| 35 | +jobs: |
| 36 | + setup: |
| 37 | + uses: $/.github/workflows/_setup.yml |
| 38 | + with: |
| 39 | + package: obspy |
| 40 | + version: ${{ inputs.version }} |
| 41 | + |
| 42 | + build_wheels: |
| 43 | + needs: [setup] |
| 44 | + if: needs.setup.outputs.versions != '[]' |
| 45 | + name: Build obspy ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 |
| 46 | + runs-on: ubuntu-24.04-riscv |
| 47 | + timeout-minutes: 180 |
| 48 | + strategy: |
| 49 | + fail-fast: false |
| 50 | + matrix: |
| 51 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 52 | + # Upstream ships no free-threaded wheel. |
| 53 | + python: |
| 54 | + - "cp312" |
| 55 | + - "cp313" |
| 56 | + - "cp314" |
| 57 | + |
| 58 | + env: |
| 59 | + OBSPY_VERSION: ${{ matrix.version }} |
| 60 | + |
| 61 | + steps: |
| 62 | + - name: Checkout obspy ${{ env.OBSPY_VERSION }} |
| 63 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 64 | + with: |
| 65 | + repository: obspy/obspy |
| 66 | + ref: ${{ env.OBSPY_VERSION }} |
| 67 | + fetch-depth: 0 |
| 68 | + persist-credentials: false |
| 69 | + |
| 70 | + - name: Build and test wheels |
| 71 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 72 | + with: |
| 73 | + output-dir: wheelhouse/ |
| 74 | + only: ${{ matrix.python }}-manylinux_riscv64 |
| 75 | + env: |
| 76 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 77 | + # Only our registry has riscv64 wheels for these; keep a newer PyPI sdist from winning. |
| 78 | + CIBW_ENVIRONMENT: >- |
| 79 | + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ |
| 80 | + PIP_ONLY_BINARY=numpy,scipy,matplotlib,contourpy,kiwisolver,pillow,lxml,sqlalchemy,pyproj,shapely,cartopy,rpds-py |
| 81 | + # --no-report: do not upload results to upstream's tests.obspy.org report server. |
| 82 | + # Network tests stay deselected (obspy-runtests' default). |
| 83 | + CIBW_TEST_COMMAND: obspy-runtests --no-report |
| 84 | + CIBW_TEST_EXTRAS: tests |
| 85 | + # Optional deps outside the tests extra; without them 25 tests skip. |
| 86 | + CIBW_TEST_REQUIRES: cartopy geographiclib pyshp jsonschema |
| 87 | + |
| 88 | + - name: Check the wheel ships the licences and the compiled libraries |
| 89 | + run: | |
| 90 | + python3 - <<'EOF' |
| 91 | + import glob, zipfile |
| 92 | +
|
| 93 | + names = zipfile.ZipFile(glob.glob("wheelhouse/*.whl")[0]).namelist() |
| 94 | + assert "obspy/io/mseed/src/libmseed/LICENSE.txt" in names, names |
| 95 | + assert any(n.endswith("dist-info/licenses/LICENSE.txt") for n in names), names |
| 96 | + libs = sorted(n for n in names if n.startswith("obspy/lib/") and n.endswith(".so")) |
| 97 | + assert len(libs) == 7, libs |
| 98 | + # Nothing grafted by auditwheel (e.g. GCC runtime), so no gpl_sources job is needed. |
| 99 | + assert not any(".libs/" in n for n in names), [n for n in names if ".libs/" in n] |
| 100 | + EOF |
| 101 | +
|
| 102 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 103 | + with: |
| 104 | + name: obspy-${{ env.OBSPY_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 105 | + path: wheelhouse/*.whl |
| 106 | + if-no-files-found: error |
| 107 | + |
| 108 | + publish: |
| 109 | + name: Publish obspy ${{ matrix.version }} |
| 110 | + needs: [setup, build_wheels] |
| 111 | + if: needs.setup.outputs.versions != '[]' |
| 112 | + strategy: |
| 113 | + fail-fast: false |
| 114 | + matrix: |
| 115 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 116 | + permissions: |
| 117 | + contents: write |
| 118 | + pull-requests: write |
| 119 | + uses: $/.github/workflows/_publish-wheel.yml |
| 120 | + secrets: |
| 121 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 122 | + with: |
| 123 | + artifact-pattern: obspy-${{ matrix.version }}-*-manylinux_riscv64 |
0 commit comments