|
1 | | -# Name cannot contain commas because of setup-emsdk job |
2 | | -name: Build and test |
| 1 | +name: Build Linux wheel |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - "wheel-*" |
3 | 8 |
|
4 | | -on: [push, pull_request] |
5 | 9 | env: |
6 | | - CIBW_ENABLE: pypy |
7 | | - CIBW_ENVIRONMENT_PASS_LINUX: PYTEST_TIMEOUT |
8 | 10 | CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9" |
9 | 11 | CIBW_TEST_COMMAND: "cd {project} && pip install --prefer-binary '.[test]' && python -m pytest -v tests" |
10 | | - # Free-threaded builds excluded for Python 3.14 because they do not support the limited API |
11 | 12 | CIBW_SKIP: "cp314t-*" |
12 | 13 | PYTEST_TIMEOUT: 60 |
13 | 14 |
|
14 | 15 | jobs: |
15 | 16 | build_wheel_linux: |
16 | 17 | name: Build wheels on Linux (x86_64) |
17 | 18 | runs-on: ubuntu-22.04 |
18 | | - steps: |
19 | | - - uses: actions/checkout@v5 |
20 | | - with: |
21 | | - submodules: true |
22 | | - fetch-depth: 0 |
23 | | - |
24 | | - - name: Build wheels (manylinux) |
25 | | - uses: pypa/cibuildwheel@v3.3.0 |
26 | | - env: |
27 | | - 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" |
28 | | - CIBW_BUILD: "*-manylinux_x86_64" |
29 | | - |
30 | | - - name: Build wheels (musllinux) |
31 | | - uses: pypa/cibuildwheel@v3.3.0 |
32 | | - env: |
33 | | - 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" |
34 | | - CIBW_BUILD: "*-musllinux_x86_64" |
35 | | - CIBW_TEST_COMMAND: "cd {project} && pip install --prefer-binary '.[test-musl]' && python -m pytest -v tests" |
36 | | - |
37 | | - - uses: actions/upload-artifact@v6 |
38 | | - with: |
39 | | - name: wheels-linux-x86_64 |
40 | | - path: ./wheelhouse/*.whl |
41 | 19 |
|
42 | | - build_wheel_linux_aarch64_manylinux: |
43 | | - name: Build wheels on Linux (aarch64/manylinux) |
44 | | - runs-on: ubuntu-22.04-arm |
45 | 20 | steps: |
46 | 21 | - uses: actions/checkout@v5 |
47 | 22 | with: |
48 | 23 | submodules: true |
49 | 24 | fetch-depth: 0 |
50 | 25 |
|
51 | | - - name: Build wheels (manylinux) |
| 26 | + - name: Build wheels (manylinux x86_64) |
52 | 27 | uses: pypa/cibuildwheel@v3.3.0 |
53 | 28 | env: |
| 29 | + CIBW_BUILD: "*-manylinux_x86_64" |
| 30 | + CIBW_ENVIRONMENT_PASS_LINUX: PYTEST_TIMEOUT |
54 | 31 | 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" |
55 | | - CIBW_ARCHS_LINUX: aarch64 |
56 | | - CIBW_BUILD: "*-manylinux_aarch64" |
57 | | - |
58 | | - - uses: actions/upload-artifact@v6 |
59 | | - with: |
60 | | - name: wheels-linux-aarch64-manylinux |
61 | | - path: ./wheelhouse/*.whl |
62 | | - |
63 | | - build_wheel_linux_aarch64_musllinux: |
64 | | - name: Build wheels on Linux (aarch64/musllinux) |
65 | | - runs-on: ubuntu-22.04-arm |
66 | | - steps: |
67 | | - - uses: actions/checkout@v5 |
68 | | - with: |
69 | | - submodules: true |
70 | | - fetch-depth: 0 |
71 | | - |
72 | | - - name: Build wheels (musllinux) |
73 | | - uses: pypa/cibuildwheel@v3.3.0 |
74 | | - env: |
75 | | - 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" |
76 | | - CIBW_ARCHS_LINUX: aarch64 |
77 | | - CIBW_BUILD: "*-musllinux_aarch64" |
78 | | - CIBW_TEST_COMMAND: "cd {project} && pip install --prefer-binary '.[test-musl]' && python -m pytest -v tests" |
79 | | - |
80 | | - - uses: actions/upload-artifact@v6 |
81 | | - with: |
82 | | - name: wheels-linux-aarch64-musllinux |
83 | | - path: ./wheelhouse/*.whl |
84 | | - |
85 | | - build_wheel_macos: |
86 | | - name: Build wheels on macOS (${{ matrix.wheel_arch }}) |
87 | | - runs-on: macos-latest |
88 | | - env: |
89 | | - LLVM_VERSION: "14.0.5" |
90 | | - MACOSX_DEPLOYMENT_TARGET: "10.15" |
91 | | - strategy: |
92 | | - matrix: |
93 | | - include: |
94 | | - - cmake_arch: x86_64 |
95 | | - wheel_arch: x86_64 |
96 | | - - cmake_arch: arm64 |
97 | | - cmake_extra_args: -DF2C_EXTERNAL_ARITH_HEADER=../../../etc/arith_apple_m1.h -DIEEE754_DOUBLE_ENDIANNESS_MATCHES=ON |
98 | | - wheel_arch: arm64 |
99 | | - |
100 | | - steps: |
101 | | - - uses: actions/checkout@v5 |
102 | | - with: |
103 | | - submodules: true |
104 | | - fetch-depth: 0 |
105 | | - |
106 | | - - name: Cache installed C core |
107 | | - id: cache-c-core |
108 | | - uses: actions/cache@v5 |
109 | | - with: |
110 | | - path: vendor/install |
111 | | - key: C-core-cache-${{ runner.os }}-${{ matrix.cmake_arch }}-llvm${{ env.LLVM_VERSION }}-${{ hashFiles('.git/modules/**/HEAD') }} |
112 | | - |
113 | | - - name: Cache C core dependencies |
114 | | - id: cache-c-deps |
115 | | - uses: actions/cache@v5 |
116 | | - with: |
117 | | - path: ~/local |
118 | | - key: deps-cache-v2-${{ runner.os }}-${{ matrix.cmake_arch }}-llvm${{ env.LLVM_VERSION }} |
119 | | - |
120 | | - - name: Install OS dependencies |
121 | | - 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 |
122 | | - run: brew install autoconf automake libtool |
123 | | - |
124 | | - - name: Install OpenMP library |
125 | | - if: steps.cache-c-deps.outputs.cache-hit != 'true' |
126 | | - run: | |
127 | | - wget https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VERSION/openmp-$LLVM_VERSION.src.tar.xz |
128 | | - tar xf openmp-$LLVM_VERSION.src.tar.xz |
129 | | - cd openmp-$LLVM_VERSION.src |
130 | | - mkdir build && cd build |
131 | | - cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/local -DLIBOMP_ENABLE_SHARED=OFF -DCMAKE_OSX_ARCHITECTURES=${{ matrix.cmake_arch }} |
132 | | - cmake --build . |
133 | | - cmake --install . |
134 | | -
|
135 | | - - name: Build wheels |
136 | | - uses: pypa/cibuildwheel@v3.3.0 |
137 | | - env: |
138 | | - CIBW_ARCHS_MACOS: "${{ matrix.wheel_arch }}" |
139 | | - CIBW_BEFORE_BUILD: "pip install -U setuptools && python setup.py build_c_core" |
140 | | - CIBW_ENVIRONMENT: "LDFLAGS=-L$HOME/local/lib" |
141 | | - IGRAPH_CMAKE_EXTRA_ARGS: -DCMAKE_OSX_ARCHITECTURES=${{ matrix.cmake_arch }} ${{ matrix.cmake_extra_args }} -DCMAKE_PREFIX_PATH=$HOME/local |
142 | | - |
143 | | - - uses: actions/upload-artifact@v6 |
144 | | - with: |
145 | | - name: wheels-macos-${{ matrix.wheel_arch }} |
146 | | - path: ./wheelhouse/*.whl |
147 | | - |
148 | | - build_wheel_wasm: |
149 | | - name: Build wheels for WebAssembly |
150 | | - runs-on: ubuntu-22.04 |
151 | | - |
152 | | - steps: |
153 | | - - uses: actions/checkout@v5 |
154 | | - with: |
155 | | - submodules: true |
156 | | - fetch-depth: 0 |
157 | | - |
158 | | - - uses: actions/setup-python@v6 |
159 | | - name: Install Python |
160 | | - with: |
161 | | - python-version: "3.12.1" |
162 | | - |
163 | | - - name: Install OS dependencies |
164 | | - run: sudo apt install ninja-build cmake flex bison |
165 | | - |
166 | | - - uses: mymindstorm/setup-emsdk@v14 |
167 | | - with: |
168 | | - version: "3.1.58" |
169 | | - actions-cache-folder: "emsdk-cache" |
170 | | - |
171 | | - - name: Build wheel |
172 | | - run: | |
173 | | - pip install pyodide-build==0.26.2 |
174 | | - python3 scripts/fix_pyodide_build.py |
175 | | - pyodide build |
176 | | -
|
177 | | - - name: Setup upterm session |
178 | | - uses: lhotari/action-upterm@v1 |
179 | | - if: ${{ failure() }} |
180 | | - with: |
181 | | - limit-access-to-actor: true |
182 | | - wait-timeout-minutes: 5 |
183 | | - |
184 | | - - uses: actions/upload-artifact@v6 |
185 | | - with: |
186 | | - name: wheels-wasm |
187 | | - path: ./dist/*.whl |
188 | | - |
189 | | - build_wheel_win: |
190 | | - name: Build wheels on Windows (${{ matrix.cmake_arch }}) |
191 | | - strategy: |
192 | | - matrix: |
193 | | - include: |
194 | | - - cmake_arch: Win32 |
195 | | - wheel_arch: win32 |
196 | | - vcpkg_arch: x86 |
197 | | - os: windows-2022 |
198 | | - test_extra: test |
199 | | - - cmake_arch: x64 |
200 | | - wheel_arch: win_amd64 |
201 | | - vcpkg_arch: x64 |
202 | | - os: windows-2022 |
203 | | - test_extra: test |
204 | | - - cmake_arch: ARM64 |
205 | | - wheel_arch: win_arm64 |
206 | | - vcpkg_arch: arm64 |
207 | | - os: windows-11-arm |
208 | | - test_extra: test-win-arm64 |
209 | | - runs-on: ${{ matrix.os }} |
210 | | - |
211 | | - steps: |
212 | | - - uses: actions/checkout@v5 |
213 | | - with: |
214 | | - submodules: true |
215 | | - fetch-depth: 0 |
216 | 32 |
|
217 | | - - name: Cache installed C core |
218 | | - id: cache-c-core |
219 | | - uses: actions/cache@v5 |
| 33 | + - uses: actions/upload-artifact@v4 |
220 | 34 | with: |
221 | | - path: vendor/install |
222 | | - key: C-core-cache-${{ runner.os }}-${{ matrix.cmake_arch }}-${{ hashFiles('.git/modules/**/HEAD') }} |
223 | | - |
224 | | - - name: Cache VCPKG |
225 | | - uses: actions/cache@v5 |
226 | | - with: |
227 | | - path: C:/vcpkg/installed/ |
228 | | - key: vcpkg-${{ runner.os }}-${{ matrix.vcpkg_arch }} |
229 | | - |
230 | | - - name: Install build dependencies |
231 | | - if: steps.cache-c-core.outputs.cache-hit != 'true' # Only needed when building the C core |
232 | | - run: choco install winflexbison3 ninja |
233 | | - |
234 | | - - name: Install VCPKG libraries |
235 | | - run: | |
236 | | - %VCPKG_INSTALLATION_ROOT%\vcpkg.exe integrate install |
237 | | - %VCPKG_INSTALLATION_ROOT%\vcpkg.exe install liblzma:${{ matrix.vcpkg_arch }}-windows-static-md libxml2:${{ matrix.vcpkg_arch }}-windows-static-md |
238 | | - shell: cmd |
239 | | - |
240 | | - - name: Build wheels |
241 | | - uses: pypa/cibuildwheel@v3.3.0 |
242 | | - env: |
243 | | - CIBW_BEFORE_BUILD: "pip install -U setuptools && python setup.py build_c_core" |
244 | | - CIBW_BUILD: "*-${{ matrix.wheel_arch }}" |
245 | | - CIBW_TEST_COMMAND: 'cd /d {project} && pip install --prefer-binary ".[${{ matrix.test_extra }}]" && python -m pytest tests' |
246 | | - # Skip tests for Python 3.10 onwards because SciPy does not have |
247 | | - # 32-bit wheels for Windows any more |
248 | | - CIBW_TEST_SKIP: "cp310-win32 cp311-win32 cp312-win32 cp313-win32 cp314-win32" |
249 | | - 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 }} |
250 | | - IGRAPH_EXTRA_LIBRARY_PATH: C:/vcpkg/installed/${{ matrix.vcpkg_arch }}-windows-static-md/lib/ |
251 | | - IGRAPH_STATIC_EXTENSION: True |
252 | | - IGRAPH_EXTRA_LIBRARIES: libxml2,lzma,zlib,iconv,charset,bcrypt |
253 | | - IGRAPH_EXTRA_DYNAMIC_LIBRARIES: wsock32,ws2_32 |
254 | | - |
255 | | - - uses: actions/upload-artifact@v6 |
256 | | - with: |
257 | | - name: wheels-win-${{ matrix.wheel_arch }} |
| 35 | + name: wheels-linux-x86_64 |
258 | 36 | path: ./wheelhouse/*.whl |
259 | | - |
260 | | - build_sdist: |
261 | | - name: Build sdist and test extra dependencies |
262 | | - runs-on: ubuntu-latest |
263 | | - steps: |
264 | | - - uses: actions/checkout@v5 |
265 | | - with: |
266 | | - submodules: true |
267 | | - fetch-depth: 0 |
268 | | - |
269 | | - - name: Cache installed C core |
270 | | - id: cache-c-core |
271 | | - uses: actions/cache@v5 |
272 | | - with: |
273 | | - path: | |
274 | | - vendor/install |
275 | | - key: C-core-cache-${{ runner.os }}-${{ hashFiles('.git/modules/**/HEAD') }} |
276 | | - |
277 | | - - name: Install OS dependencies |
278 | | - if: steps.cache-c-core.outputs.cache-hit != 'true' # Only needed when building the C core |
279 | | - run: sudo apt install ninja-build cmake flex bison |
280 | | - |
281 | | - - uses: actions/setup-python@v6 |
282 | | - name: Install Python |
283 | | - with: |
284 | | - python-version: "3.9" |
285 | | - |
286 | | - - name: Build sdist |
287 | | - run: | |
288 | | - python setup.py build_c_core |
289 | | - python setup.py sdist |
290 | | - pip install . |
291 | | -
|
292 | | - - name: Test |
293 | | - run: | |
294 | | - pip install '.[test]' |
295 | | - python -m pytest -v tests |
296 | | -
|
297 | | - - uses: actions/upload-artifact@v6 |
298 | | - with: |
299 | | - name: sdist |
300 | | - path: dist/*.tar.gz |
301 | | - |
302 | | - # When updating 'runs-on', the ASan/UBSan library paths/versions must also be updated for LD_PRELOAD |
303 | | - # for the "Test" step below. |
304 | | - build_with_sanitizer: |
305 | | - name: Build with sanitizers for debugging purposes |
306 | | - runs-on: ubuntu-latest |
307 | | - env: |
308 | | - IGRAPH_CMAKE_EXTRA_ARGS: -DFORCE_COLORED_OUTPUT=ON |
309 | | - steps: |
310 | | - - uses: actions/checkout@v5 |
311 | | - with: |
312 | | - submodules: true |
313 | | - fetch-depth: 0 |
314 | | - |
315 | | - - name: Cache installed C core |
316 | | - id: cache-c-core |
317 | | - uses: actions/cache@v5 |
318 | | - with: |
319 | | - path: | |
320 | | - vendor/build |
321 | | - vendor/install |
322 | | - key: C-core-build-sanitizer-v1-${{ runner.os }}-${{ hashFiles('.git/modules/vendor/source/igraph/HEAD') }} |
323 | | - |
324 | | - - name: Install OS dependencies |
325 | | - if: steps.cache-c-core.outputs.cache-hit != 'true' # Only needed when building the C core |
326 | | - run: sudo apt install ninja-build cmake flex bison |
327 | | - |
328 | | - - uses: actions/setup-python@v6 |
329 | | - name: Install Python |
330 | | - with: |
331 | | - python-version: "3.12" |
332 | | - |
333 | | - - name: Build and install Python extension |
334 | | - env: |
335 | | - IGRAPH_USE_SANITIZERS: 1 |
336 | | - run: | |
337 | | - # We cannot install the test dependency group because many test dependencies cause |
338 | | - # false positives in the sanitizer |
339 | | - pip install --prefer-binary networkx pytest pytest-timeout |
340 | | - pip install -e . |
341 | | -
|
342 | | - # Only pytest, and nothing else should be run in this section due to the presence of LD_PRELOAD. |
343 | | - # The ASan/UBSan library versions need to be updated when switching to a newer Ubuntu/GCC. |
344 | | - # LD_PRELOAD needs to be specified in the "run" section to ensure that we |
345 | | - # do not pick up memory leaks in the wrapper shell (e.g., /bin/bash) |
346 | | - - name: Test |
347 | | - env: |
348 | | - ASAN_OPTIONS: "detect_stack_use_after_return=1" |
349 | | - LSAN_OPTIONS: "suppressions=etc/lsan-suppr.txt:print_suppressions=false" |
350 | | - run: | |
351 | | - sudo sysctl vm.mmap_rnd_bits=28 |
352 | | - LD_PRELOAD=/lib/x86_64-linux-gnu/libasan.so.8:/lib/x86_64-linux-gnu/libubsan.so.1 python -m pytest --capture=sys tests |
0 commit comments