|
| 1 | +--- |
| 2 | +name: Build pillow wheels (riscv64) |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + version: |
| 8 | + description: 'pillow version to build (git tag without leading v, e.g. 12.3.0)' |
| 9 | + required: true |
| 10 | + default: '12.3.0' |
| 11 | + pull_request: |
| 12 | + paths: |
| 13 | + - '.github/workflows/build-pillow.yml' |
| 14 | + - '.github/workflows/test-pillow.yml' |
| 15 | + - 'patches/pillow/**' |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: ${{ github.workflow }}-${{ inputs.version || '12.3.0' }}-${{ github.head_ref || github.run_id }} |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: read # to fetch code (actions/checkout) |
| 23 | + |
| 24 | +env: |
| 25 | + PILLOW_VERSION: ${{ inputs.version || '12.3.0' }} |
| 26 | + UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ |
| 27 | + UV_INDEX_STRATEGY: unsafe-best-match |
| 28 | + UV_ONLY_BINARY: ':all:' |
| 29 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 30 | + |
| 31 | +jobs: |
| 32 | + build_wheels: |
| 33 | + name: Build pillow ${{ inputs.version || '12.3.0' }} ${{ matrix.python }}-manylinux_riscv64 |
| 34 | + runs-on: ubuntu-24.04-riscv |
| 35 | + strategy: |
| 36 | + fail-fast: false |
| 37 | + matrix: |
| 38 | + python: ["cp312", "cp313", "cp314", "cp314t"] |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Checkout pillow v${{ env.PILLOW_VERSION }} |
| 42 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 43 | + with: |
| 44 | + repository: python-pillow/Pillow |
| 45 | + ref: ${{ env.PILLOW_VERSION }} |
| 46 | + submodules: true |
| 47 | + persist-credentials: false |
| 48 | + |
| 49 | + - name: Checkout python-wheels |
| 50 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 51 | + with: |
| 52 | + path: python-wheels |
| 53 | + persist-credentials: false |
| 54 | + |
| 55 | + # Works around a GCC LTO bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110812) |
| 56 | + # hit when building libavif as a Pillow wheel dependency on riscv64. |
| 57 | + - name: Patch pillow source |
| 58 | + run: | |
| 59 | + git apply python-wheels/patches/pillow/${{ env.PILLOW_VERSION }}/00*.patch |
| 60 | +
|
| 61 | + - name: Install Python |
| 62 | + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 |
| 63 | + with: |
| 64 | + python-version: '3.12' |
| 65 | + activate-environment: true |
| 66 | + enable-cache: false |
| 67 | + |
| 68 | + - name: Build wheels |
| 69 | + uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 |
| 70 | + env: |
| 71 | + CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64 |
| 72 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 73 | + # libjpeg-turbo doesn't provide riscv64 SIMD before v3.2, and the |
| 74 | + # version vendored by Pillow's wheel build is older than that; also |
| 75 | + # disable arch-specific AOM optimization, see |
| 76 | + # https://aomedia.issues.chromium.org/issues/492439207. Passed as |
| 77 | + # cmake flags (picked up by the libavif build) rather than patching |
| 78 | + # Pillow sources, matching the fix proven previously in |
| 79 | + # wheel_builder/wheel_builder/Pillow/gitlab-ci.yml. |
| 80 | + HOST_CMAKE_FLAGS: "-DWITH_SIMD=0 -DAOM_TARGET_CPU=generic" |
| 81 | + CIBW_ENVIRONMENT_PASS_LINUX: HOST_CMAKE_FLAGS |
| 82 | + |
| 83 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 84 | + with: |
| 85 | + name: pillow-${{ env.PILLOW_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 86 | + path: ./wheelhouse/*.whl |
| 87 | + if-no-files-found: error |
| 88 | + |
| 89 | + publish: |
| 90 | + name: Publish pillow ${{ inputs.version || '12.3.0' }} to GitLab |
| 91 | + needs: [build_wheels] |
| 92 | + # Only publish when the workflow was triggered from main with a specific |
| 93 | + # version. Manual trigger is the only entry point, so checking the ref is |
| 94 | + # enough to gate uploads. |
| 95 | + if: github.ref == 'refs/heads/main' |
| 96 | + runs-on: ubuntu-latest |
| 97 | + permissions: |
| 98 | + contents: write |
| 99 | + pull-requests: write |
| 100 | + |
| 101 | + steps: |
| 102 | + - name: Publish wheels and open docs PR |
| 103 | + uses: riseproject-dev/python-wheels/actions/publish-wheels@main |
| 104 | + with: |
| 105 | + artifact-pattern: pillow-${{ env.PILLOW_VERSION }}-*-manylinux_riscv64 |
| 106 | + gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }} |
| 107 | + gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }} |
| 108 | + gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }} |
| 109 | + gh-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments