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
145 changes: 145 additions & 0 deletions .github/workflows/build-pendulum.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# This workflow is based on the `Tests` job of
# https://github.com/python-pendulum/pendulum/blob/3.3.0/.github/workflows/tests.yml
name: Build pendulum wheels (riscv64)

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

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

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

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

build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
name: Build pendulum ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
timeout-minutes: 180
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
# pendulum's pyo3 dependency has a plain `features =
# ["pyo3/extension-module"]` (no abi3-pyNN), so every interpreter
# needs its own build. pypy3.11 (upstream also builds it) is
# dropped: PyPy has no riscv64 port. Upstream's own tests.yml only
# exercises free-threading on 3.14t/3.15t, not 3.13t. cp310/cp311 are
# dropped too: time-machine, one of upstream's own test dependencies,
# is only published for cp312+ on our registry and has no riscv64
# wheel on public PyPI either, so a cp310/cp311 wheel couldn't be
# tested against upstream's real suite (same trim as
# build-neo4j-rust-ext.yml's pyarrow note).
python: ['cp312', 'cp313', 'cp314', 'cp314t']

env:
PENDULUM_VERSION: ${{ matrix.version }}
# Without this uv would reuse the runner image's system CPython for
# some interpreters and download a standalone build for the others.
UV_PYTHON_PREFERENCE: only-managed

steps:
- name: Checkout pendulum v${{ env.PENDULUM_VERSION }}
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: python-pendulum/pendulum
ref: ${{ env.PENDULUM_VERSION }}
persist-credentials: false

- name: Determine target interpreter
id: interp
run: |
v="${{ matrix.python }}"
v="${v#cp}"
t="${v%t}"
suffix=""
if [ "$t" != "$v" ]; then
suffix="t"
fi
echo "value=python${t:0:1}.${t:1}${suffix}" >> "$GITHUB_OUTPUT"

- name: Build wheel
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
with:
target: riscv64gc-unknown-linux-gnu
args: --release --strip -i ${{ steps.interp.outputs.value }} --out dist
manylinux: '2_39'

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

# Mirrors upstream's own "Tests" job (tests.yml): install the runtime
# and test dependencies it declares, then run its own test suite
# unmodified, once against the just-built wheel and once (as upstream
# also does) with the native extension disabled.
- name: Install test dependencies
env:
UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/
run: |
# --no-deps: --no-index disables index lookups entirely, including for
# pendulum's own runtime deps (python-dateutil, tzdata), which dist/
# doesn't carry. They're installed explicitly below instead.
# python-dateutil pinned to upstream's poetry.lock: 3.0's tz.gettz()
# objects gain a .key, which breaks test_instance_with_aware_datetime_any_tzinfo.
uv pip install pendulum --no-index --find-links dist --force-reinstall --no-deps
uv pip install 'python-dateutil==2.9.0.post0' 'tzdata>=2020.1' 'pytest>=9.0.3' 'pytest-benchmark>=4.0.0,<5.0.0' 'time-machine>=3.0.0,<4.0.0'

- name: Test Pure Python
run: PENDULUM_EXTENSIONS=0 pytest -q tests

- name: Test
run: pytest -q tests

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

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