Skip to content

workflows: migrate canonical cibuildwheel builds #20

workflows: migrate canonical cibuildwheel builds

workflows: migrate canonical cibuildwheel builds #20

Workflow file for this run

# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
---
# Based on upstream's wheel builder:
# https://github.com/myhloli/DocVortex/blob/v0.6.11/.github/workflows/native-wheels.yml
# docvortex is a PyO3/Rust extension built with setuptools-rust (not maturin):
# setup.py already sets py_limited_api itself, so no CIBW_CONFIG_SETTINGS is
# needed to get the abi3 wheel (contrast build-bcrypt.yml). Upstream refuses to
# build at all under free-threaded CPython (setup.py raises on
# Py_GIL_DISABLED), so there is no cp*t job here either.
name: Build docvortex wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'Version glob to (re)build; empty builds every version of docs/packages/docvortex.yaml not released yet'
required: false
default: ''
cancel-in-progress:
description: Cancel an in-progress run in the same concurrency group.
required: false
type: boolean
default: true
pull_request:
branches: [main]
paths:
- '.github/workflows/build-docvortex.yml'
- 'docs/packages/docvortex.yaml'
push:
branches: [main]
paths:
- '.github/workflows/build-docvortex.yml'
- 'docs/packages/docvortex.yaml'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ case(github.event_name == 'pull_request', true, github.event_name == 'workflow_dispatch', inputs['cancel-in-progress'], false) }}
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: docvortex
version: ${{ inputs.version }}
build_wheels:
needs: [setup]
if: needs.setup.outputs.versions != '[]'
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup.outputs.versions) }}
name: Build docvortex ${{ matrix.version }} cp311-abi3-manylinux_riscv64
uses: $/.github/workflows/_build-cibuildwheel.yml
with:
package: "docvortex"
version: "${{ matrix.version }}"
repository: "myhloli/DocVortex"
ref: "v${{ matrix.version }}"
artifact-tag: "cp311-abi3-manylinux_riscv64"
timeout-minutes: 90
# The wheel is cp311-abi3, so it is compiled on cp311 (gotcha 96).
# Its runtime dependency onnxruntime has no cp311 riscv64 wheel on
# PyPI or pypi.riseproject.dev (cp312+ only), so the cp311 install
# before the tests cannot resolve. cibuildwheel reuses the same abi3
# wheel for cp312 and tests it there; skip only the cp311 test
# (gotcha 216).
cibw-build: "cp311-* cp312-*"
cibw-skip: "*-musllinux_*"
cibw-test-skip: "cp311-*"
cibw-before-all-linux: >
export CARGO_HOME=/opt/docvortex-cargo RUSTUP_HOME=/opt/docvortex-rustup;
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs
| sh -s -- -y --profile minimal --default-toolchain 1.98.1
cibw-environment-linux: "PATH=\"/opt/docvortex-cargo/bin:$PATH\" CARGO_HOME=/opt/docvortex-cargo RUSTUP_HOME=/opt/docvortex-rustup"
# PyPI's newest pillow/numpy can be sdist-only on riscv64 while our
# registry still hosts the previous release's wheel (gotcha 354).
cibw-test-environment: "PIP_PREFER_BINARY=1"
# Upstream pins pypdfium2==5.13.0 because its golden fixtures
# (tests/fixtures/native_pdf_06_golden.json.gz) were generated with
# it, i.e. with PDFium 153.0.7999 from pdfium-binaries. The riscv64
# 5.13.0 wheel on PyPI is instead a source build of the older PDFium
# 151.0.7913, whose FPDFText_GetFontWeight derives the weight from
# the font descriptor's StemV (250/440 instead of the golden's 400),
# failing test_real_font_and_geometry_bridge_parity[caibao1,demo2].
# The riscv64 5.14.0 wheel bundles PDFium 156.0.8076, which matches
# the golden data (the whole suite also passes on x86_64 with
# 5.14.0), and is what `pypdfium2>=5.13.0,<6` resolves to anyway.
cibw-test-requires: "pytest psutil pypdfium2==5.14.0"
cibw-test-command: >
python {project}/tools/verify_native_wheel.py {project}/demo/pdfs/demo1.pdf &&
python -m pytest
{project}/tests/test_native_parity.py
{project}/tests/test_rule_graphics_acceleration.py
{project}/tests/test_rule_text_acceleration.py
{project}/tests/test_rule_pixel_form_acceleration.py
{project}/tests/test_rule_layout_batch_acceleration.py
{project}/tests/test_rule_numeric_graphics_acceleration.py
{project}/tests/test_rule_fill_bands_acceleration.py
{project}/tests/test_native_statistics.py
{project}/tests/test_native_round3.py
{project}/tests/test_native_round4.py
{project}/tests/test_native_round5.py
{project}/tests/test_native_round6.py
{project}/tests/test_native_round7.py
{project}/tests/test_pdfium_bridge.py
{project}/tests/test_pdf_object_bridge.py
{project}/tests/test_pdf_classify_page_loading.py
{project}/tests/test_pdf_classify_resource_graph.py
{project}/tests/test_pdf_drawing_lines_extraction.py
{project}/tests/test_pdf_native_graphics_components.py
{project}/tests/unittest/test_flash_pdf_auxiliary_text.py
{project}/tests/test_pdf_snapshot.py
{project}/tests/test_native_inline_styles.py
{project}/tests/test_native_bitmap_crops.py
{project}/tests/test_pdf_render_session.py
{project}/tests/test_native_font_runtime.py
{project}/tests/test_native_text_pipeline.py
{project}/tests/test_native_text_snapshot.py
{project}/tests/test_native_classification.py
{project}/tests/test_native_image_text_classification.py
{project}/tests/unittest/test_pdf_classify_image_text.py
{project}/tests/unittest/test_flash_pdf_char_geometry.py
{project}/tests/test_native_table_candidates.py
{project}/tests/test_native_candidate_boundaries.py
{project}/tests/test_native_annotation_geometry.py
{project}/tests/unittest/test_native_pdf_table_demo_manifest.py
{project}/tests/test_pdf_analysis_api.py
{project}/tests/test_pdf_cpu_evidence.py
-q &&
python {project}/tools/verify_native_wheel.py {project}/demo/pdfs/demo2.pdf &&
python {project}/tools/verify_nonpdf_wheel.py --output {project}/build/nonpdf-cp311 --run-tests
publish:
name: Publish docvortex ${{ 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:
matrix: ${{ needs.setup.outputs.matrix }}
artifact-pattern: docvortex-${{ matrix.version }}-*-manylinux_riscv64