|
| 1 | +name: Build wheels |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +env: |
| 10 | + # VieCut's bundled tlx uses cmake_minimum_required(VERSION 2.8) which |
| 11 | + # CMake 4.x rejects. This env var tells CMake to accept older policies. |
| 12 | + CMAKE_ARGS: "-DCMAKE_POLICY_VERSION_MINIMUM=3.5" |
| 13 | + |
| 14 | +jobs: |
| 15 | + build-linux: |
| 16 | + name: Linux ${{ matrix.python-version }} |
| 17 | + runs-on: ubuntu-latest |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + python-version: ["cp39", "cp310", "cp311", "cp312", "cp313", "cp314"] |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + submodules: recursive |
| 26 | + |
| 27 | + - uses: pypa/cibuildwheel@v3.3 |
| 28 | + env: |
| 29 | + CIBW_BUILD: "${{ matrix.python-version }}-manylinux_x86_64" |
| 30 | + CIBW_SKIP: "cp31?t-*" |
| 31 | + CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 |
| 32 | + CIBW_BEFORE_ALL: >- |
| 33 | + yum install -y hwloc-devel && |
| 34 | + bash {project}/scripts/build_mtkahypar.sh && |
| 35 | + bash {project}/scripts/build_sharedmap_mtkahypar.sh |
| 36 | + CIBW_ENVIRONMENT: >- |
| 37 | + CXX=g++ |
| 38 | + CMAKE_ARGS=-DCMAKE_POLICY_VERSION_MINIMUM=3.5 |
| 39 | + LD_LIBRARY_PATH={project}/external_repositories/HeiCut/extern/mt-kahypar-library:{project}/external_repositories/HeiCut/extern/mt-kahypar-library/tbb_lib/intel64/gcc4.8:{project}/external_repositories/SharedMap/extern/local/mt-kahypar/lib:$LD_LIBRARY_PATH |
| 40 | + CIBW_TEST_REQUIRES: pytest |
| 41 | + CIBW_TEST_COMMAND: >- |
| 42 | + cp -r {project}/tests /tmp/_cibw_tests && pytest /tmp/_cibw_tests -v -s --tb=long && rm -rf /tmp/_cibw_tests |
| 43 | + CIBW_REPAIR_WHEEL_COMMAND: >- |
| 44 | + LD_LIBRARY_PATH={project}/external_repositories/HeiCut/extern/mt-kahypar-library:{project}/external_repositories/HeiCut/extern/mt-kahypar-library/tbb_lib/intel64/gcc4.8:{project}/external_repositories/SharedMap/extern/local/mt-kahypar/lib:$LD_LIBRARY_PATH |
| 45 | + auditwheel repair -w {dest_dir} {wheel} |
| 46 | +
|
| 47 | + - uses: actions/upload-artifact@v4 |
| 48 | + with: |
| 49 | + name: wheel-linux-${{ matrix.python-version }} |
| 50 | + path: wheelhouse/*.whl |
| 51 | + |
| 52 | + build-macos-arm64: |
| 53 | + name: macOS arm64 ${{ matrix.python-version }} |
| 54 | + runs-on: macos-14 |
| 55 | + strategy: |
| 56 | + fail-fast: false |
| 57 | + matrix: |
| 58 | + python-version: ["cp39", "cp310", "cp311", "cp312", "cp313", "cp314"] |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + with: |
| 62 | + submodules: recursive |
| 63 | + |
| 64 | + - uses: pypa/cibuildwheel@v3.3 |
| 65 | + env: |
| 66 | + CIBW_BUILD: "${{ matrix.python-version }}-macosx_arm64" |
| 67 | + CIBW_SKIP: "cp31?t-*" |
| 68 | + CIBW_BEFORE_ALL: >- |
| 69 | + brew install libomp hwloc tbb boost && |
| 70 | + bash {project}/scripts/build_mtkahypar.sh && |
| 71 | + bash {project}/scripts/build_sharedmap_mtkahypar.sh |
| 72 | + CIBW_ENVIRONMENT: >- |
| 73 | + CC=clang |
| 74 | + CXX=clang++ |
| 75 | + MACOSX_DEPLOYMENT_TARGET=14.0 |
| 76 | + OpenMP_ROOT=/opt/homebrew/opt/libomp |
| 77 | + CMAKE_ARGS="-DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DOpenMP_ROOT=/opt/homebrew/opt/libomp" |
| 78 | + KAHYPAR_DOWNLOAD_TBB=OFF |
| 79 | + KAHYPAR_DOWNLOAD_BOOST=OFF |
| 80 | + CIBW_TEST_REQUIRES: pytest |
| 81 | + CIBW_TEST_COMMAND: >- |
| 82 | + cp -r {project}/tests /tmp/_cibw_tests && pytest /tmp/_cibw_tests -v -s --tb=long && rm -rf /tmp/_cibw_tests |
| 83 | + CIBW_REPAIR_WHEEL_COMMAND: >- |
| 84 | + DYLD_LIBRARY_PATH={project}/external_repositories/HeiCut/extern/mt-kahypar-library:{project}/external_repositories/SharedMap/extern/local/mt-kahypar/lib:$DYLD_LIBRARY_PATH |
| 85 | + delocate-wheel --require-archs arm64 -w {dest_dir} {wheel} |
| 86 | +
|
| 87 | + - uses: actions/upload-artifact@v4 |
| 88 | + with: |
| 89 | + name: wheel-macos-arm64-${{ matrix.python-version }} |
| 90 | + path: wheelhouse/*.whl |
| 91 | + |
| 92 | + # Windows builds are disabled: the bundled C++ graph algorithm libraries |
| 93 | + # (KaHIP, HeiStream, HyperMIS, etc.) rely on POSIX headers (sys/time.h, |
| 94 | + # sys/mman.h, execinfo.h) that are not available on MSVC/Windows. |
| 95 | + |
| 96 | + build-sdist: |
| 97 | + name: Source distribution |
| 98 | + runs-on: ubuntu-latest |
| 99 | + steps: |
| 100 | + - uses: actions/checkout@v4 |
| 101 | + with: |
| 102 | + submodules: recursive |
| 103 | + |
| 104 | + - uses: actions/setup-python@v5 |
| 105 | + with: |
| 106 | + python-version: "3.12" |
| 107 | + |
| 108 | + - run: pip install build |
| 109 | + - run: python -m build --sdist |
| 110 | + |
| 111 | + - uses: actions/upload-artifact@v4 |
| 112 | + with: |
| 113 | + name: sdist |
| 114 | + path: dist/*.tar.gz |
| 115 | + |
| 116 | + create-release: |
| 117 | + name: Create GitHub Release |
| 118 | + needs: [build-linux, build-macos-arm64, build-sdist] |
| 119 | + runs-on: ubuntu-latest |
| 120 | + permissions: |
| 121 | + contents: write |
| 122 | + steps: |
| 123 | + - uses: actions/download-artifact@v4 |
| 124 | + with: |
| 125 | + path: dist |
| 126 | + merge-multiple: true |
| 127 | + |
| 128 | + - uses: softprops/action-gh-release@v2 |
| 129 | + with: |
| 130 | + files: dist/* |
| 131 | + generate_release_notes: true |
0 commit comments