Pillow/.github/workflows/wheels.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

304 lines
9.6 KiB
YAML
Raw Normal View History

2020-10-23 16:23:03 +03:00
name: Wheels
on:
schedule:
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
- cron: "42 1 * * 0,3"
push:
paths:
2023-11-16 02:04:36 +03:00
- ".ci/requirements-cibw.txt"
- ".github/workflows/wheel*"
- "setup.py"
- "wheels/*"
2023-11-16 02:04:36 +03:00
- "winbuild/build_prepare.py"
- "winbuild/fribidi.cmake"
tags:
- "*"
pull_request:
paths:
2023-11-16 02:04:36 +03:00
- ".ci/requirements-cibw.txt"
- ".github/workflows/wheel*"
- "setup.py"
- "wheels/*"
2023-11-16 02:04:36 +03:00
- "winbuild/build_prepare.py"
- "winbuild/fribidi.cmake"
workflow_dispatch:
permissions:
contents: read
2020-10-23 16:23:03 +03:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
2023-11-12 21:45:19 +03:00
env:
FORCE_COLOR: 1
2020-10-23 16:23:03 +03:00
jobs:
build-1-QEMU-emulated-wheels:
if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'
name: aarch64 ${{ matrix.python-version }} ${{ matrix.spec }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- pp310
2024-07-05 19:08:37 +03:00
- cp3{9,10,11}
- cp3{12,13}
spec:
- manylinux2014
- manylinux_2_28
- musllinux
exclude:
- { python-version: pp310, spec: musllinux }
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-python@v5
with:
python-version: "3.x"
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Install cibuildwheel
run: |
python3 -m pip install -r .ci/requirements-cibw.txt
2024-01-04 03:38:41 +03:00
- name: Build wheels
run: |
python3 -m cibuildwheel --output-dir wheelhouse
env:
# Build only the currently selected Linux architecture (so we can
# parallelise for speed).
CIBW_ARCHS: "aarch64"
# Likewise, select only one Python version per job to speed this up.
2024-01-04 03:38:41 +03:00
CIBW_BUILD: "${{ matrix.python-version }}-${{ matrix.spec == 'musllinux' && 'musllinux' || 'manylinux' }}*"
2024-05-21 05:55:48 +03:00
CIBW_PRERELEASE_PYTHONS: True
# Extra options for manylinux.
CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.spec }}
CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: ${{ matrix.spec }}
- uses: actions/upload-artifact@v4
with:
name: dist-qemu-${{ matrix.python-version }}-${{ matrix.spec }}
path: ./wheelhouse/*.whl
build-2-native-wheels:
if: github.event_name != 'schedule' || github.repository_owner == 'python-pillow'
2023-11-14 15:23:46 +03:00
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: "macOS 10.10 x86_64"
os: macos-13
cibw_arch: x86_64
build: "cp3{9,10,11}*"
macosx_deployment_target: "10.10"
- name: "macOS 10.13 x86_64"
os: macos-13
cibw_arch: x86_64
build: "cp3{12,13}*"
macosx_deployment_target: "10.13"
- name: "macOS 10.15 x86_64"
os: macos-13
cibw_arch: x86_64
build: "pp310*"
macosx_deployment_target: "10.15"
2023-11-14 15:23:46 +03:00
- name: "macOS arm64"
2024-09-13 08:31:37 +03:00
os: macos-latest
cibw_arch: arm64
macosx_deployment_target: "11.0"
2023-11-14 15:23:46 +03:00
- name: "manylinux2014 and musllinux x86_64"
os: ubuntu-latest
cibw_arch: x86_64
2023-11-14 15:23:46 +03:00
- name: "manylinux_2_28 x86_64"
os: ubuntu-latest
cibw_arch: x86_64
2023-11-14 15:23:46 +03:00
build: "*manylinux*"
manylinux: "manylinux_2_28"
steps:
- uses: actions/checkout@v4
with:
submodules: true
2023-11-16 01:10:44 +03:00
2023-12-07 18:07:52 +03:00
- uses: actions/setup-python@v5
with:
python-version: "3.x"
2024-01-04 09:24:09 +03:00
- name: Install cibuildwheel
run: |
python3 -m pip install -r .ci/requirements-cibw.txt
2024-01-04 09:24:09 +03:00
- name: Build wheels
2024-01-04 10:30:46 +03:00
run: |
python3 -m cibuildwheel --output-dir wheelhouse
2023-11-14 15:23:46 +03:00
env:
CIBW_ARCHS: ${{ matrix.cibw_arch }}
2023-11-14 15:23:46 +03:00
CIBW_BUILD: ${{ matrix.build }}
2024-07-09 23:11:11 +03:00
CIBW_FREE_THREADED_SUPPORT: True
2023-11-14 15:23:46 +03:00
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ${{ matrix.manylinux }}
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }}
2024-05-21 05:55:48 +03:00
CIBW_PRERELEASE_PYTHONS: True
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}
2023-11-16 01:10:44 +03:00
2023-12-24 05:42:57 +03:00
- uses: actions/upload-artifact@v4
2023-11-14 15:23:46 +03:00
with:
name: dist-${{ matrix.os }}${{ matrix.macosx_deployment_target && format('-{0}', matrix.macosx_deployment_target) }}-${{ matrix.cibw_arch }}${{ matrix.manylinux && format('-{0}', matrix.manylinux) }}
2023-11-14 15:23:46 +03:00
path: ./wheelhouse/*.whl
2023-11-12 21:45:19 +03:00
2023-11-16 02:04:36 +03:00
windows:
if: github.event_name != 'schedule' || github.repository_owner == 'python-pillow'
name: Windows ${{ matrix.cibw_arch }}
2023-11-16 02:04:36 +03:00
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- cibw_arch: x86
- cibw_arch: AMD64
- cibw_arch: ARM64
2023-11-16 02:04:36 +03:00
steps:
- uses: actions/checkout@v4
- name: Checkout extra test images
uses: actions/checkout@v4
with:
repository: python-pillow/test-images
path: Tests\test-images
2023-12-07 18:07:52 +03:00
- uses: actions/setup-python@v5
2023-11-16 02:04:36 +03:00
with:
python-version: "3.x"
2023-11-16 02:04:36 +03:00
2024-01-04 09:24:09 +03:00
- name: Install cibuildwheel
run: |
python.exe -m pip install -r .ci/requirements-cibw.txt
2024-01-04 09:24:09 +03:00
2023-11-16 02:04:36 +03:00
- name: Prepare for build
run: |
choco install nasm --no-progress
echo "C:\Program Files\NASM" >> $env:GITHUB_PATH
# Install extra test images
xcopy /S /Y Tests\test-images\* Tests\images
& python.exe winbuild\build_prepare.py -v --no-imagequant --architecture=${{ matrix.cibw_arch }}
2023-11-16 02:04:36 +03:00
shell: pwsh
- name: Build wheels
run: |
setlocal EnableDelayedExpansion
for %%f in (winbuild\build\license\*) do (
set x=%%~nf
rem Skip FriBiDi license, it is not included in the wheel.
set fribidi=!x:~0,7!
if NOT !fribidi!==fribidi (
rem Skip imagequant license, it is not included in the wheel.
set libimagequant=!x:~0,13!
if NOT !libimagequant!==libimagequant (
echo. >> LICENSE
echo ===== %%~nf ===== >> LICENSE
echo. >> LICENSE
type %%f >> LICENSE
)
)
)
call winbuild\\build\\build_env.cmd
%pythonLocation%\python.exe -m cibuildwheel . --output-dir wheelhouse
env:
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_BEFORE_ALL: "{package}\\winbuild\\build\\build_dep_all.cmd"
CIBW_CACHE_PATH: "C:\\cibw"
2024-07-09 23:11:11 +03:00
CIBW_FREE_THREADED_SUPPORT: True
2024-05-21 05:55:48 +03:00
CIBW_PRERELEASE_PYTHONS: True
2023-11-16 02:04:36 +03:00
CIBW_TEST_SKIP: "*-win_arm64"
CIBW_TEST_COMMAND: 'docker run --rm
-v {project}:C:\pillow
-v C:\cibw:C:\cibw
-v %CD%\..\venv-test:%CD%\..\venv-test
-e CI -e GITHUB_ACTIONS
mcr.microsoft.com/windows/servercore:ltsc2022
powershell C:\pillow\.github\workflows\wheels-test.ps1 %CD%\..\venv-test'
2023-11-16 02:04:36 +03:00
shell: cmd
- name: Upload wheels
2023-12-24 05:42:57 +03:00
uses: actions/upload-artifact@v4
2023-11-16 02:04:36 +03:00
with:
name: dist-windows-${{ matrix.cibw_arch }}
2023-11-16 02:04:36 +03:00
path: ./wheelhouse/*.whl
- name: Upload fribidi.dll
2023-12-24 05:42:57 +03:00
uses: actions/upload-artifact@v4
with:
name: fribidi-windows-${{ matrix.cibw_arch }}
2023-12-20 21:37:23 +03:00
path: winbuild\build\bin\fribidi*
2023-11-12 21:45:19 +03:00
sdist:
if: github.event_name != 'schedule'
2023-11-12 21:45:19 +03:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
2023-12-07 18:07:52 +03:00
uses: actions/setup-python@v5
2023-11-12 21:45:19 +03:00
with:
python-version: "3.x"
cache: pip
cache-dependency-path: "Makefile"
- run: make sdist
2023-12-24 05:42:57 +03:00
- uses: actions/upload-artifact@v4
2023-11-12 21:45:19 +03:00
with:
2023-12-24 05:42:57 +03:00
name: dist-sdist
2023-11-12 21:45:19 +03:00
path: dist/*.tar.gz
2023-12-14 11:02:48 +03:00
scientific-python-nightly-wheels-publish:
if: github.repository_owner == 'python-pillow' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
needs: [build-2-native-wheels, windows]
runs-on: ubuntu-latest
name: Upload wheels to scientific-python-nightly-wheels
steps:
- uses: actions/download-artifact@v4
with:
pattern: dist-*
path: dist
merge-multiple: true
- name: Upload wheels to scientific-python-nightly-wheels
uses: scientific-python/upload-nightly-action@ccf29c805b5d0c1dc31fa97fcdb962be074cade3 # 0.6.0
with:
artifacts_path: dist
anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }}
2023-12-14 11:02:48 +03:00
pypi-publish:
if: github.repository_owner == 'python-pillow' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [build-1-QEMU-emulated-wheels, build-2-native-wheels, windows, sdist]
2023-12-14 11:02:48 +03:00
runs-on: ubuntu-latest
name: Upload release to PyPI
environment:
name: release-pypi
2023-12-14 11:02:48 +03:00
url: https://pypi.org/p/Pillow
permissions:
id-token: write
steps:
2023-12-24 05:42:57 +03:00
- uses: actions/download-artifact@v4
with:
pattern: dist-*
path: dist
merge-multiple: true
- name: Publish to PyPI
2023-12-14 11:02:48 +03:00
uses: pypa/gh-action-pypi-publish@release/v1