forked from python-pillow/Pillow
-
Notifications
You must be signed in to change notification settings - Fork 86
234 lines (196 loc) · 7.33 KB
/
test-windows.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
name: Test Windows
on: [push, pull_request]
jobs:
build:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
python-version: ["3.5", "3.6", "3.7", "3.8", "pypy3"]
architecture: ["x86", "x64"]
include:
- architecture: "x86"
platform-vcvars: "x86"
platform-msbuild: "Win32"
- architecture: "x64"
platform-vcvars: "x86_amd64"
platform-msbuild: "x64"
exclude:
# PyPy does not support 64-bit on Windows
- python-version: "pypy3"
architecture: "x64"
timeout-minutes: 30
name: Python ${{ matrix.python-version }} ${{ matrix.architecture }}
steps:
- name: Checkout Pillow
uses: actions/checkout@v2
- name: Checkout cached dependencies
uses: actions/checkout@v2
with:
repository: python-pillow/pillow-depends
path: winbuild\depends
- name: Cache pip
uses: actions/cache@v1
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@v1
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Set up TCL
if: "contains(matrix.python-version, 'pypy')"
run: Write-Host "::set-env name=TCL_LIBRARY::$env:pythonLocation\tcl\tcl8.5"
shell: pwsh
- name: Print build system information
run: python .github/workflows/system-info.py
- name: pip install wheel pytest pytest-cov
run: python -m pip install wheel pytest pytest-cov
- name: Prepare dependencies
run: |
7z x winbuild\depends\nasm-2.14.02-win64.zip "-o$env:RUNNER_WORKSPACE\"
Write-Host "::add-path::$env:RUNNER_WORKSPACE\nasm-2.14.02"
winbuild\depends\gs950w32.exe /S
Write-Host "::add-path::C:\Program Files (x86)\gs\gs9.50\bin"
xcopy /s winbuild\depends\test_images\* Tests\images\
& python.exe winbuild\build_prepare.py -v --python=$env:pythonLocation
shell: pwsh
- name: Build dependencies / libjpeg-turbo
run: "& winbuild\\build\\build_dep_libjpeg.cmd"
- name: Build dependencies / zlib
run: "& winbuild\\build\\build_dep_zlib.cmd"
- name: Build dependencies / LibTiff
run: "& winbuild\\build\\build_dep_libtiff.cmd"
- name: Build dependencies / WebP
run: "& winbuild\\build\\build_dep_libwebp.cmd"
- name: Build dependencies / FreeType
run: "& winbuild\\build\\build_dep_freetype.cmd"
- name: Build dependencies / LCMS2
run: "& winbuild\\build\\build_dep_lcms2.cmd"
- name: Build dependencies / OpenJPEG
run: "& winbuild\\build\\build_dep_openjpeg.cmd"
# GPL licensed; skip if building wheels
- name: Build dependencies / libimagequant
if: "github.event_name != 'push'"
run: "& winbuild\\build\\build_dep_libimagequant.cmd"
# Raqm dependencies
- name: Build dependencies / HarfBuzz
run: "& winbuild\\build\\build_dep_harfbuzz.cmd"
- name: Build dependencies / FriBidi
run: "& winbuild\\build\\build_dep_fribidi.cmd"
- name: Build dependencies / Raqm
run: "& winbuild\\build\\build_dep_libraqm.cmd"
- name: Build Pillow
run: |
& winbuild\build\build_pillow.cmd install
& $env:pythonLocation\python.exe selftest.py --installed
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
run: |
path %GITHUB_WORKSPACE%\\winbuild\\build\\bin;%PATH%
python.exe -m pytest -vx -W always --cov PIL --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@v1
if: failure()
with:
name: errors
path: Tests/errors
- name: After success
run: |
.ci/after_success.sh
shell: pwsh
- name: Upload coverage
uses: codecov/codecov-action@v1
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: |
for /f "tokens=3 delims=/" %%a in ("${{ github.ref }}") do echo ::set-output name=dist::dist-%%a
winbuild\\build\\build_pillow.cmd bdist_wheel"
shell: cmd
- uses: actions/upload-artifact@v2
if: "github.event_name == 'push'"
with:
name: ${{ steps.wheel.outputs.dist }}
path: dist\*.whl
msys:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
mingw: ["MINGW32", "MINGW64"]
include:
- mingw: "MINGW32"
package: "mingw-w64-i686"
- mingw: "MINGW64"
package: "mingw-w64-x86_64"
defaults:
run:
shell: bash.exe --login -eo pipefail "{0}"
env:
MSYSTEM: ${{ matrix.mingw }}
CHERE_INVOKING: 1
timeout-minutes: 30
name: MSYS2 ${{ matrix.mingw }}
steps:
- uses: actions/checkout@v2
- name: Set up shell
run: echo ::add-path::C:\msys64\usr\bin\
shell: pwsh
- name: Install Dependencies
run: |
pacman -S --noconfirm \
${{ matrix.package }}-python3-pip \
${{ matrix.package }}-python3-setuptools \
${{ matrix.package }}-python3-pytest \
${{ matrix.package }}-python3-pytest-cov \
${{ matrix.package }}-python3-cffi \
${{ matrix.package }}-python3-olefile \
${{ matrix.package }}-python3-numpy \
${{ matrix.package }}-python3-pyqt5 \
${{ matrix.package }}-python3-numpy \
${{ matrix.package }}-freetype \
${{ matrix.package }}-lcms2 \
${{ matrix.package }}-libwebp \
${{ matrix.package }}-libjpeg-turbo \
${{ matrix.package }}-openjpeg2 \
${{ matrix.package }}-libimagequant \
${{ matrix.package }}-libraqm \
${{ matrix.package }}-ghostscript \
subversion
python3 -m pip install pyroma
pushd depends && ./install_extra_test_images.sh && popd
- name: Build Pillow
run: |
# libtiff is unable to open files
CFLAGS="-coverage" python3 setup.py build_ext --disable-tiff install
- name: Test Pillow
run: |
python3 selftest.py --installed
python3 -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests
- name: Upload coverage
run: |
python3 -m pip install codecov
bash <(curl -s https://codecov.io/bash) -F GHA_Windows
env:
CODECOV_NAME: MSYS2 ${{ matrix.mingw }}