|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +# |
| 4 | +# Restates upstream's HATCH_BUILD_HOOK_ENABLE_MYPYC=1 alongside our registry, |
| 5 | +# needed because the hook's own "cryptography" build dependency has no riscv64 |
| 6 | +# wheel on public PyPI. mypy>=1.20 makes the compiled ContentStream.__init__ |
| 7 | +# reject a bytearray where the released x86_64/aarch64 wheels accept one, so |
| 8 | +# CIBW_BEFORE_BUILD pins the newest mypy release predating playa-pdf 1.1.0. |
| 9 | +name: Build playa-pdf wheels (riscv64) |
| 10 | + |
| 11 | +on: |
| 12 | + workflow_dispatch: |
| 13 | + inputs: |
| 14 | + version: |
| 15 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/playa-pdf.yaml not released yet' |
| 16 | + required: false |
| 17 | + default: '' |
| 18 | + pull_request: |
| 19 | + branches: [main] |
| 20 | + paths: |
| 21 | + - '.github/workflows/build-playa-pdf.yml' |
| 22 | + - 'docs/packages/playa-pdf.yaml' |
| 23 | + push: |
| 24 | + branches: [main] |
| 25 | + paths: |
| 26 | + - '.github/workflows/build-playa-pdf.yml' |
| 27 | + - 'docs/packages/playa-pdf.yaml' |
| 28 | + |
| 29 | +concurrency: |
| 30 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 31 | + cancel-in-progress: true |
| 32 | + |
| 33 | +permissions: |
| 34 | + contents: read # to fetch code (actions/checkout) |
| 35 | + |
| 36 | +env: |
| 37 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 38 | + |
| 39 | +jobs: |
| 40 | + setup: |
| 41 | + uses: $/.github/workflows/_setup.yml |
| 42 | + with: |
| 43 | + package: playa-pdf |
| 44 | + version: ${{ inputs.version }} |
| 45 | + |
| 46 | + build_wheels: |
| 47 | + needs: [setup] |
| 48 | + if: needs.setup.outputs.versions != '[]' |
| 49 | + name: Build playa-pdf ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 |
| 50 | + runs-on: ubuntu-24.04-riscv |
| 51 | + strategy: |
| 52 | + fail-fast: false |
| 53 | + matrix: |
| 54 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 55 | + # mypyc emits per-interpreter (non-abi3) wheels; upstream ships cp314t too. |
| 56 | + python: ["cp312", "cp313", "cp314", "cp314t"] |
| 57 | + |
| 58 | + env: |
| 59 | + PLAYA_PDF_VERSION: ${{ matrix.version }} |
| 60 | + |
| 61 | + steps: |
| 62 | + - name: Checkout playa v${{ env.PLAYA_PDF_VERSION }} |
| 63 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 64 | + with: |
| 65 | + repository: dhdaines/playa |
| 66 | + ref: v${{ env.PLAYA_PDF_VERSION }} |
| 67 | + fetch-depth: 0 |
| 68 | + persist-credentials: false |
| 69 | + |
| 70 | + - name: Build wheels |
| 71 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 72 | + with: |
| 73 | + only: ${{ matrix.python }}-manylinux_riscv64 |
| 74 | + env: |
| 75 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 76 | + CIBW_BUILD_FRONTEND: "build; args: --no-isolation" |
| 77 | + CIBW_BEFORE_BUILD: pip install "hatchling>=1.27.0" hatch-vcs hatch-mypyc "mypy==1.19.1" cryptography |
| 78 | + CIBW_ENVIRONMENT: >- |
| 79 | + HATCH_BUILD_HOOK_ENABLE_MYPYC=1 |
| 80 | + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ |
| 81 | + CIBW_TEST_SOURCES: tests samples pyproject.toml |
| 82 | + CIBW_TEST_REQUIRES: pytest cryptography pdfminer.six |
| 83 | + CIBW_TEST_COMMAND: >- |
| 84 | + python -c "import playa.parser as m; assert m.__file__.endswith('.so'), 'wheel is not compiled'" |
| 85 | + && python -m pytest tests -v |
| 86 | +
|
| 87 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 88 | + with: |
| 89 | + name: playa-pdf-${{ env.PLAYA_PDF_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 90 | + path: wheelhouse/*.whl |
| 91 | + if-no-files-found: error |
| 92 | + |
| 93 | + publish: |
| 94 | + name: Publish playa-pdf ${{ matrix.version }} |
| 95 | + needs: [setup, build_wheels] |
| 96 | + if: needs.setup.outputs.versions != '[]' |
| 97 | + strategy: |
| 98 | + fail-fast: false |
| 99 | + matrix: |
| 100 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 101 | + permissions: |
| 102 | + contents: write |
| 103 | + pull-requests: write |
| 104 | + uses: $/.github/workflows/_publish-wheel.yml |
| 105 | + secrets: |
| 106 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 107 | + with: |
| 108 | + artifact-pattern: playa-pdf-${{ matrix.version }}-*-manylinux_riscv64 |
0 commit comments