-
Notifications
You must be signed in to change notification settings - Fork 1.9k
370 lines (366 loc) · 14.4 KB
/
python_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
name: Python
# This file builds and tests Python binary wheels across major platforms. The
# wheels that are produced are used for PyPi releases. The test step uses a
# fresh job and installs the wheel the ensure it works in isolation. The is also
# a job which produces the source distribution and ensures that can be built to.
on:
push:
branches:
- master
- 'releases/**'
- rlos2023/test
pull_request:
branches:
- '*'
- rlos2023/test
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
linux-python-build:
name: manylinux.amd64.py${{ matrix.config.version}}.build
container:
image: vowpalwabbit/manylinux2010-build:latest
runs-on: ubuntu-latest
strategy:
matrix:
config:
- { version: "3.6", base_path: /opt/python/cp36-cp36m/, include_dir_name: python3.6m/ }
- { version: "3.7", base_path: /opt/python/cp37-cp37m/, include_dir_name: python3.7m/ }
- { version: "3.8", base_path: /opt/python/cp38-cp38/, include_dir_name: python3.8/ }
- { version: "3.9", base_path: /opt/python/cp39-cp39/, include_dir_name: python3.9/ }
- { version: "3.10", base_path: /opt/python/cp310-cp310/, include_dir_name: python3.10/ }
fail-fast: false
steps:
# v1 must be used because newer versions require a node.js version that will not run on this old image.
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Build wheel
shell: bash
run: |
${{ matrix.config.base_path }}bin/pip wheel . -w wheel_output/ --global-option --cmake-options="-DSTATIC_LINK_VW_JAVA=On;-DPython_INCLUDE_DIR='${{ matrix.config.base_path }}include/${{ matrix.config.include_dir_name }}'" --verbose
auditwheel repair wheel_output/*whl -w audit_output/
- name: Upload built wheel
uses: actions/upload-artifact@v1
with:
name: manylinux_amd64_${{ matrix.config.version }}
path: audit_output/
linux-python-test:
name: manylinux.amd64.py${{ matrix.version }}.test
needs: linux-python-build
container:
image: python:${{ matrix.version }}
runs-on: ubuntu-latest
strategy:
matrix:
version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
fail-fast: false
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- uses: actions/download-artifact@v1
with:
name: manylinux_amd64_${{ matrix.version }}
path: built_wheel
- name: Test wheel
shell: bash
run: |
pip install -r requirements.txt
pip install pytest vw-executor twine
pip install --force-reinstall built_wheel/*.whl
twine check built_wheel/*.whl
python -m pytest ./python/tests/
python ./python/tests/run_doctest.py
- name: Run vw tests as Python module
shell: bash
# Onethread is not supported in the Python wrapper so those tests must be skipped
# Stdin is not supported
# Help output tests assume --onthread is in the output
# Fail tests are not included because the python stack trace causes the output to differ
# Daemon tests are skipped
# Tests without datafiles are skipped
run: |
cd test
python run_tests.py -E 0.001 -f --skip_spanning_tree_tests --vw_bin_path "python3 -m vowpalwabbit" --skip_test 60 61 92 96 149 152 177 193 194 195 220 275 276 324 325 326 349 350 356 357 358 385 389 390 391 392 393 400 399 401 403 431 440
linux-python-sdist-bundle:
name: ubuntu-latest.amd64.py3.8.sdist-bundle
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- name: Install dependencies
shell: bash
run: python setup.py sdist
- name: Upload built wheel
uses: actions/upload-artifact@v2
with:
name: python_source_distribution
path: dist/*.tar.gz
if-no-files-found: error
linux-python-sdist-build-test:
name: ubuntu-latest.amd64.py3.8.sdist-build-test
needs: linux-python-sdist-bundle
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v2
with:
python-version: '3.10'
architecture: 'x64'
- uses: actions/download-artifact@v1
with:
name: python_source_distribution
- name: Install dependencies
shell: bash
run: |
sudo apt update
sudo apt install libboost-test-dev libboost-python-dev zlib1g-dev cmake g++
- name: Install source dist
shell: bash
run: pip install python_source_distribution/*.tar.gz
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
shell: bash
run: |
pip install -r requirements.txt
pip install pytest vw-executor
- name: Run unit tests
shell: bash
run: |
python -m pytest ./python/tests/
linux-python-build-aarch64:
name: manylinux.aarch64.py${{ matrix.config.version }}.build
# Aarch builds are slow and are only run on push and not PR
if: ${{ github.event_name == 'push' }}
strategy:
matrix:
config:
- { version: "3.7", base_path: /opt/python/cp37-cp37m/, include_dir_name: python3.7m/ }
- { version: "3.8", base_path: /opt/python/cp38-cp38/, include_dir_name: python3.8/ }
- { version: "3.9", base_path: /opt/python/cp39-cp39/, include_dir_name: python3.9/ }
- { version: "3.10", base_path: /opt/python/cp310-cp310/, include_dir_name: python3.10/ }
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
- name: Pull image
run: docker pull vowpalwabbit/manylinux2014_aarch64-build
- name: Build Wheel
run: |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
vowpalwabbit/manylinux2014_aarch64-build \
bash -exc '${{ matrix.config.base_path }}bin/pip wheel . -w wheel_output/ --global-option --cmake-options="-DSTATIC_LINK_VW_JAVA=On;-DPython_INCLUDE_DIR='${{ matrix.config.base_path }}include/${{ matrix.config.include_dir_name }}'" --verbose && \
auditwheel repair wheel_output/*whl -w audit_output/'
- name: Upload built wheel
uses: actions/upload-artifact@v1
with:
name: manylinux_aarch64_${{ matrix.config.version }}
path: audit_output/
linux-python-test-aarch64:
name: manylinux.aarch64.py${{ matrix.config.version }}.test
needs: linux-python-build-aarch64
# Aarch builds are slow and are only run on push and not PR
if: ${{ github.event_name == 'push' }}
strategy:
matrix:
config:
- { version: "3.7" }
- { version: "3.8" }
- { version: "3.9" }
- { version: "3.10" }
fail-fast: false
env:
py: python${{ matrix.config.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
- uses: actions/download-artifact@v1
with:
name: manylinux_aarch64_${{ matrix.config.version }}
path: built_wheel
- name: Test Wheel
run: |
docker run --rm -v ${{ github.workspace }}:/io:rw --workdir=/io \
arm64v8/ubuntu \
bash -exc 'apt-get update && \
apt install software-properties-common -y && \
add-apt-repository ppa:deadsnakes/ppa -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata && \
apt install -y ${{ env.py }} && \
apt install -y ${{ env.py }}-venv && \
${{ env.py }} -m venv .env && \
source .env/bin/activate && \
pip install --upgrade pip && \
pip install -r requirements.txt && \
pip install pytest vw-executor twine && \
pip install --force-reinstall built_wheel/*.whl && \
twine check built_wheel/*.whl && \
python --version && \
python -m pytest ./python/tests/ && \
deactivate'
macos-python-build:
name: macos.amd64.py${{ matrix.config.version }}.build
runs-on: macos-11
strategy:
matrix:
config:
- { version: 3.6, include_dir_name: python3.6m/}
- { version: 3.7, include_dir_name: python3.7m/}
- { version: 3.8, include_dir_name: python3.8/}
- { version: 3.9, include_dir_name: python3.9/}
- { version: "3.10", include_dir_name: python3.10/}
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: ${{ matrix.config.version }}
- name: Build wheel
shell: bash -l {0}
run: |
conda info
conda install python=${{ matrix.config.version }} wheel zlib boost py-boost flatbuffers
pip wheel . -w wheel_output/ --global-option --cmake-options="-DSTATIC_LINK_VW_JAVA=On;-DPython_INCLUDE_DIR=\"$CONDA_PREFIX/include/${{ matrix.config.include_dir_name }}\"" --verbose
- name: Upload built wheel
uses: actions/upload-artifact@v1
with:
name: macos_amd64_${{ matrix.config.version }}
path: wheel_output/
macos-python-test:
name: macos.amd64.py${{ matrix.version }}.test
needs: macos-python-build
runs-on: macos-11
strategy:
matrix:
version: [3.6, 3.7, 3.8, 3.9, "3.10"]
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.version }}
- uses: actions/download-artifact@v1
with:
name: macos_amd64_${{ matrix.version }}
path: built_wheel
- name: Test wheel
shell: bash
run: |
pip install -r requirements.txt
pip install pytest vw-executor twine
pip install --force-reinstall built_wheel/*.whl
twine check built_wheel/*.whl
python -m pytest ./python/tests/
python ./python/tests/run_doctest.py
windows-python-build:
name: windows-2019.amd64.py${{ matrix.config.version }}.build
runs-on: windows-2019
env:
VCPKG_ROOT: ${{ github.workspace }}\\vcpkg
VCPKG_REF: 501db0f17ef6df184fcdbfbe0f87cde2313b6ab1
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}\vcpkg_binary_cache
strategy:
matrix:
config:
- { version: "3.6", vcpkg_manifest: "python\\vcpkg_default.json", overlay_ports: "python\\vcpkg_python_override_ports\\python36\\"}
- { version: "3.7", vcpkg_manifest: "python\\vcpkg_default.json", overlay_ports: "python\\vcpkg_python_override_ports\\python37\\"}
- { version: "3.8", vcpkg_manifest: "python\\vcpkg_default.json", overlay_ports: "python\\vcpkg_python_override_ports\\python38\\" }
- { version: "3.9", vcpkg_manifest: "python\\vcpkg_default.json", overlay_ports: "python\\vcpkg_python_override_ports\\python39\\" }
- { version: "3.10", vcpkg_manifest: "python\\vcpkg_python310.json", overlay_ports: "" }
fail-fast: false
steps:
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.config.version }}
- uses: actions/checkout@v3
with:
submodules: recursive
path: ${{github.workspace}}\vowpal_wabbit
- uses: actions/checkout@v3
with:
path: ${{ env.VCPKG_ROOT }}
repository: 'microsoft/vcpkg'
ref: ${{ env.VCPKG_REF }}
# We need a deep clone so that we can go back in history for version selection.
fetch-depth: '0'
- name: Restore vcpkg and build artifacts
uses: actions/cache@v3
with:
path: |
${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: |
${{ env.VCPKG_REF }}-${{ matrix.config.version }}-python-win-cache-invalidate-5
- run: ${{ env.VCPKG_ROOT }}/bootstrap-vcpkg.bat
- name: Build wheel
shell: powershell
run: |
if (![System.IO.Directory]::Exists("${{ env.VCPKG_DEFAULT_BINARY_CACHE }}"))
{
New-Item -ItemType Directory -Force -Path "${{ env.VCPKG_DEFAULT_BINARY_CACHE }}"
}
ls ${{ github.workspace }}
ls ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
cd ${{github.workspace}}\\vowpal_wabbit
cp ${{ matrix.config.vcpkg_manifest }} vcpkg.json
pip install wheel
pip wheel . -w ${{github.workspace}}\\wheel_output --global-option --vcpkg-root="${{ env.VCPKG_ROOT }}" --global-option --cmake-generator="Visual Studio 16 2019" --global-option --cmake-options="-DVCPKG_OVERLAY_PORTS=${{github.workspace}}\\vowpal_wabbit\\${{ matrix.config.overlay_ports }}" --verbose
- name: Upload built wheel
uses: actions/upload-artifact@v1
with:
name: windows_amd64_${{ matrix.config.version }}
path: wheel_output
windows-python-test:
name: ${{ matrix.os }}.amd64.py${{ matrix.version }}.test
needs: windows-python-build
runs-on: ${{ matrix.os }}
strategy:
matrix:
version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
os: ["windows-2019"]
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.version }}
- uses: actions/download-artifact@v1
with:
name: windows_amd64_${{ matrix.version }}
path: built_wheel
- name: Install deps and test wheel
shell: bash
run: |
export wheel_files=(built_wheel/*)
export wheel_file="${wheel_files[0]}"
echo Installing ${wheel_file}...
pip install -r requirements.txt
pip install pytest vw-executor twine
pip install --force-reinstall ${wheel_file}
twine check ${wheel_file}
python -m pytest .\\python\\tests\\
python .\\python\\tests\\run_doctest.py