Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions .github/workflows/build-spatial-access.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on:
# https://github.com/GeoDaCenter/spatial_access/blob/v1.0.2/.github/workflows/build-publish.yml
name: Build spatial-access wheels (riscv64)

on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/spatial-access.yaml not released yet'
required: false
default: ''
pull_request:
branches: [main]
paths:
- '.github/workflows/build-spatial-access.yml'
- 'docs/packages/spatial-access.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-spatial-access.yml'
- 'docs/packages/spatial-access.yaml'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read # to fetch code (actions/checkout)

env:
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64

jobs:
setup:
uses: $/.github/workflows/_setup.yml
with:
package: spatial-access
version: ${{ inputs.version }}

build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build spatial-access ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
# Per-interpreter Cython extension (upstream ships cp3x-cp3x wheels, no abi3).
python: ["cp312", "cp313", "cp314", "cp314t"]

env:
SPATIAL_ACCESS_VERSION: ${{ matrix.version }}

steps:
- name: Checkout spatial_access ${{ env.SPATIAL_ACCESS_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: GeoDaCenter/spatial_access
ref: v${{ env.SPATIAL_ACCESS_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 }}
# The released sdist ships a stale _p2pExtension.cpp pre-generated by an old
# Cython against old CPython internals (PyTypeObject/PyFrameObject layout) and
# fails to compile on current CPython. Rebuilding it here with a current Cython
# from the full checkout (which, unlike the PyPI sdist, carries the pyx_src/
# templates MANIFEST.in leaves out of the release tarball) fixes that cleanly.
CIBW_BEFORE_BUILD: |
set -e
pip install "cython>=3" jinja2
bash cythonize_extension.sh
CIBW_TEST_REQUIRES: pytest
# tests/test_networkUtility.py is the only suite that imports nothing but the
# compiled extension itself; the rest of tests/ pulls in spatial_access's full GIS
# dependency chain (geopandas, fiona, osmnet, ...), out of scope here. A sibling
# suite, tests/test_pyTransitMatrix.py, is also extension-only but 6 of its 7
# cases fail identically against the real, officially-released PyPI wheel
# (spatial_access-1.0.2-cp310-cp310-manylinux_2_17_x86_64...whl installed with
# --no-deps on x86_64) -- a pre-existing upstream bug in compute()/
# getDestsInRange(), not a riscv64 or rebuild regression, so it is left out
# rather than carrying a wheel-vs-test mismatch or a non-upstream behavior patch.
CIBW_TEST_SOURCES: tests
CIBW_TEST_COMMAND: python -m pytest tests/test_networkUtility.py

- name: Check the extension module made it into the wheel
run: |
python3 - wheelhouse/*.whl <<'EOF'
import sys, zipfile
for whl in sys.argv[1:]:
names = zipfile.ZipFile(whl).namelist()
assert any(n.startswith("_p2pExtension.") and n.endswith(".so") for n in names), names
print(whl, "ok")
EOF

- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: spatial-access-${{ env.SPATIAL_ACCESS_VERSION }}-${{ matrix.python }}-manylinux_riscv64
path: wheelhouse/*.whl
if-no-files-found: error

publish:
name: Publish spatial-access ${{ 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: spatial-access-${{ matrix.version }}-*-manylinux_riscv64
5 changes: 5 additions & 0 deletions docs/packages/spatial-access.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package-name: spatial-access
source-code: https://github.com/GeoDaCenter/spatial_access
license: BSD
versions:
- version: 1.0.2
Loading