-
Notifications
You must be signed in to change notification settings - Fork 248
385 lines (328 loc) · 13 KB
/
build.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
# Name cannot contain commas because of setup-emsdk job
name: Build and test
on: [push, pull_request]
env:
CIBW_ENVIRONMENT_PASS_LINUX: PYTEST_TIMEOUT
CIBW_TEST_COMMAND: "cd {project} && pip install --prefer-binary '.[test]' && python -m pytest -v tests"
CIBW_SKIP: "cp36-* cp37-* cp38-* pp37-* pp38-*"
PYTEST_TIMEOUT: 60
jobs:
build_wheel_linux:
name: Build wheels on Linux (${{ matrix.wheel_arch }})
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
wheel_arch: [x86_64, i686]
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.9'
- name: Build wheels (manylinux)
uses: pypa/[email protected]
env:
CIBW_BEFORE_BUILD: "yum install -y flex bison libxml2-devel zlib-devel cairo-devel && pip install -U cmake pip setuptools wheel && python setup.py build_c_core"
CIBW_BUILD: "*-manylinux_${{ matrix.wheel_arch }}"
# Skip tests for Python 3.10 onwards because SciPy does not have
# 32-bit wheels for Linux.
CIBW_TEST_SKIP: "cp310-manylinux_i686 cp311-manylinux_i686 cp312-manylinux_i686 cp313-manylinux_i686"
- name: Build wheels (musllinux)
uses: pypa/[email protected]
env:
CIBW_BEFORE_BUILD: "apk add flex bison libxml2-dev zlib-dev cairo-dev && pip install -U cmake pip setuptools wheel && python setup.py build_c_core"
CIBW_BUILD: "*-musllinux_${{ matrix.wheel_arch }}"
CIBW_TEST_COMMAND: "cd {project} && pip install --prefer-binary '.[test-musl]' && python -m pytest -v tests"
- uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.wheel_arch }}
path: ./wheelhouse/*.whl
build_wheel_linux_aarch64_manylinux:
name: Build wheels on Linux (aarch64/manylinux)
runs-on: ubuntu-20.04
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
- name: Build wheels (manylinux)
uses: pypa/[email protected]
env:
CIBW_BEFORE_BUILD: "yum install -y flex bison libxml2-devel zlib-devel cairo-devel && pip install -U cmake pip setuptools wheel && python setup.py build_c_core"
CIBW_ARCHS_LINUX: aarch64
CIBW_BUILD: "*-manylinux_aarch64"
- uses: actions/upload-artifact@v4
with:
name: wheels-linux-aarch64-manylinux
path: ./wheelhouse/*.whl
build_wheel_linux_aarch64_musllinux:
name: Build wheels on Linux (aarch64/musllinux)
runs-on: ubuntu-20.04
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v3
- name: Build wheels (musllinux)
uses: pypa/[email protected]
env:
CIBW_BEFORE_BUILD: "apk add flex bison libxml2-dev zlib-dev cairo-dev && pip install -U cmake pip setuptools wheel && python setup.py build_c_core"
CIBW_ARCHS_LINUX: aarch64
CIBW_BUILD: "*-musllinux_aarch64"
CIBW_TEST_COMMAND: "cd {project} && pip install --prefer-binary '.[test-musl]' && python -m pytest -v tests"
- uses: actions/upload-artifact@v4
with:
name: wheels-linux-aarch64-musllinux
path: ./wheelhouse/*.whl
build_wheel_macos:
name: Build wheels on macOS (${{ matrix.wheel_arch }})
runs-on: macos-latest
env:
LLVM_VERSION: "14.0.5"
MACOSX_DEPLOYMENT_TARGET: "10.9"
strategy:
matrix:
include:
- cmake_arch: x86_64
wheel_arch: x86_64
- cmake_arch: arm64
cmake_extra_args: -DF2C_EXTERNAL_ARITH_HEADER=../../../etc/arith_apple_m1.h -DIEEE754_DOUBLE_ENDIANNESS_MATCHES=ON
wheel_arch: arm64
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Cache installed C core
id: cache-c-core
uses: actions/cache@v4
with:
path: vendor/install
key: C-core-cache-${{ runner.os }}-${{ matrix.cmake_arch }}-llvm${{ env.LLVM_VERSION }}-${{ hashFiles('.git/modules/**/HEAD') }}
- name: Cache C core dependencies
id: cache-c-deps
uses: actions/cache@v4
with:
path: ~/local
key: deps-cache-v2-${{ runner.os }}-${{ matrix.cmake_arch }}-llvm${{ env.LLVM_VERSION }}
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.9'
- name: Install OS dependencies
if: steps.cache-c-core.outputs.cache-hit != 'true' || steps.cache-c-deps.outputs.cache-hit != 'true' # Only needed when building the C core or libomp
run:
brew install ninja autoconf automake libtool
- name: Install OpenMP library
if: steps.cache-c-deps.outputs.cache-hit != 'true'
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VERSION/openmp-$LLVM_VERSION.src.tar.xz
tar xf openmp-$LLVM_VERSION.src.tar.xz
cd openmp-$LLVM_VERSION.src
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/local -DLIBOMP_ENABLE_SHARED=OFF -DCMAKE_OSX_ARCHITECTURES=${{ matrix.cmake_arch }}
cmake --build .
cmake --install .
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS_MACOS: "${{ matrix.wheel_arch }}"
CIBW_BEFORE_BUILD: "pip install -U setuptools && python setup.py build_c_core"
CIBW_ENVIRONMENT: "LDFLAGS=-L$HOME/local/lib"
IGRAPH_CMAKE_EXTRA_ARGS: -DCMAKE_OSX_ARCHITECTURES=${{ matrix.cmake_arch }} ${{ matrix.cmake_extra_args }} -DCMAKE_PREFIX_PATH=$HOME/local
- uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.wheel_arch }}
path: ./wheelhouse/*.whl
build_wheel_wasm:
name: Build wheels for WebAssembly
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12.1'
- name: Install OS dependencies
run:
sudo apt install ninja-build cmake flex bison
- uses: mymindstorm/setup-emsdk@v14
with:
version: '3.1.58'
actions-cache-folder: 'emsdk-cache'
- name: Build wheel
run: |
pip install pyodide-build==0.26.2
python3 scripts/fix_pyodide_build.py
pyodide build
- name: Setup upterm session
uses: lhotari/action-upterm@v1
if: ${{ failure() }}
with:
limit-access-to-actor: true
wait-timeout-minutes: 5
- uses: actions/upload-artifact@v4
with:
name: wheels-wasm
path: ./dist/*.whl
build_wheel_win:
name: Build wheels on Windows (${{ matrix.cmake_arch }})
runs-on: windows-2019
strategy:
matrix:
include:
- cmake_arch: Win32
wheel_arch: win32
vcpkg_arch: x86
- cmake_arch: x64
wheel_arch: win_amd64
vcpkg_arch: x64
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.9'
- name: Cache installed C core
id: cache-c-core
uses: actions/cache@v4
with:
path: vendor/install
key: C-core-cache-${{ runner.os }}-${{ matrix.cmake_arch }}-${{ hashFiles('.git/modules/**/HEAD') }}
- name: Cache VCPKG
uses: actions/cache@v4
with:
path: C:/vcpkg/installed/
key: vcpkg-${{ runner.os }}-${{ matrix.vcpkg_arch }}
- name: Install build dependencies
if: steps.cache-c-core.outputs.cache-hit != 'true' # Only needed when building the C core
run: choco install winflexbison3 ninja
- name: Install VCPKG libraries
run: |
%VCPKG_INSTALLATION_ROOT%\vcpkg.exe integrate install
%VCPKG_INSTALLATION_ROOT%\vcpkg.exe install libxml2:${{ matrix.vcpkg_arch }}-windows-static-md
shell: cmd
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BEFORE_BUILD: "pip install -U setuptools && python setup.py build_c_core"
CIBW_BUILD: "*-${{ matrix.wheel_arch }}"
CIBW_TEST_COMMAND: "cd /d {project} && pip install --prefer-binary \".[test]\" && python -m pytest tests"
# Skip tests for Python 3.10 onwards because SciPy does not have
# 32-bit wheels for Linux.
CIBW_TEST_SKIP: "cp310-win32 cp311-win32 cp312-win32 cp313-win32"
IGRAPH_CMAKE_EXTRA_ARGS: -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_arch }}-windows-static-md -DCMAKE_TOOLCHAIN_FILE=c:/vcpkg/scripts/buildsystems/vcpkg.cmake -A ${{ matrix.cmake_arch }}
IGRAPH_EXTRA_LIBRARY_PATH: C:/vcpkg/installed/${{ matrix.vcpkg_arch }}-windows-static-md/lib/
IGRAPH_STATIC_EXTENSION: True
IGRAPH_EXTRA_LIBRARIES: libxml2,lzma,zlib,iconv,charset
IGRAPH_EXTRA_DYNAMIC_LIBRARIES: wsock32,ws2_32
- uses: actions/upload-artifact@v4
with:
name: wheels-win-${{ matrix.wheel_arch }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build sdist and test extra dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Cache installed C core
id: cache-c-core
uses: actions/cache@v4
with:
path: |
vendor/install
key: C-core-cache-${{ runner.os }}-${{ hashFiles('.git/modules/**/HEAD') }}
- name: Install OS dependencies
if: steps.cache-c-core.outputs.cache-hit != 'true' # Only needed when building the C core
run:
sudo apt install ninja-build cmake flex bison
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.9'
- name: Build sdist
run: |
python setup.py build_c_core
python setup.py sdist
python setup.py install
- name: Test
run: |
pip install --prefer-binary cairocffi numpy scipy pandas networkx pytest pytest-timeout
python -m pytest -v tests
- uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
# When updating 'runs-on', the ASan/UBSan library paths/versions must also be updated for LD_PRELOAD
# for the "Test" step below.
build_with_sanitizer:
name: Build with sanitizers for debugging purposes
runs-on: ubuntu-20.04
env:
IGRAPH_CMAKE_EXTRA_ARGS: -DFORCE_COLORED_OUTPUT=ON
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Cache installed C core
id: cache-c-core
uses: actions/cache@v4
with:
path: |
vendor/build
vendor/install
key: C-core-build-sanitizer-v1-${{ runner.os }}-${{ hashFiles('.git/modules/vendor/source/igraph/HEAD') }}
- name: Install OS dependencies
if: steps.cache-c-core.outputs.cache-hit != 'true' # Only needed when building the C core
run:
sudo apt install ninja-build cmake flex bison
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
- name: Install test dependencies
run: |
pip install --prefer-binary pytest pytest-timeout setuptools
- name: Build C core
env:
IGRAPH_USE_SANITIZERS: 1
run: |
python setup.py build_c_core
- name: Build and install Python extension
env:
IGRAPH_USE_SANITIZERS: 1
run: |
# NOTE: install calls "build" first
python setup.py install
# Only pytest, and nothing else should be run in this section due to the presence of LD_PRELOAD.
# The ASan/UBSan library versions need to be updated when switching to a newer Ubuntu/GCC.
# LD_PRELOAD needs to be specified in the "run" section to ensure that we
# do not pick up memory leaks in the wrapper shell (e.g., /bin/bash)
- name: Test
env:
ASAN_OPTIONS: "detect_stack_use_after_return=1"
LSAN_OPTIONS: "suppressions=etc/lsan-suppr.txt:print_suppressions=false"
run: |
LD_PRELOAD=/lib/x86_64-linux-gnu/libasan.so.5:/lib/x86_64-linux-gnu/libubsan.so.1 python -m pytest --capture=sys tests