|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# Based on upstream's own wheel build: |
| 5 | +# https://github.com/astrorigin/pyswisseph/blob/v2.10.03.2/.github/workflows/build.yml |
| 6 | +name: Build pyswisseph wheels (riscv64) |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + version: |
| 12 | + description: 'pyswisseph version to build (e.g. 2.10.3.2)' |
| 13 | + required: true |
| 14 | + default: '2.10.3.2' |
| 15 | + pull_request: |
| 16 | + paths: |
| 17 | + - '.github/workflows/build-pyswisseph.yml' |
| 18 | + - 'patches/pyswisseph/**' |
| 19 | + |
| 20 | +concurrency: |
| 21 | + group: ${{ github.workflow }}-${{ inputs.version || '2.10.3.2' }}-${{ github.head_ref || github.run_id }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +permissions: |
| 25 | + contents: read # to fetch code (actions/checkout) |
| 26 | + |
| 27 | +env: |
| 28 | + PYSWISSEPH_VERSION: ${{ inputs.version || '2.10.3.2' }} |
| 29 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 30 | + MUSLLINUX_RISCV64_IMAGE: quay.io/pypa/musllinux_1_2_riscv64 |
| 31 | + |
| 32 | +jobs: |
| 33 | + setup: |
| 34 | + uses: $/.github/workflows/_setup.yml |
| 35 | + |
| 36 | + build_wheels: |
| 37 | + needs: [setup] |
| 38 | + name: Build pyswisseph ${{ inputs.version || '2.10.3.2' }} ${{ matrix.python }}-${{ matrix.libc }}_riscv64 |
| 39 | + runs-on: ubuntu-24.04-riscv |
| 40 | + timeout-minutes: 60 |
| 41 | + strategy: |
| 42 | + fail-fast: false |
| 43 | + matrix: |
| 44 | + python: ["cp312", "cp313", "cp314", "cp314t"] |
| 45 | + libc: [manylinux, musllinux] |
| 46 | + |
| 47 | + steps: |
| 48 | + # Git tags zero-pad the third (swisseph library) version segment |
| 49 | + # that the PyPI version doesn't (v2.10.03.2 vs. 2.10.3.2). |
| 50 | + - name: Compute upstream git tag |
| 51 | + id: tag |
| 52 | + run: | |
| 53 | + set -euo pipefail |
| 54 | + IFS='.' read -r major minor patch build <<< "${PYSWISSEPH_VERSION}" |
| 55 | + echo "value=v${major}.${minor}.$(printf '%02d' "${patch}").${build}" >> "$GITHUB_OUTPUT" |
| 56 | +
|
| 57 | + - name: Checkout pyswisseph ${{ steps.tag.outputs.value }} |
| 58 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 59 | + with: |
| 60 | + repository: astrorigin/pyswisseph |
| 61 | + ref: ${{ steps.tag.outputs.value }} |
| 62 | + submodules: recursive |
| 63 | + persist-credentials: false |
| 64 | + |
| 65 | + - name: Checkout python-wheels |
| 66 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 67 | + with: |
| 68 | + path: python-wheels |
| 69 | + persist-credentials: false |
| 70 | + |
| 71 | + - name: Patch pyswisseph source |
| 72 | + run: git apply python-wheels/patches/pyswisseph/${{ env.PYSWISSEPH_VERSION }}/00*.patch |
| 73 | + |
| 74 | + - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 75 | + env: |
| 76 | + CIBW_ARCHS: riscv64 |
| 77 | + CIBW_BUILD: ${{ matrix.python }}-${{ matrix.libc }}_riscv64 |
| 78 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 79 | + CIBW_MUSLLINUX_RISCV64_IMAGE: ${{ env.MUSLLINUX_RISCV64_IMAGE }} |
| 80 | + CIBW_TEST_REQUIRES: pytest |
| 81 | + # Real coverage from the packaged suite (94/126 tests pass with no |
| 82 | + # ephemeris data files present). The deselected tests all assert |
| 83 | + # exact swe.FLG_SWIEPH-precision output (fixed-star catalog lookups, |
| 84 | + # eclipse/rise/heliacal timings, ...), which without the multi-file |
| 85 | + # Swiss Ephemeris dataset (a large download from Astrodienst, not |
| 86 | + # bundled in the sdist or by upstream's own CI either) silently |
| 87 | + # falls back to the lower-precision Moshier ephemeris and fails the |
| 88 | + # exact-value assertions - not a riscv64-specific failure. |
| 89 | + CIBW_TEST_COMMAND: >- |
| 90 | + pytest {package}/tests -v |
| 91 | + --deselect tests/test_swe_azalt_refrac.py::TestSweAzaltRefrac::test_01 |
| 92 | + --deselect tests/test_swe_calc.py::TestSweCalc::test_01 |
| 93 | + --deselect tests/test_swe_calc_pctr.py::TestSweCalcPctr::test_01 |
| 94 | + --deselect tests/test_swe_calc_ut.py::TestSweCalcUt::test_01 |
| 95 | + --deselect tests/test_swe_fixstar.py::TestSweFixstar::test_01 |
| 96 | + --deselect tests/test_swe_fixstar2.py::TestSweFixstar2::test_01 |
| 97 | + --deselect tests/test_swe_fixstar2_mag.py::TestSweFixstar2Mag::test_01 |
| 98 | + --deselect tests/test_swe_fixstar2_ut.py::TestSweFixstar2Ut::test_01 |
| 99 | + --deselect tests/test_swe_fixstar_mag.py::TestSweFixstarMag::test_01 |
| 100 | + --deselect tests/test_swe_fixstar_ut.py::TestSweFixstarUt::test_01 |
| 101 | + --deselect tests/test_swe_gauquelin_sector.py::TestSweGauquelinSector::test_01 |
| 102 | + --deselect tests/test_swe_gauquelin_sector.py::TestSweGauquelinSector::test_02 |
| 103 | + --deselect tests/test_swe_get_current_file_data.py::TestSweGetCurrentFileData::test_01 |
| 104 | + --deselect tests/test_swe_get_orbital_elements.py::TestSweGetOrbitalElements::test_01 |
| 105 | + --deselect tests/test_swe_heliacal_pheno_ut.py::TestSweHeliacalPhenoUt::test_01 |
| 106 | + --deselect tests/test_swe_helio_cross.py::TestSweHelioCross::test_01 |
| 107 | + --deselect tests/test_swe_helio_cross_ut.py::TestSweHelioCrossUt::test_01 |
| 108 | + --deselect tests/test_swe_house_pos.py::TestSweHousePos::test_01 |
| 109 | + --deselect tests/test_swe_lun_eclipse.py::TestSweLunEclipse::test_01 |
| 110 | + --deselect tests/test_swe_lun_occult.py::TestSweLunOccult::test_01 |
| 111 | + --deselect tests/test_swe_pheno.py::TestSwePheno::test_01 |
| 112 | + --deselect tests/test_swe_pheno_ut.py::TestSwePhenoUt::test_01 |
| 113 | + --deselect tests/test_swe_rise_trans.py::TestSweRiseTrans::test_01 |
| 114 | + --deselect tests/test_swe_rise_trans.py::TestSweRiseTrans::test_02 |
| 115 | + --deselect tests/test_swe_rise_trans_true_hor.py::TestSweRiseTrans::test_01 |
| 116 | + --deselect tests/test_swe_rise_trans_true_hor.py::TestSweRiseTrans::test_02 |
| 117 | + --deselect tests/test_swe_set_sid_mode.py::TestSweSetSidMode::test_01 |
| 118 | + --deselect tests/test_swe_set_topo.py::TestSweSetTopo::test_01 |
| 119 | + --deselect tests/test_swe_sol_eclipse.py::TestSweSolEclipse::test_01 |
| 120 | + --deselect tests/test_swe_solcross.py::TestSweSolcross::test_01 |
| 121 | + --deselect tests/test_swe_solcross_ut.py::TestSweSolcrossUt::test_01 |
| 122 | + --deselect tests/test_swe_vis_limit_mag.py::TestSweVisLimitMag::test_01 |
| 123 | +
|
| 124 | + - name: Check wheel contents |
| 125 | + run: | |
| 126 | + python3 - wheelhouse/*.whl <<'EOF' |
| 127 | + import sys, zipfile |
| 128 | + path = sys.argv[1] |
| 129 | + names = zipfile.ZipFile(path).namelist() |
| 130 | + exts = [n for n in names if n.endswith((".so", ".pyd"))] |
| 131 | + assert exts and all("swisseph" in n for n in exts), exts |
| 132 | + licences = {n.split(".dist-info/licenses/", 1)[1] for n in names |
| 133 | + if ".dist-info/licenses/" in n and not n.endswith("/")} |
| 134 | + assert licences == {"LICENSE.txt", "libswe/LICENSE", "swephelp/LICENSE.txt"}, licences |
| 135 | + EOF |
| 136 | +
|
| 137 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 138 | + with: |
| 139 | + name: pyswisseph-${{ env.PYSWISSEPH_VERSION }}-${{ matrix.python }}-${{ matrix.libc }}_riscv64 |
| 140 | + path: ./wheelhouse/*.whl |
| 141 | + if-no-files-found: error |
| 142 | + |
| 143 | + publish: |
| 144 | + name: Publish pyswisseph ${{ inputs.version || '2.10.3.2' }} |
| 145 | + needs: [setup, build_wheels] |
| 146 | + permissions: |
| 147 | + contents: write |
| 148 | + pull-requests: write |
| 149 | + uses: $/.github/workflows/_publish-wheel.yml |
| 150 | + with: |
| 151 | + artifact-pattern: pyswisseph-${{ inputs.version || '2.10.3.2' }}-*riscv64 |
0 commit comments