Skip to content
Merged
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
128 changes: 128 additions & 0 deletions .github/workflows/build-xtgeo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on: https://github.com/equinor/xtgeo/blob/4.25.1/.github/workflows/publish.yml
name: Build xtgeo wheels (riscv64)

on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/xtgeo.yaml not released yet'
required: false
default: ''
pull_request:
branches: [main]
paths:
- '.github/workflows/build-xtgeo.yml'
- 'docs/packages/xtgeo.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-xtgeo.yml'
- 'docs/packages/xtgeo.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: xtgeo
version: ${{ inputs.version }}

build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build xtgeo ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
# Matches upstream's own matrix (cp311-cp314) minus cp311: numpy>=2.5
# sets 3.12 as its floor and our registry only hosts that line.
python:
- "cp312"
- "cp313"
- "cp314"

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

steps:
- name: Checkout xtgeo ${{ env.XTGEO_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: equinor/xtgeo
ref: ${{ env.XTGEO_VERSION }}
persist-credentials: false

- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: python-wheels
persist-credentials: false

- name: Apply patches
run: git apply python-wheels/patches/xtgeo/${{ env.XTGEO_VERSION }}/*.patch

- 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 }}
# fmt-devel is EPEL-only and riscv64 has no EPEL; CMake fetches fmt instead.
CIBW_BEFORE_ALL_LINUX: yum install -y eigen3-devel
CIBW_BEFORE_BUILD: python -m pip install -U pip
# numpy has no riscv64 wheel on public PyPI; PIP_ONLY_BINARY keeps pip
# from source-building it (both for the build and for CIBW_TEST_COMMAND's
# test-extras install). pillow is listed too (gotcha 291): it's a
# transitive matplotlib dep, PyPI's newest pillow sdist has no riscv64
# wheel and fails to build from source (missing libjpeg headers in the
# manylinux image) - our own registry carries riscv64 pillow wheels.
CIBW_ENVIRONMENT: >-
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
PIP_ONLY_BINARY=numpy,pandas,scipy,pyarrow,h5py,hdf5plugin,matplotlib,segyio,shapely,pillow
SETUPTOOLS_SCM_PRETEND_VERSION_FOR_XTGEO=${{ env.XTGEO_VERSION }}
CIBW_TEST_EXTRAS: dev
CIBW_BEFORE_TEST: >-
pushd {package} &&
git clone --depth 1 https://github.com/equinor/xtgeo-testdata ../xtgeo-testdata || true
CIBW_TEST_COMMAND: >-
pushd {package} &&
pytest -n 4 tests --disable-warnings -m "not hypothesis" --ignore tests/test_well --ignore-glob="*forks.py"

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

publish:
name: Publish xtgeo ${{ 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: xtgeo-${{ matrix.version }}-*-manylinux_riscv64
6 changes: 6 additions & 0 deletions docs/packages/xtgeo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package-name: xtgeo
source-code: https://github.com/equinor/xtgeo
license: LGPL-3.0
versions:
- version: 4.25.1
patched: true
34 changes: 34 additions & 0 deletions patches/xtgeo/4.25.1/0001-unpin-swig-for-riscv64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Tue, 13 Oct 2026 07:54:08 +0000
Subject: [PATCH] unpin swig for riscv64

pyproject.toml's build-system.requires pins "swig<4.3.0". PyPI's swig
package only started publishing manylinux_riscv64 wheels at 4.3.1.post0,
so pip falls back to building swig itself from its sdist on riscv64 for
no reason that applies to this build: the pin (commit 839503b) exists to
avoid a SWIG 4.3.0 numpy.i regression that segfaulted under Python 3.8 +
pandas>2, and this release already requires Python >=3.11.

Drop the pin so pip resolves swig 4.5.1, which ships a riscv64 wheel.

Upstream-Status: Inappropriate [riscv64-only infra constraint; the pin's own Python 3.8 rationale no longer applies to this release]

Signed-off-by: Ludovic Henry <git@ludovic.dev>
---
pyproject.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index 718ff67..5b6f1cc 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -3,7 +3,7 @@ requires = [
"numpy>=2.0.0",
"pybind11",
"scikit-build-core[pyproject]>=0.10",
- "swig<4.3.0",
+ "swig",
]
build-backend = "scikit_build_core.build"

Loading
Loading