Wheels #4
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: | |
paths: | |
- ".github/workflows/wheels*.yml" | |
- "wheels/*" | |
- "winbuild/build_prepare.py" | |
- "winbuild/fribidi.cmake" | |
tags: | |
- "*" | |
pull_request: | |
paths: | |
- ".github/workflows/wheels*.yml" | |
- "wheels/*" | |
- "winbuild/build_prepare.py" | |
- "winbuild/fribidi.cmake" | |
workflow_dispatch: | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
FORCE_COLOR: 1 | |
jobs: | |
build: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: "macOS x86_64" | |
os: macos-latest | |
archs: x86_64 | |
- name: "macOS arm64" | |
os: macos-latest | |
archs: arm64 | |
- name: "manylinux2014 and musllinux x86_64" | |
os: ubuntu-latest | |
archs: x86_64 | |
- name: "manylinux_2_28 x86_64" | |
os: ubuntu-latest | |
archs: x86_64 | |
build: "*manylinux*" | |
manylinux: "manylinux_2_28" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
output-dir: wheelhouse | |
env: | |
CIBW_ARCHS: ${{ matrix.archs }} | |
CIBW_BUILD: ${{ matrix.build }} | |
CIBW_CONFIG_SETTINGS: raqm=enable raqm=vendor fribidi=vendor | |
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ${{ matrix.manylinux }} | |
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
windows: | |
name: Windows ${{ matrix.arch }} | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- arch: x86 | |
cibw_arch: x86 | |
- arch: x64 | |
cibw_arch: AMD64 | |
- arch: ARM64 | |
cibw_arch: ARM64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Checkout extra test images | |
uses: actions/checkout@v4 | |
with: | |
repository: python-pillow/test-images | |
path: Tests\test-images | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install build dependencies | |
run: | | |
$nasm_uri = "https://github.com/python-pillow/pillow-depends/raw/main/nasm-2.16.01-win64.zip" | |
Invoke-WebRequest -Uri $nasm_uri -OutFile 'nasm.zip' | |
7z x nasm.zip "-o$env:RUNNER_WORKSPACE\" | |
echo "$env:RUNNER_WORKSPACE\nasm-2.16.01" >> $env:GITHUB_PATH | |
choco install ghostscript --version=10.0.0.20230317 | |
echo "C:\Program Files\gs\gs10.00.0\bin" >> $env:GITHUB_PATH | |
# Install extra test images | |
xcopy /S /Y Tests\test-images\* Tests\images | |
& python.exe -m pip install cibuildwheel==2.16.2 | |
& python.exe winbuild\build_prepare.py -v --no-imagequant --architecture=${{ matrix.arch }} | |
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_CONFIG_SETTINGS: raqm=enable raqm=vendor fribidi=vendor | |
CIBW_BEFORE_ALL: "{package}\\winbuild\\build\\build_dep_all.cmd" | |
CIBW_TEST_COMMAND: "cd /d {project} && call .github/workflows/wheels-test.cmd" | |
shell: cmd | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
cache: pip | |
cache-dependency-path: "Makefile" | |
- run: make sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/*.tar.gz | |
success: | |
permissions: | |
contents: none | |
needs: [build, windows, sdist] | |
runs-on: ubuntu-latest | |
name: Wheels Successful | |
steps: | |
- name: Success | |
run: echo Wheels Successful |