Build package for python 3.12 #341
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Wheels | |
on: [push, pull_request] | |
env: | |
REPO_DIR: pillow-avif-plugin | |
BUILD_DEPENDS: "" | |
TEST_DEPENDS: "pytest pillow" | |
MACOSX_DEPLOYMENT_TARGET: "10.10" | |
WHEEL_SDIR: wheelhouse | |
CONFIG_PATH: pillow-avif-plugin/wheelbuild/config.sh | |
LIBAVIF_VERSION: 0.10.1 | |
jobs: | |
build: | |
name: ${{ matrix.python }} ${{ matrix.os-name }} ${{ matrix.arch == 'x86' && 'x86_64' || matrix.os == 'macos-11' && 'arm64' || 'aarch64' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ "ubuntu-20.04", "macos-11" ] | |
python: [ "2.7", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12" ] | |
arch: [ "x86", "arm" ] | |
manylinux-version: [ "2014" ] | |
mb-ml-libc: [ "manylinux" ] | |
exclude: | |
- python: "2.7" | |
os: "ubuntu-20.04" | |
manylinux-version: "2014" | |
- python: "3.7" | |
os: "ubuntu-20.04" | |
manylinux-version: "2014" | |
- python: "2.7" | |
os: "ubuntu-20.04" | |
arch: "arm" | |
include: | |
- os: "ubuntu-20.04" | |
python: "2.7" | |
arch: "x86" | |
manylinux-version: "2010" | |
os-name: "manylinux2010" | |
- os: "ubuntu-20.04" | |
python: "3.7" | |
arch: "x86" | |
manylinux-version: "2010" | |
os-name: "manylinux2010" | |
- os: "macos-11" | |
os-name: "osx" | |
- os: "ubuntu-20.04" | |
manylinux-version: "2014" | |
os-name: "manylinux2014" | |
- python: "3.8" | |
arch: "x86" | |
mb-ml-libc: "musllinux" | |
os: "ubuntu-20.04" | |
os-name: "musllinux" | |
manylinux-version: "_1_1" | |
- python: "3.9" | |
arch: "x86" | |
mb-ml-libc: "musllinux" | |
os: "ubuntu-20.04" | |
os-name: "musllinux" | |
manylinux-version: "_1_1" | |
- python: "3.10" | |
arch: "x86" | |
mb-ml-libc: "musllinux" | |
os: "ubuntu-20.04" | |
os-name: "musllinux" | |
manylinux-version: "_1_1" | |
- python: "3.11" | |
arch: "x86" | |
mb-ml-libc: "musllinux" | |
os: "ubuntu-20.04" | |
os-name: "musllinux" | |
manylinux-version: "_1_1" | |
- python: "3.12" | |
arch: "x86" | |
mb-ml-libc: "musllinux" | |
os: "ubuntu-20.04" | |
os-name: "musllinux" | |
manylinux-version: "_1_1" | |
env: | |
BUILD_COMMIT: HEAD | |
PLAT: ${{ matrix.arch == 'x86' && 'x86_64' || matrix.os == 'macos-11' && 'arm64' || 'aarch64' }} | |
MB_PYTHON_VERSION: ${{ matrix.python }} | |
TRAVIS_OS_NAME: ${{ matrix.os-name }} | |
MB_ML_VER: ${{ matrix.manylinux-version }} | |
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.arch == 'arm' && '11.0' || '10.10' }} | |
MB_ML_LIBC: ${{ matrix.mb-ml-libc }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
path: pillow-avif-plugin | |
- name: Checkout dependencies | |
uses: actions/checkout@v3 | |
with: | |
repository: fdintino/pillow-avif-plugin-depends | |
path: pillow-avif-plugin-depends | |
- name: Checkout multibuild | |
uses: actions/checkout@v3 | |
with: | |
repository: multi-build/multibuild | |
path: multibuild | |
ref: ${{ (matrix.python == '3.11' || matrix.python == '3.12') && '452dd2d1705f6b2375369a6570c415beb3163f70' || '34e970c4bc448b73af0127615fc4583b4f247369' }} | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.arch == 'arm' }} | |
- name: Setup env_vars | |
run: | | |
cat <<'EOF' >> env_vars.sh | |
export LIBAVIF_VERSION=${{ env.LIBAVIF_VERSION }}" | |
export GITHUB_ACTIONS=1" | |
EOF | |
- name: Cache build | |
id: build-cache | |
uses: actions/cache@v3 | |
with: | |
path: pillow-avif-plugin/depends/libavif-${{ env.LIBAVIF_VERSION }} | |
key: | |
${{ env.LIBAVIF_VERSION }}-${{ hashFiles('pillow-avif-plugin/wheelbuild/*.sh', 'pillow-avif-plugin/.github/workflows/wheels.yml', 'pillow-avif-plugin/depends/*') }}-${{ matrix.os }}-${{ env.PLAT }} | |
- name: Cache ccache/sccache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
ccache | |
sccache | |
key: | |
cache-${{ matrix.os }}-${{ matrix.os-name }}-${{ env.PLAT }}-${{ hashFiles('pillow-avif-plugin/wheelbuild/*.sh', 'pillow-avif-plugin/.github/workflows/wheels.yml', 'pillow-avif-plugin/depends/*', 'pillow-avif-plugin/**/*.py', 'pillow-avif-plugin/**/*.c') }}-${{ matrix.python }} | |
restore-keys: | | |
cache-${{ matrix.os }}-${{ matrix.os-name }}-${{ env.PLAT }}-${{ hashFiles('pillow-avif-plugin/wheelbuild/*.sh', 'pillow-avif-plugin/.github/workflows/wheels.yml', 'pillow-avif-plugin/depends/*', 'pillow-avif-plugin/**/*.py', 'pillow-avif-plugin/**/*.c') }}-${{ matrix.python }} | |
cache-${{ matrix.os }}-${{ matrix.os-name }}-${{ env.PLAT }}-${{ hashFiles('pillow-avif-plugin/wheelbuild/*.sh', 'pillow-avif-plugin/.github/workflows/wheels.yml', 'pillow-avif-plugin/depends/*', 'pillow-avif-plugin/**/*.py', 'pillow-avif-plugin/**/*.c') }} | |
cache-${{ matrix.os }}-${{ matrix.os-name }}-${{ env.PLAT }}- | |
- name: Build Wheel | |
run: pillow-avif-plugin/wheelbuild/build.sh | |
- name: Fix Directory Permissions | |
run: | | |
sudo chown -R $(whoami):$(id -ng) ccache ||: | |
sudo chown -R $(whoami):$(id -ng) sccache ||: | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: wheelhouse/*.whl | |
windows: | |
runs-on: windows-2019 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] | |
architecture: ["x64"] | |
include: | |
- architecture: "x64" | |
platform-vcvars: "x86_amd64" | |
platform-msbuild: "x64" | |
timeout-minutes: 300 | |
name: ${{ matrix.python-version }} windows ${{ matrix.architecture }} | |
steps: | |
- name: Checkout pillow-avif-plugin | |
uses: actions/checkout@v3 | |
- name: Checkout cached dependencies | |
uses: actions/checkout@v3 | |
with: | |
repository: python-pillow/pillow-depends | |
path: winbuild\depends | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
path: ~\AppData\Local\pip\Cache | |
key: | |
${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.architecture }}-${{ hashFiles('**/.github/workflows/test-windows.yml') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.architecture }}- | |
${{ runner.os }}-${{ matrix.python-version }}- | |
# sets env: pythonLocation | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.architecture }} | |
- name: python -m pip install wheel pytest pytest-cov mock | |
run: python -m pip install wheel pytest pytest-cov mock | |
- name: Install dependencies | |
id: install | |
run: | | |
7z x winbuild\depends\nasm-2.14.02-win64.zip "-o$env:RUNNER_WORKSPACE\" | |
echo "$env:RUNNER_WORKSPACE\nasm-2.14.02" >> $env:GITHUB_PATH | |
winbuild\depends\gs9533w32.exe /S | |
echo "C:\Program Files (x86)\gs\gs9.53.3\bin" >> $env:GITHUB_PATH | |
& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" ` | |
| find """catalog_buildVersion""" ` | |
| ForEach-Object { $a = $_.split(" ")[1]; echo "vs=$a" >> $env:GITHUB_OUTPUT } | |
shell: pwsh | |
- name: Cache build | |
id: build-cache | |
uses: actions/cache@v3 | |
with: | |
path: winbuild\build | |
key: | |
${{ hashFiles('winbuild\build_prepare.py') }}-${{ hashFiles('.github\workflows\test-windows.yml') }}-${{ env.pythonLocation }}-${{ steps.install.outputs.vs }} | |
- name: Prepare build | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: | | |
& python.exe winbuild\build_prepare.py -v --python=$env:pythonLocation --srcdir | |
shell: pwsh | |
- name: Build dependencies / libjpeg-turbo | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: "& winbuild\\build\\build_dep_libjpeg.cmd" | |
- name: Build dependencies / zlib | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: "& winbuild\\build\\build_dep_zlib.cmd" | |
- name: Build dependencies / libpng | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: "& winbuild\\build\\build_dep_libpng.cmd" | |
- name: Build dependencies / meson (python 2.7) | |
if: steps.build-cache.outputs.cache-hit != 'true' && matrix.python-version == '2.7' | |
run: "& winbuild\\build\\install_meson.cmd" | |
- name: Build dependencies / meson (python 3.x) | |
if: steps.build-cache.outputs.cache-hit != 'true' && matrix.python-version != '2.7' | |
run: python -m pip install meson | |
shell: cmd | |
- name: Build dependencies / libavif | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: "& winbuild\\build\\build_dep_libavif.cmd" | |
- name: Install dependencies / Pillow | |
run: "& winbuild\\build\\install_pillow.cmd" | |
# trim ~150MB x 9 | |
- name: Optimize build cache | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: rmdir /S /Q winbuild\build\src | |
shell: cmd | |
- name: Build pillow-avif-plugin | |
run: "& winbuild\\build\\build_pillow_avif_plugin.cmd install" | |
shell: pwsh | |
# failing with PyPy3 | |
- name: Enable heap verification | |
if: "!contains(matrix.python-version, 'pypy')" | |
run: "& 'C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x86\\gflags.exe' /p /enable $env:pythonLocation\\python.exe" | |
- name: Test pillow-avif-plugin | |
run: | | |
path %GITHUB_WORKSPACE%\\winbuild\\build\\bin;%PATH% | |
python.exe -m pytest -v -W always --cov pillow_avif --cov tests --cov-report term --cov-report xml tests | |
shell: cmd | |
- name: Prepare to upload errors | |
if: failure() | |
run: | | |
mkdir -p tests/errors | |
shell: pwsh | |
- name: Upload errors | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: errors | |
path: tests/errors | |
- name: After success | |
run: | | |
coverage xml | |
shell: pwsh | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
flags: GHA_Windows | |
name: ${{ runner.os }} Python ${{ matrix.python-version }} ${{ matrix.architecture }} | |
- name: Build wheel | |
id: wheel | |
if: "github.event_name == 'push'" | |
run: | | |
for /f "tokens=3 delims=/" %%a in ("${{ github.ref }}") do echo dist=dist-%%a >> %GITHUB_OUTPUT% | |
winbuild\\build\\build_pillow_avif_plugin.cmd bdist_wheel | |
shell: cmd | |
- uses: actions/upload-artifact@v3 | |
if: "github.event_name == 'push'" | |
with: | |
name: wheels | |
path: dist\*.whl | |
success: | |
needs: [build, windows] | |
runs-on: ubuntu-20.04 | |
name: Build Successful | |
steps: | |
- name: Success | |
run: echo Build Successful | |
release: | |
name: Create Release | |
runs-on: ubuntu-20.04 | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: [build, windows] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- name: Upload Release | |
uses: fnkr/[email protected] | |
env: | |
GHR_PATH: . | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |