-
Notifications
You must be signed in to change notification settings - Fork 17
408 lines (342 loc) · 13.6 KB
/
analysis-coverage.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
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
name: Analysis & Coverage
on:
pull_request:
paths:
- '.github/workflows/analysis-coverage.yml'
- 'pillow_heif/*.*'
- 'tests/**'
- 'setup.py'
- 'pyproject.toml'
- '.pre-commit-config.yaml'
push:
branches: [master]
paths:
- '.github/workflows/analysis-coverage.yml'
- 'pillow_heif/*.*'
- 'tests/**'
- 'setup.py'
- 'pyproject.toml'
- '.pre-commit-config.yaml'
workflow_dispatch:
jobs:
analysis:
runs-on: macos-13
name: Analysis
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Libheif
run: brew install libheif
- name: Install from source
run: python3 -m pip install ".[dev]" wheel setuptools
- name: Run Analysis
run: python3 -m pylint "setup.py" "pillow_heif/"
coverage-linux:
runs-on: ubuntu-22.04
name: Coverage(Linux) • 🐍3.11
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Prepare system
run: |
sudo apt -y purge libheif1
sudo add-apt-repository ppa:strukturag/libheif
sudo apt update
sudo apt -y install libheif-dev
- name: Install from source
run: |
python3 -m pip install pillow==10.2.0
python3 -m pip -v install ".[dev]"
- name: LibHeif info
run: python3 -c "import pillow_heif; print(pillow_heif.libheif_info())"
# - name: Generate coverage report
# run: |
# TEST_PLUGIN_LOAD="$(whereis libheif | awk '{print $2}')/plugins/libheif-x265.so" coverage run -m pytest
# coverage xml && coverage html
#
# - name: HTML coverage to artifacts
# uses: actions/upload-artifact@v3
# with:
# name: coverage_linux
# path: ./htmlcov
# if-no-files-found: error
#
# - name: Upload report to Codecov
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# file: ./coverage.xml
# fail_ci_if_error: true
# verbose: true
coverage-linux-pillow-dev:
runs-on: ubuntu-22.04
name: Coverage(Linux, Pillow-dev) • 🐍3.12
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Prepare system
run: |
sudo apt -y purge libheif1
sudo add-apt-repository ppa:strukturag/libheif
sudo apt update
sudo apt -y install libheif-dev
sudo apt -y install zlib1g-dev libjpeg-dev liblcms2-dev libwebp-dev libfribidi-dev libharfbuzz-dev libffi-dev
- name: Install from source
run: |
git clone --depth=1 https://github.com/python-pillow/Pillow.git
cd Pillow && python3 -m pip install . && cd ..
python3 -m pip -v install ".[dev]"
- name: LibHeif info
run: python3 -c "import pillow_heif; print(pillow_heif.libheif_info())"
# - name: Generate coverage report
# run: |
# TEST_PLUGIN_LOAD="$(whereis libheif | awk '{print $2}')/plugins/libheif-x265.so" coverage run -m pytest
# coverage xml && coverage html
#
# - name: HTML coverage to artifacts
# uses: actions/upload-artifact@v3
# with:
# name: coverage_linux_dev
# path: ./htmlcov
# if-no-files-found: error
#
# - name: Upload report to Codecov
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# file: ./coverage.xml
# fail_ci_if_error: true
# verbose: true
coverage-macos:
runs-on: macos-13
name: Coverage(macOS-13) • 🐍3.10
env:
TEST_DECODE_THREADS: 0 # This test fails on GitHub on macOS. We have such enabled test on Cirrus.
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Libheif
run: brew install libheif
- name: Install from source
run: python3 -m pip -v install ".[dev]"
- name: LibHeif info
run: python3 -c "import pillow_heif; print(pillow_heif.libheif_info())"
- name: Generate coverage report
run: coverage run -m pytest && coverage xml && coverage html
- name: HTML coverage to artifacts
uses: actions/upload-artifact@v3
with:
name: coverage_macos
path: ./htmlcov
if-no-files-found: error
- name: Upload report to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
verbose: true
coverage-macos-arm:
runs-on: macos-14
name: Coverage(macOS-14) • 🐍3.11
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Libheif
run: brew install libheif
- name: Install from source
run: python3 -m pip -v install ".[dev]"
- name: LibHeif info
run: python3 -c "import pillow_heif; print(pillow_heif.libheif_info())"
- name: Generate coverage report
run: coverage run -m pytest && coverage xml && coverage html
- name: HTML coverage to artifacts
uses: actions/upload-artifact@v3
with:
name: coverage_macos_arm
path: ./htmlcov
if-no-files-found: error
- name: Upload report to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
verbose: true
coverage-windows:
runs-on: windows-2022
name: Coverage(Windows) • 🐍3.9
env:
MSYS2_PREFIX: "C:/temp/msys64/mingw64"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- uses: msys2/setup-msys2@v2
with:
location: C:/temp
update: true
install: >-
mingw-w64-x86_64-binutils
mingw-w64-x86_64-libheif
# In release or building from source we do not build `dav1d`,`rav1e` and `libSvtAv1Enc` libraries.
# Here we just test working with original package from MSYS.
- name: Copy DLLs from MSYS2
run: |
python -c 'import sysconfig; print(sysconfig.get_paths()["platlib"])'
$site_packages=(python -c 'import sysconfig; print(sysconfig.get_paths()["platlib"])')
Get-ChildItem -Path $Env:MSYS2_PREFIX/bin -Force | Format-List
cp ${{ env.MSYS2_PREFIX }}/bin/libheif.dll $site_packages/
cp ${{ env.MSYS2_PREFIX }}/bin/libde265-0.dll $site_packages/
cp ${{ env.MSYS2_PREFIX }}/bin/libx265-209.dll $site_packages/
cp ${{ env.MSYS2_PREFIX }}/bin/libaom.dll $site_packages/
cp ${{ env.MSYS2_PREFIX }}/bin/libwinpthread-1.dll $site_packages/
cp ${{ env.MSYS2_PREFIX }}/bin/libgcc_s_seh-1.dll $site_packages/
cp ${{ env.MSYS2_PREFIX }}/bin/libstdc++-6.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libsharpyuv-*.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libdav1d-*.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/rav1e.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libkvazaar-*.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libcryptopp.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libjpeg-*.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libopenjp2-*.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/zlib1.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libSvtAv1Dec-*.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libSvtAv1Enc-*.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libbrotlicommon.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libbrotlidec.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libbrotlienc.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libtiff-*.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libzstd.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libwebp-*.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/liblzma-*.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libLerc.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libdeflate.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libjbig-*.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libtiffxx-*.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libopenjph-*.dll $site_packages/
cp -ErrorAction SilentlyContinue ${{ env.MSYS2_PREFIX }}/bin/libopenh264-*.dll $site_packages/
- name: Install from source
run: |
python -m pip install pillow==10.1.0
python -m pip -v install ".[dev]"
- name: LibHeif info
run: python -c "import pillow_heif; print(pillow_heif.libheif_info())"
- name: Generate coverage report
run: coverage run -m pytest && coverage xml && coverage html
- name: HTML coverage to artifacts
uses: actions/upload-artifact@v3
with:
name: coverage_windows
path: ./htmlcov
if-no-files-found: error
- name: Upload report to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
verbose: true
coverage-pi-heif:
runs-on: ubuntu-22.04
name: Pi-Heif Coverage(Linux) • 🐍3.13
steps:
- uses: actions/checkout@v4
- name: Transform to Pi-Heif
run: cp -r -v ./pi-heif/* .
- uses: actions/setup-python@v5
with:
python-version: '3.13'
allow-prereleases: true
- name: Prepare system
run: |
sudo apt -y purge libheif1 libaom-dev libx265-dev libde265-dev
sudo apt -y install nasm
- name: Install from source
run: |
sudo -H python3 -m pip install pillow==10.3.0 pytest defusedxml packaging numpy coverage
sudo -H PH_LIGHT_ACTION=1 python3 libheif/linux_build_libs.py
sudo -H python3 -m pip -v install --no-build-isolation .
- name: LibHeif info
run: sudo -H python3 -c "import pillow_heif; print(pillow_heif.libheif_info())"
- name: Generate coverage report
run: sudo -H coverage run -m pytest && coverage xml && coverage html
- name: HTML coverage to artifacts
uses: actions/upload-artifact@v3
with:
name: coverage_light_macos
path: ./htmlcov
if-no-files-found: error
- name: Upload report to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
verbose: true
test-pi-heif:
runs-on: ubuntu-22.04
name: Pi-Heif Test(Linux) • 🐍3.13
steps:
- uses: actions/checkout@v4
- name: Transform to Pi-Heif
run: |
cp -r -v ./pi-heif/* .
python3 .github/transform_to-pi_heif.py
- uses: actions/setup-python@v5
with:
python-version: '3.13'
allow-prereleases: true
- name: Prepare system
run: |
sudo apt -y purge libheif1 libaom-dev libx265-dev libde265-dev
sudo apt -y install nasm
- name: Install from source
run: |
sudo -H python3 -m pip install pillow==10.1.0 pytest defusedxml packaging numpy
sudo -H PH_LIGHT_ACTION=1 python3 libheif/linux_build_libs.py
sudo -H python3 -m pip -v install --no-build-isolation .
- name: LibHeif info
run: sudo -H python3 -c "import pi_heif; print(pi_heif.libheif_info())"
- name: Perform tests
run: sudo -H PH_LIGHT_ACTION=1 EXP_PH_LIBHEIF_VERSION="" python3 -m pytest
coverage-import-error:
runs-on: macos-13
name: Coverage(ImportError)
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Libheif
run: brew install libheif
- name: Install from source
run: |
python3 -m pip -v install .
python3 -m pip install pytest coverage
- name: Generate coverage report
run: coverage run -m pytest tests/import_error_test.py && coverage xml && coverage html
- name: HTML coverage to artifacts
uses: actions/upload-artifact@v3
with:
name: coverage_macos_imp_err
path: ./htmlcov
if-no-files-found: error
- name: Upload report to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
verbose: true