Skip to content

ci: publish wheels as immutable GitHub releases #29

ci: publish wheels as immutable GitHub releases

ci: publish wheels as immutable GitHub releases #29

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:
setup:
uses: $/.github/workflows/_setup.yml
build_wheels:
needs: [setup]
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: python-pillow/Pillow
ref: ${{ env.PILLOW_VERSION }}
submodules: true
persist-credentials: false
- name: Checkout python-wheels
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
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@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
python-version: '3.12'
activate-environment: true
enable-cache: false
- name: Build wheels
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.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
CIBW_BUILD_FRONTEND: "build[uv]"
CIBW_ENVIRONMENT: >-
UV_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
UV_INDEX_STRATEGY=unsafe-best-match
UV_ONLY_BINARY=:all:
- 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' }}
needs: [setup, build_wheels]
permissions:
contents: write
pull-requests: write
uses: $/.github/workflows/_publish_wheel.yml
with:
artifact-pattern: pillow-${{ inputs.version || '12.3.0' }}-*-manylinux_riscv64