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
174 changes: 174 additions & 0 deletions .github/workflows/build-pemja.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on the Linux-aarch64 job of
# https://github.com/alibaba/pemja/blob/release-0.6.2/.github/workflows/build_wheels.yml
# and on https://github.com/alibaba/pemja/blob/release-0.6.2/.github/workflows/java_tests.yml.
name: Build pemja wheels (riscv64)

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

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: pemja
version: ${{ inputs.version }}

build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build pemja ${{ 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) }}
python: ["cp312", "cp313", "cp314", "cp314t"]

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

steps:
- name: Checkout pemja release-${{ env.PEMJA_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: alibaba/pemja
ref: release-${{ env.PEMJA_VERSION }}
persist-credentials: false

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

- name: Patch pemja source
run: git apply python-wheels/patches/pemja/${{ env.PEMJA_VERSION }}/00*.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 }}
# Upstream builds against JDK 8; Rocky 10 only packages JDK 21.
CIBW_BEFORE_ALL_LINUX: dnf -y install java-21-openjdk-devel
CIBW_ENVIRONMENT_LINUX: JAVA_HOME=/usr/lib/jvm/java-21-openjdk

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

test_wheels:
needs: [setup, build_wheels]
if: needs.setup.outputs.versions != '[]'
name: Test pemja ${{ matrix.version }} on Python ${{ matrix.python-version }}
runs-on: ubuntu-24.04-riscv
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
python-version: ['3.12', '3.13', '3.14', '3.14t']

env:
PEMJA_VERSION: ${{ matrix.version }}
# The JVM side loads the shared libpython, which manylinux's CPython lacks and uv's ships.
UV_PYTHON_PREFERENCE: only-managed

steps:
- name: Checkout pemja release-${{ env.PEMJA_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: alibaba/pemja
ref: release-${{ env.PEMJA_VERSION }}
persist-credentials: false

- name: Download wheels
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: pemja-${{ env.PEMJA_VERSION }}-*-manylinux_riscv64
path: dist
merge-multiple: true

- name: Install Python
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
enable-cache: false

# Temurin publishes no riscv64 JDK 11, upstream's test JDK.
- uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: temurin
java-version: '21'
architecture: riscv64

- name: Install Maven
run: |
sudo apt-get update -qq
sudo apt-get install -y -qq --no-install-recommends maven

- name: Install the wheel
run: uv pip install --only-binary pemja --find-links dist "pemja==${PEMJA_VERSION}"

# Upstream's Java tests load the extension from the source tree (`build_ext --inplace`).
- name: Stage the wheel's extension modules in the source tree
run: |
site_pemja=$(python -c 'import importlib.util; print(importlib.util.find_spec("pemja").submodule_search_locations[0])')
cp -v "${site_pemja}"/pemja_*.so src/main/python/pemja/

# google-java-format 1.7, which spotless runs first, does not work on JDK 21.
- name: Run upstream's Java tests
run: mvn -B test -Dspotless.skip=true

publish:
name: Publish pemja ${{ matrix.version }}
needs: [setup, build_wheels, test_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: pemja-${{ matrix.version }}-*-manylinux_riscv64
6 changes: 6 additions & 0 deletions docs/packages/pemja.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package-name: pemja
source-code: https://github.com/alibaba/pemja
license: Apache-2.0
versions:
- version: 0.6.2
patched: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From 5e2fbce78ca16078733fa77dcfff6dec57c1a1b7 Mon Sep 17 00:00:00 2001
From: Ludovic Henry <git@ludovic.dev>
Date: Wed, 30 Sep 2026 17:45:34 +0000
Subject: [PATCH] Drop cpython-freethreading from the cibuildwheel enable
groups

cibuildwheel 3.0 removed the cpython-freethreading enable group -
free-threaded builds are selected by the build identifier itself now,
not an opt-in group - and its config parser rejects the value outright,
before any container starts and for every interpreter in the matrix:

Failed to parse enable group. Unknown enable group:
cpython-freethreading. Valid group names are: cpython-prerelease,
graalpy, pypy, pypy-eol, pyodide-eol, pyodide-prerelease

Upstream's build_wheels.yml pins pypa/cibuildwheel@v2.23.3, where the
group is still valid and is what enables its cp313t wheels, so dropping
it upstream would lose those wheels there.

Upstream-Status: Inappropriate [needed only for cibuildwheel 3.0+, which python-wheels pins repo-wide; upstream pins v2.23.3]
---
pyproject.toml | 1 -
1 file changed, 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index 05da42c..ac0d260 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,7 +6,6 @@ requires = [
]

[tool.cibuildwheel]
-enable = ["cpython-freethreading"]

[tool.cibuildwheel.macos]
archs = "x86_64 arm64"
\ No newline at end of file
--
2.43.0

Loading