@@ -3,14 +3,20 @@ name: Wheels
33on :
44 push :
55 paths :
6- - " .github/workflows/wheels*.yml"
6+ - " .ci/requirements-cibw.txt"
7+ - " .github/workflows/wheel*"
78 - " wheels/*"
9+ - " winbuild/build_prepare.py"
10+ - " winbuild/fribidi.cmake"
811 tags :
912 - " *"
1013 pull_request :
1114 paths :
12- - " .github/workflows/wheels*.yml"
15+ - " .ci/requirements-cibw.txt"
16+ - " .github/workflows/wheel*"
1317 - " wheels/*"
18+ - " winbuild/build_prepare.py"
19+ - " winbuild/fribidi.cmake"
1420 workflow_dispatch :
1521
1622permissions :
6369 env :
6470 CIBW_ARCHS : ${{ matrix.archs }}
6571 CIBW_BUILD : ${{ matrix.build }}
66- CIBW_CONFIG_SETTINGS : raqm=enable raqm=vendor fribidi=vendor
6772 CIBW_MANYLINUX_PYPY_X86_64_IMAGE : ${{ matrix.manylinux }}
6873 CIBW_MANYLINUX_X86_64_IMAGE : ${{ matrix.manylinux }}
6974 CIBW_SKIP : pp38-*
@@ -75,6 +80,102 @@ jobs:
7580 name : dist
7681 path : ./wheelhouse/*.whl
7782
83+ windows :
84+ name : Windows ${{ matrix.arch }}
85+ runs-on : windows-latest
86+ strategy :
87+ fail-fast : false
88+ matrix :
89+ include :
90+ - arch : x86
91+ cibw_arch : x86
92+ - arch : x64
93+ cibw_arch : AMD64
94+ - arch : ARM64
95+ cibw_arch : ARM64
96+ steps :
97+ - uses : actions/checkout@v4
98+
99+ - name : Checkout extra test images
100+ uses : actions/checkout@v4
101+ with :
102+ repository : python-pillow/test-images
103+ path : Tests\test-images
104+
105+ - uses : actions/setup-python@v4
106+ with :
107+ python-version : " 3.x"
108+
109+ - name : Prepare for build
110+ run : |
111+ choco install nasm --no-progress
112+ echo "C:\Program Files\NASM" >> $env:GITHUB_PATH
113+
114+ # Install extra test images
115+ xcopy /S /Y Tests\test-images\* Tests\images
116+
117+ & python.exe -m pip install -r .ci/requirements-cibw.txt
118+
119+ # Cannot cross-compile FriBiDi (only used for tests)
120+ $FLAGS = ("--no-imagequant", "--architecture=${{ matrix.arch }}")
121+ if ('${{ matrix.arch }}' -eq 'ARM64') { $FLAGS += "--no-fribidi" }
122+ & python.exe winbuild\build_prepare.py -v @FLAGS
123+ shell : pwsh
124+
125+ - name : Build wheels
126+ run : |
127+ setlocal EnableDelayedExpansion
128+ for %%f in (winbuild\build\license\*) do (
129+ set x=%%~nf
130+ rem Skip FriBiDi license, it is not included in the wheel.
131+ set fribidi=!x:~0,7!
132+ if NOT !fribidi!==fribidi (
133+ rem Skip imagequant license, it is not included in the wheel.
134+ set libimagequant=!x:~0,13!
135+ if NOT !libimagequant!==libimagequant (
136+ echo. >> LICENSE
137+ echo ===== %%~nf ===== >> LICENSE
138+ echo. >> LICENSE
139+ type %%f >> LICENSE
140+ )
141+ )
142+ )
143+ call winbuild\\build\\build_env.cmd
144+ %pythonLocation%\python.exe -m cibuildwheel . --output-dir wheelhouse
145+ env :
146+ CIBW_ARCHS : ${{ matrix.cibw_arch }}
147+ CIBW_BEFORE_ALL : " {package}\\ winbuild\\ build\\ build_dep_all.cmd"
148+ CIBW_CACHE_PATH : " C:\\ cibw"
149+ CIBW_TEST_SKIP : " *-win_arm64"
150+ CIBW_TEST_COMMAND : ' docker run --rm
151+ -v {project}:C:\pillow
152+ -v C:\cibw:C:\cibw
153+ -v %CD%\..\venv-test:%CD%\..\venv-test
154+ -e CI -e GITHUB_ACTIONS
155+ mcr.microsoft.com/windows/servercore:ltsc2022
156+ powershell C:\pillow\.github\workflows\wheels-test.ps1 %CD%\..\venv-test'
157+ shell : cmd
158+
159+ - name : Upload wheels
160+ uses : actions/upload-artifact@v3
161+ with :
162+ name : dist
163+ path : ./wheelhouse/*.whl
164+
165+ - name : Prepare to upload FriBiDi
166+ if : " matrix.arch != 'ARM64'"
167+ run : |
168+ mkdir fribidi\${{ matrix.arch }}
169+ copy winbuild\build\bin\fribidi* fribidi\${{ matrix.arch }}
170+ shell : cmd
171+
172+ - name : Upload fribidi.dll
173+ if : " matrix.arch != 'ARM64'"
174+ uses : actions/upload-artifact@v3
175+ with :
176+ name : fribidi
177+ path : fribidi\*
178+
78179 sdist :
79180 runs-on : ubuntu-latest
80181 steps :
97198 success :
98199 permissions :
99200 contents : none
100- needs : [build, sdist]
201+ needs : [build, windows, sdist]
101202 runs-on : ubuntu-latest
102203 name : Wheels Successful
103204 steps :
0 commit comments