Skip to content

Upgrade pillow to v12.3.0 #1

Upgrade pillow to v12.3.0

Upgrade pillow to v12.3.0 #1

Workflow file for this run

---
name: Build pillow wheels (riscv64)
on:
workflow_dispatch:
inputs:
version:
description: 'pillow version to build (git tag without leading v, e.g. 12.3.0)'
required: true
default: '12.3.0'
pull_request:
paths:
- '.github/workflows/build-pillow.yml'
- '.github/workflows/test-pillow.yml'
- 'patches/pillow/**'
concurrency:
group: ${{ github.workflow }}-${{ inputs.version || '12.3.0' }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read # to fetch code (actions/checkout)
env:
PILLOW_VERSION: ${{ inputs.version || '12.3.0' }}
UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/
UV_INDEX_STRATEGY: unsafe-best-match
UV_ONLY_BINARY: ':all:'
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
jobs:
build_wheels:
name: Build pillow ${{ inputs.version || '12.3.0' }} ${{ matrix.python }}-manylinux_riscv64
runs-on: ubuntu-24.04-riscv
strategy:
fail-fast: false
matrix:
python: ["cp312", "cp313", "cp314", "cp314t"]
steps:
- name: Checkout pillow v${{ env.PILLOW_VERSION }}
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: python-pillow/Pillow
ref: ${{ env.PILLOW_VERSION }}
submodules: true
persist-credentials: false
- name: Checkout python-wheels
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
path: python-wheels
persist-credentials: false
# Works around a GCC LTO bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110812)
# hit when building libavif as a Pillow wheel dependency on riscv64.
- name: Patch pillow source
run: |
git apply python-wheels/patches/pillow/${{ env.PILLOW_VERSION }}/00*.patch
- name: Install Python
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
python-version: '3.12'
activate-environment: true
enable-cache: false
- name: Build wheels
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
env:
CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
# libjpeg-turbo doesn't provide riscv64 SIMD before v3.2, and the
# version vendored by Pillow's wheel build is older than that; also
# disable arch-specific AOM optimization, see
# https://aomedia.issues.chromium.org/issues/492439207. Passed as
# cmake flags (picked up by the libavif build) rather than patching
# Pillow sources, matching the fix proven previously in
# wheel_builder/wheel_builder/Pillow/gitlab-ci.yml.
HOST_CMAKE_FLAGS: "-DWITH_SIMD=0 -DAOM_TARGET_CPU=generic"
CIBW_ENVIRONMENT_PASS_LINUX: HOST_CMAKE_FLAGS
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pillow-${{ env.PILLOW_VERSION }}-${{ matrix.python }}-manylinux_riscv64
path: ./wheelhouse/*.whl
if-no-files-found: error
publish:
name: Publish pillow ${{ inputs.version || '12.3.0' }} to GitLab
needs: [build_wheels]
# Only publish when the workflow was triggered from main with a specific
# version. Manual trigger is the only entry point, so checking the ref is
# enough to gate uploads.
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Publish wheels and open docs PR
uses: riseproject-dev/python-wheels/actions/publish-wheels@main
with:
artifact-pattern: pillow-${{ env.PILLOW_VERSION }}-*-manylinux_riscv64
gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }}
gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }}
gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }}
gh-token: ${{ secrets.GITHUB_TOKEN }}