-
Notifications
You must be signed in to change notification settings - Fork 78
257 lines (226 loc) · 9.03 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
name: Build and test, upload to PyPI on release
on:
push:
branches:
- master
- '*'
tags:
- '*'
pull_request:
branches:
- master
env:
CIBW_TEST_REQUIRES: ddt
CIBW_TEST_COMMAND: "cd {project} && python -m unittest -v"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
CIBW_MANYLINUX_I686_IMAGE: "manylinux2014"
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: "manylinux2014"
CIBW_MANYLINUX_PYPY_I686_IMAGE: "manylinux2014"
CIBW_SKIP: "cp36-*"
MACOSX_DEPLOYMENT_TARGET: "10.9"
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.8'
- name: Build wheels (manylinux)
uses: pypa/cibuildwheel@v2.19.2
env:
CIBW_BEFORE_BUILD: "yum install -y flex bison &&
pip install cmake wheel &&
{package}/scripts/build_igraph.sh &&
{package}/scripts/build_libleidenalg.sh "
CIBW_ARCHS_LINUX: ${{ matrix.wheel_arch }}
CIBW_BUILD: "*-manylinux_${{ matrix.wheel_arch }}"
CIBW_ENVIRONMENT: >
CFLAGS='-I/project/build-deps/install/include/ -L/project/build-deps/install/lib64/ -L/project/build-deps/install/lib/'
LD_LIBRARY_PATH='/project/build-deps/install/lib64/:/project/build-deps/install/lib/'
- name: Build wheels (musllinux)
uses: pypa/cibuildwheel@v2.19.2
env:
CIBW_BEFORE_BUILD: "apk add flex bison zlib-dev &&
pip install cmake wheel &&
{package}/scripts/build_igraph.sh &&
{package}/scripts/build_libleidenalg.sh"
CIBW_BUILD: "*-musllinux_${{ matrix.wheel_arch }}"
CIBW_TEST_EXTRAS: "test-musl"
CIBW_ENVIRONMENT: >
CFLAGS='-I/project/build-deps/install/include/ -L/project/build-deps/install/lib64/ -L/project/build-deps/install/lib/'
LD_LIBRARY_PATH='/project/build-deps/install/lib64/:/project/build-deps/install/lib/'
- uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.wheel_arch }}
path: ./wheelhouse/*.whl
build_wheel_linux_aarch64:
name: Build wheels on Linux (aarch64)
runs-on: ubuntu-20.04
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/cibuildwheel@v2.19.2
env:
CIBW_BEFORE_BUILD: "yum install -y flex bison zlib-devel &&
pip install cmake wheel &&
{package}/scripts/build_igraph.sh &&
{package}/scripts/build_libleidenalg.sh"
CIBW_ARCHS_LINUX: aarch64
CIBW_BUILD: "*-manylinux_aarch64"
CIBW_ENVIRONMENT: >
CFLAGS='-I/project/build-deps/install/include/ -L/project/build-deps/install/lib64/ -L/project/build-deps/install/lib/'
LD_LIBRARY_PATH='/project/build-deps/install/lib64/:/project/build-deps/install/lib/'
- uses: actions/upload-artifact@v4
with:
name: wheels-linux-aarch64
path: ./wheelhouse/*.whl
build_wheel_macos:
name: Build wheels on macOS (${{ matrix.wheel_arch }})
runs-on: macos-latest
env:
LLVM_VERSION: "14.0.5"
strategy:
matrix:
include:
- cmake_arch: x86_64
wheel_arch: x86_64
- cmake_arch: arm64
extra_cmake_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: build-deps
key: C-core-cache-${{ runner.os }}-${{ matrix.cmake_arch }}-llvm${{ env.LLVM_VERSION }}-${{ hashFiles('scripts/build_igraph.sh') }}-${{ hashFiles('scripts/build_libleidenalg.sh') }}
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.8'
- 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
run:
brew install ninja cmake
- name: Build wheels
uses: pypa/cibuildwheel@v2.19.2
env:
CIBW_ARCHS_MACOS: "${{ matrix.wheel_arch }}"
CIBW_BEFORE_BUILD: "{package}/scripts/build_igraph.sh &&
{package}/scripts/build_libleidenalg.sh"
CIBW_ENVIRONMENT: >
CFLAGS='-Wno-unused-command-line-argument -I/Users/runner/work/leidenalg/leidenalg/build-deps/install/include/ -L/Users/runner/work/leidenalg/leidenalg/build-deps/install/lib64/ -L/Users/runner/work/leidenalg/leidenalg/build-deps/install/lib/'
REPAIR_LIBRARY_PATH="${DYLD_LIBRARY_PATH}:/Users/runner/work/leidenalg/leidenalg/build-deps/install/lib64/:/Users/runner/work/leidenalg/leidenalg/build-deps/install/lib/"
EXTRA_CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=${{ matrix.cmake_arch }} ${{ matrix.extra_cmake_args }}"
CIBW_REPAIR_WHEEL_COMMAND: >
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
- uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.wheel_arch }}
path: ./wheelhouse/*.whl
build_wheel_win:
name: Build wheels on Windows (${{ matrix.cmake_arch }})
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
include:
- cmake_arch: Win32
wheel_arch: win32
- cmake_arch: x64
wheel_arch: win_amd64
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.8'
- name: Cache installed C core
id: cache-c-core
uses: actions/cache@v4
with:
path: build-deps
key: C-core-cache-${{ runner.os }}-${{ matrix.cmake_arch }}-llvm${{ env.LLVM_VERSION }}-${{ hashFiles('scripts/build_igraph.sh') }}-${{ hashFiles('scripts/build_libleidenalg.sh') }}
- name: Install build dependencies
if: steps.cache-c-core.outputs.cache-hit != 'true' # Only needed when building the C core
run: choco install winflexbison3 cmake ninja
- name: Build wheels
uses: pypa/cibuildwheel@v2.19.2
env:
CIBW_BEFORE_BUILD: "{package}/scripts/build_igraph.bat &&
{package}/scripts/build_libleidenalg.bat &&
pip install delvewheel"
CIBW_BUILD: "*-${{ matrix.wheel_arch }}"
CIBW_TEST_COMMAND: "cd /d {project} && python -m unittest -v"
CIBW_SKIP: "cp36-* pp*"
CIBW_ENVIRONMENT: >
LIB="D:/a/leidenalg/leidenalg/build-deps/install/lib;$LIB"
INCLUDE="D:/a/leidenalg/leidenalg/build-deps/install/include/;$INCLUDE"
PATH="D:/a/leidenalg/leidenalg/build-deps/install/bin;$PATH"
EXTRA_CMAKE_ARGS="-A ${{ matrix.cmake_arch }}"
CIBW_REPAIR_WHEEL_COMMAND: "delvewheel repair -w {dest_dir} {wheel}"
- uses: actions/upload-artifact@v4
with:
name: wheels-win-${{ matrix.wheel_arch }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.8'
- name: Install pypa/build
run: pip3 install build
- name: Build sdist
run: |
python3 -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheel_linux, build_wheel_linux_aarch64, build_wheel_macos, build_wheel_win, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every push from the master branch
if: github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
merge-multiple: true
path: dist
# Upload tagged versions to production PyPI
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}