Skip to content

Commit b4d0504

Browse files
authored
spiceypy: add riscv64 build workflow for 8.2.0 (#2725)
Builds CSPICE from NAIF's own portable ANSI C source (via the cspice-release-mirror upstream's own CI already uses for its aarch64 Linux wheels) instead of upstream's prebuilt per-platform tarball, since the source is architecture-independent.
1 parent e78ba0d commit b4d0504

2 files changed

Lines changed: 141 additions & 0 deletions

File tree

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow mirrors the build_wheels job of upstream's own
5+
# .github/workflows/publish-to-test-and-live-pypi.yml, narrowed to riscv64.
6+
name: Build spiceypy wheels (riscv64)
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'Version glob to (re)build; empty builds every version of docs/packages/spiceypy.yaml not released yet'
13+
required: false
14+
default: ''
15+
pull_request:
16+
branches: [main]
17+
paths:
18+
- '.github/workflows/build-spiceypy.yml'
19+
- 'docs/packages/spiceypy.yaml'
20+
push:
21+
branches: [main]
22+
paths:
23+
- '.github/workflows/build-spiceypy.yml'
24+
- 'docs/packages/spiceypy.yaml'
25+
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
28+
cancel-in-progress: true
29+
30+
permissions:
31+
contents: read # to fetch code (actions/checkout)
32+
33+
env:
34+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
35+
MIRROR_BASE: https://raw.githubusercontent.com/AndrewAnnex/cspice-release-mirror/refs/heads/main/artifacts
36+
CSPICE_ARCHIVE: N67_lin_x64_cspice.tar.gz
37+
38+
jobs:
39+
setup:
40+
uses: $/.github/workflows/_setup.yml
41+
with:
42+
package: spiceypy
43+
version: ${{ inputs.version }}
44+
45+
build_wheels:
46+
needs: [setup]
47+
if: needs.setup.outputs.versions != '[]'
48+
name: Build spiceypy ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
49+
runs-on: ubuntu-24.04-riscv
50+
timeout-minutes: 180
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
55+
python: ["cp310", "cp311", "cp312", "cp313", "cp314"]
56+
57+
env:
58+
SPICEYPY_VERSION: ${{ matrix.version }}
59+
60+
steps:
61+
- name: Checkout SpiceyPy v${{ env.SPICEYPY_VERSION }}
62+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
63+
with:
64+
repository: AndrewAnnex/SpiceyPy
65+
ref: v${{ env.SPICEYPY_VERSION }}
66+
persist-credentials: false
67+
68+
# Upstream's own CI provisions CSPICE the same way for its Linux wheels
69+
# (aarch64 included): the C source is architecture-independent, so the
70+
# x86_64 mirror archive is reused here too. The mirror exists because
71+
# NAIF's own server has had TLS/reliability issues in upstream's CI.
72+
- name: Provision CSPICE source from mirror
73+
run: |
74+
set -euo pipefail
75+
curl -fsSL "${MIRROR_BASE}/${CSPICE_ARCHIVE}" -o "${CSPICE_ARCHIVE}"
76+
curl -fsSL "${MIRROR_BASE}/${CSPICE_ARCHIVE}.sha256" -o "${CSPICE_ARCHIVE}.sha256"
77+
expected="$(tr -d '[:space:]' < "${CSPICE_ARCHIVE}.sha256")"
78+
actual="$(sha256sum "${CSPICE_ARCHIVE}" | awk '{print $1}')"
79+
test "$expected" = "$actual"
80+
mkdir -p cspice-src-cache
81+
tar xzf "${CSPICE_ARCHIVE}" -C cspice-src-cache
82+
test -d cspice-src-cache/cspice/src/cspice
83+
84+
- name: Build wheels
85+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
86+
with:
87+
output-dir: wheelhouse/
88+
only: ${{ matrix.python }}-manylinux_riscv64
89+
extras: "uv"
90+
env:
91+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
92+
CIBW_ENVIRONMENT_LINUX: >-
93+
CSPICE_SRC=/project/cspice-src-cache/cspice
94+
SPICEYPY_CSPICE_PREFIX=/project/cspice-prefix
95+
CMAKE_BUILD_PARALLEL_LEVEL="$(nproc)"
96+
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
97+
# dependency-groups=dev also pulls in black/twine/build/scikit-build-core,
98+
# packaging/lint tools the test command never calls; black has no riscv64
99+
# wheel for cp310/cp311 on PyPI or our registry and would otherwise have to
100+
# mypyc-compile from source on every job.
101+
CIBW_TEST_GROUPS: ""
102+
CIBW_TEST_REQUIRES: "numpy>=1.23.5 pandas>=2.2.2 pytest>=7.0.0 pytest-benchmark coverage>=7.0.0"
103+
104+
- name: Check the wheel ships the compiled extension and CSPICE
105+
run: |
106+
python3 - wheelhouse/*.whl <<'EOF'
107+
import sys, zipfile
108+
for whl in sys.argv[1:]:
109+
names = zipfile.ZipFile(whl).namelist()
110+
assert any(n.startswith("spiceypy/cyice/cyice") and n.endswith(".so") for n in names), (whl, names)
111+
assert any(n.endswith("spiceypy/utils/libcspice.so") for n in names), (whl, names)
112+
print(whl, "ok")
113+
EOF
114+
115+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
116+
with:
117+
name: spiceypy-${{ env.SPICEYPY_VERSION }}-${{ matrix.python }}-manylinux_riscv64
118+
path: wheelhouse/*.whl
119+
if-no-files-found: error
120+
121+
publish:
122+
name: Publish spiceypy ${{ matrix.version }}
123+
needs: [setup, build_wheels]
124+
if: needs.setup.outputs.versions != '[]'
125+
strategy:
126+
fail-fast: false
127+
matrix:
128+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
129+
permissions:
130+
contents: write
131+
pull-requests: write
132+
uses: $/.github/workflows/_publish-wheel.yml
133+
secrets:
134+
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
135+
with:
136+
artifact-pattern: spiceypy-${{ matrix.version }}-*-manylinux_riscv64

‎docs/packages/spiceypy.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package-name: spiceypy
2+
source-code: https://github.com/AndrewAnnex/SpiceyPy
3+
license: MIT
4+
versions:
5+
- version: 8.2.0

0 commit comments

Comments
 (0)