-
Notifications
You must be signed in to change notification settings - Fork 17
335 lines (277 loc) · 10.2 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
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-12
name: Analysis
steps:
- uses: actions/checkout@v4
- name: Install from source
run: python3 -m pip install ".[dev]" wheel
- 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@v4
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==9.5.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: 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@v3
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@v4
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: 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@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
verbose: true
coverage-macos:
runs-on: macos-12
name: Coverage(macOS) • 🐍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@v4
with:
python-version: '3.10'
- 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@v3
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@v4
with:
python-version: '3.9'
- uses: msys2/setup-msys2@v2
with:
location: C:/temp
install: >-
mingw-w64-x86_64-binutils
mingw-w64-x86_64-libheif
- name: Build libheif and dependencies
shell: msys2 {0}
run: |
cd libheif/windows/mingw-w64-libheif
makepkg-mingw --syncdeps --noconfirm -f
pacman -U mingw-w64-x86_64-libheif-*-any.pkg.tar.zst --noconfirm
# 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\"])')
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.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-0.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/libSvtAv1Enc.dll $site_packages/
- name: Install from source
run: |
python -m pip install pillow==9.2.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@v3
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.8
steps:
- uses: actions/checkout@v4
- name: Transform to Pi-Heif
run: cp -r -v ./pi-heif/* .
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- 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==9.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@v3
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.8
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@v4
with:
python-version: '3.8'
- 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==9.4.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-12
name: Coverage(ImportError)
steps:
- uses: actions/checkout@v4
- 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@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
verbose: true