Skip to content

Commit f288db5

Browse files
authored
timezonefinder: add build-timezonefinder.yml for riscv64 wheels (#911)
* **Package**: `timezonefinder` * **Version**: `8.3.0` * **Source**: https://github.com/jannikmi/timezonefinder * **Docs**: https://timezonefinder.michelfe.it/gui Compiles a small CFFI point-in-polygon extension; the timezone boundary data ships separately as the pure-Python `timezonefinder-data` wheel. Upstream publishes no riscv64 wheel. Mirrors the `make-wheels` job of [upstream's `build.yml`](https://github.com/jannikmi/timezonefinder/blob/8.3.0/.github/workflows/build.yml). **Differs from upstream** - One job builds cp311-abi3 and skips its own test - h3/numpy have no riscv64 wheel for cp311 yet - Drops the `uvx abi3audit` repair step - cibuildwheel's default audit-command already abi3audits abi3 wheels **Matrix**: cp311-abi3 only, matching upstream's abi3 floor; built but untested on cp311 (registry gap), reused and tested on cp312-cp314 **Testing** - same as upstream's own wheel check: `timezone_at()` result and `clang_extension_loaded` **License**: OK Built and tested locally on cp312 (macOS); both assertions passed against the real compiled extension.
1 parent 93ac4cf commit f288db5

1 file changed

Lines changed: 97 additions & 0 deletions

File tree

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow is based on the `make-wheels` job of
5+
# https://github.com/jannikmi/timezonefinder/blob/8.3.0/.github/workflows/build.yml
6+
name: Build timezonefinder wheels (riscv64)
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'timezonefinder version to build (git tag, e.g. 8.3.0)'
13+
required: true
14+
default: '8.3.0'
15+
pull_request:
16+
paths:
17+
- '.github/workflows/build-timezonefinder.yml'
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ inputs.version || '8.3.0' }}-${{ github.head_ref || github.run_id }}
21+
cancel-in-progress: true
22+
23+
permissions:
24+
contents: read # to fetch code (actions/checkout)
25+
26+
env:
27+
# `inputs.version` is empty on pull_request events; default to 8.3.0 there.
28+
TIMEZONEFINDER_VERSION: ${{ inputs.version || '8.3.0' }}
29+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
30+
31+
jobs:
32+
setup:
33+
uses: $/.github/workflows/_setup.yml
34+
35+
build_wheels:
36+
needs: [setup]
37+
name: Build timezonefinder ${{ inputs.version || '8.3.0' }} cp311-abi3-manylinux_riscv64
38+
runs-on: ubuntu-24.04-riscv
39+
timeout-minutes: 90
40+
steps:
41+
- name: Checkout timezonefinder ${{ env.TIMEZONEFINDER_VERSION }}
42+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
43+
with:
44+
repository: jannikmi/timezonefinder
45+
ref: ${{ env.TIMEZONEFINDER_VERSION }}
46+
persist-credentials: false
47+
48+
- name: Build wheels
49+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
50+
with:
51+
output-dir: wheelhouse/
52+
env:
53+
# Upstream sets py_limited_api in setup.py from cibuildwheel's own
54+
# BUILD_ABI3 override (`[[tool.cibuildwheel.overrides]] select = "*"`),
55+
# so building on the oldest interpreter it claims (cp311) and letting
56+
# cibuildwheel reuse+retest that one wheel on cp312-cp314 matches
57+
# upstream's own single `cp311-*` build (gotcha 96).
58+
CIBW_BUILD: >-
59+
cp311-manylinux_riscv64 cp312-manylinux_riscv64
60+
cp313-manylinux_riscv64 cp314-manylinux_riscv64
61+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
62+
CIBW_BUILD_FRONTEND: pip
63+
# Replaces (not merges into) upstream's [tool.cibuildwheel] environment
64+
# overrides, so BUILD_ABI3 (needed for the abi3 tag) is repeated here
65+
# alongside our registry (gotcha 107). h3 and numpy have no riscv64
66+
# wheel for cp311 on our registry yet, so cp311 skips the test below;
67+
# PIP_ONLY_BINARY keeps pip on our registry's cffi/numpy/h3 builds
68+
# rather than a newer sourceless PyPI release (gotcha 30).
69+
CIBW_ENVIRONMENT: >-
70+
BUILD_ABI3=true
71+
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
72+
PIP_ONLY_BINARY=cffi,numpy,h3
73+
# Upstream's own repair-wheel-command also runs abi3audit via uvx,
74+
# which the riscv64 image doesn't carry; cibuildwheel's own default
75+
# audit-command already abi3audits every abi3-tagged wheel natively
76+
# after this repair step runs, so drop the uvx layer here.
77+
CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair -w {dest_dir} {wheel}
78+
CIBW_TEST_SKIP: cp311-*
79+
CIBW_TEST_COMMAND: >-
80+
python -c "from timezonefinder import TimezoneFinder; tf = TimezoneFinder(); result = tf.timezone_at(lat=40.5, lng=11.7); assert result == 'Etc/GMT-1', result"
81+
&& python -c "from timezonefinder.utils import clang_extension_loaded; assert clang_extension_loaded"
82+
83+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
84+
with:
85+
name: timezonefinder-${{ env.TIMEZONEFINDER_VERSION }}-cp311-abi3-manylinux_riscv64
86+
path: wheelhouse/*.whl
87+
if-no-files-found: error
88+
89+
publish:
90+
name: Publish timezonefinder ${{ inputs.version || '8.3.0' }}
91+
needs: [setup, build_wheels]
92+
permissions:
93+
contents: write
94+
pull-requests: write
95+
uses: $/.github/workflows/_publish-wheel.yml
96+
with:
97+
artifact-pattern: timezonefinder-${{ inputs.version || '8.3.0' }}-*-manylinux_riscv64

0 commit comments

Comments
 (0)