-
Notifications
You must be signed in to change notification settings - Fork 13
392 lines (346 loc) · 12.9 KB
/
wheels.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
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.platform }}
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" ]
platform: [ "x86_64" ]
manylinux-version: [ "2010" ]
macos-target: [ "10.10" ]
mb-ml-libc: [ "manylinux" ]
multibuild-sha: [ "34e970c4bc448b73af0127615fc4583b4f247369" ]
exclude:
- python: "3.11"
manylinux-version: "2010"
- python: "3.11"
multibuild-sha: "34e970c4bc448b73af0127615fc4583b4f247369"
include:
- os: "macos-11"
os-name: "osx"
- os: "ubuntu-20.04"
manylinux-version: "2010"
os-name: "manylinux2010"
- os: "macos-11"
os-name: "osx"
platform: "arm64"
python: "3.10"
macos-target: "11.0"
- os: "macos-11"
os-name: "osx"
platform: "arm64"
python: "3.9"
macos-target: "11.0"
- os: "macos-11"
os-name: "osx"
platform: "arm64"
python: "3.8"
macos-target: "11.0"
- os: "macos-11"
os-name: "osx"
platform: "arm64"
python: "3.7"
macos-target: "11.0"
- os: "macos-11"
os-name: "osx"
platform: "arm64"
python: "2.7"
macos-target: "11.0"
- python: "3.8"
platform: "x86_64"
mb-ml-libc: "musllinux"
os: "ubuntu-20.04"
os-name: "musllinux"
manylinux-version: ""
- python: "3.9"
platform: "x86_64"
mb-ml-libc: "musllinux"
os: "ubuntu-20.04"
os-name: "musllinux"
manylinux-version: ""
- python: "3.10"
platform: "x86_64"
mb-ml-libc: "musllinux"
os: "ubuntu-20.04"
os-name: "musllinux"
manylinux-version: ""
- python: "3.8"
platform: "aarch64"
os: "ubuntu-20.04"
os-name: "manylinux2014"
manylinux-version: "2014"
- python: "3.9"
platform: "aarch64"
os: "ubuntu-20.04"
os-name: "manylinux2014"
manylinux-version: "2014"
- python: "3.10"
platform: "aarch64"
os: "ubuntu-20.04"
os-name: "manylinux2014"
manylinux-version: "2014"
- python: "3.11"
platform: "x86_64"
os: "macos-11"
os-name: "osx"
macos-target: "10.10"
multibuild-sha: "bb32cfec4f755cb146332a0490abcf3187ce61d1"
- python: "3.11"
platform: "arm64"
os: "macos-11"
os-name: "osx"
macos-target: "11.0"
multibuild-sha: "bb32cfec4f755cb146332a0490abcf3187ce61d1"
- python: "3.11"
platform: "x86_64"
mb-ml-libc: "musllinux"
os: "ubuntu-20.04"
os-name: "musllinux"
manylinux-version: ""
multibuild-sha: "bb32cfec4f755cb146332a0490abcf3187ce61d1"
- python: "3.11"
platform: "aarch64"
os: "ubuntu-20.04"
os-name: "manylinux2014"
manylinux-version: "2014"
multibuild-sha: "bb32cfec4f755cb146332a0490abcf3187ce61d1"
- python: "3.11"
platform: "x86_64"
os: "ubuntu-20.04"
os-name: "manylinux2014"
manylinux-version: "2014"
multibuild-sha: "bb32cfec4f755cb146332a0490abcf3187ce61d1"
env:
BUILD_COMMIT: HEAD
PLAT: ${{ matrix.platform }}
MB_PYTHON_VERSION: ${{ matrix.python }}
TRAVIS_OS_NAME: ${{ matrix.os-name }}
MB_ML_VER: ${{ matrix.manylinux-version }}
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos-target }}
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.multibuild-sha }}
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: ${{ matrix.platform == 'aarch64' }}
- 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 }}-${{ matrix.platform }}
- name: Cache ccache/sccache
uses: actions/cache@v3
with:
path: |
ccache
sccache
key:
cache-${{ matrix.os }}-${{ matrix.os-name }}-${{ matrix.platform }}-${{ 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 }}-${{ matrix.platform }}-${{ 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 }}-${{ matrix.platform }}-${{ 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 }}-${{ matrix.platform }}-
- 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.16.01-win64.zip "-o$env:RUNNER_WORKSPACE\"
echo "$env:RUNNER_WORKSPACE\nasm-2.16.01" >> $env:GITHUB_PATH
python -m pip install meson
# make cache key depend on VS version
& "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
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 / rav1e
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_rav1e.cmd"
- name: Build dependencies / libavif
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libavif.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: Install dependencies / Pillow
run: |
cmd /c "winbuild\build\build_env.cmd && $env:pythonLocation\python.exe -m pip install -v Pillow"
shell: pwsh
- name: Build pillow-avif-plugin
run: |
cmd /c "winbuild\build\build_env.cmd && $env:pythonLocation\python.exe setup.py build_ext 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: |
cmd /c "winbuild\build\build_env.cmd && $env:pythonLocation\python.exe -m pip wheel ."
shell: pwsh
- 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 }}