Skip to content

Commit

Permalink
just for fun: try python windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
N-Maas committed Dec 6, 2024
1 parent f9e2b12 commit 655c41a
Showing 1 changed file with 198 additions and 160 deletions.
358 changes: 198 additions & 160 deletions .github/workflows/python_build_ci.yml
Original file line number Diff line number Diff line change
@@ -1,190 +1,228 @@
name: Mt-KaHyPar Python Package

on:
push:
tags:
- ["v[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+"]
push

jobs:
package_linux_x86:
name: Python Package Linux x86

runs-on: ubuntu-24.04
# package_linux_x86:
# name: Python Package Linux x86

# runs-on: ubuntu-24.04
# env:
# CI_ACTIVE : 1
# TBB_INSTALL_DIR: /tmp/tbb_build

# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5

# - name: Install Dependencies
# run: |
# sudo apt-get install libtbb-dev libhwloc-dev libboost-program-options-dev
# python3 -m pip install cibuildwheel>=2.22.0

# - name: Build Python Wheels
# env:
# CIBW_ARCHS_LINUX: x86_64
# CIBW_BUILD: cp3*-manylinux*
# run: |
# # run cmake to create pyproject.toml from pyproject.toml.in
# cmake -B configure_python --preset=minimal -DKAHYPAR_SETUP_PYTHON=On -DKAHYPAR_TBB_DIR=$TBB_INSTALL_DIR -DKAHYPAR_DISABLE_HWLOC=Off
# rm -rf configure_python
# python3 -m cibuildwheel --output-dir wheels

# - uses: actions/upload-artifact@v4
# with:
# name: cibw-wheels-ubuntu-24.04
# path: ./wheels/*.whl


# package_linux_arm_1:
# name: Python Package Linux ARM 1

# runs-on: ubuntu-24.04
# env:
# CI_ACTIVE : 1
# TBB_INSTALL_DIR: /tmp/tbb_build

# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# with:
# platforms: all

# - name: Install Dependencies
# run: |
# sudo apt-get install libtbb-dev libhwloc-dev libboost-program-options-dev
# python3 -m pip install cibuildwheel>=2.22.0

# - name: Build Python Wheels
# env:
# CIBW_ARCHS_LINUX: aarch64
# CIBW_BUILD: cp3{9,10,11}-manylinux*
# run: |
# # run cmake to create pyproject.toml from pyproject.toml.in
# cmake -B configure_python --preset=minimal -DKAHYPAR_SETUP_PYTHON=On -DKAHYPAR_TBB_DIR=$TBB_INSTALL_DIR -DKAHYPAR_DISABLE_HWLOC=Off
# rm -rf configure_python
# python3 -m cibuildwheel --output-dir wheels

# - uses: actions/upload-artifact@v4
# with:
# name: cibw-wheels-ubuntu-24.04-arm1
# path: ./wheels/*.whl

# package_linux_arm_2:
# name: Python Package Linux ARM 2

# runs-on: ubuntu-24.04
# env:
# CI_ACTIVE : 1
# TBB_INSTALL_DIR: /tmp/tbb_build

# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# with:
# platforms: all

# - name: Install Dependencies
# run: |
# sudo apt-get install libtbb-dev libhwloc-dev libboost-program-options-dev
# python3 -m pip install cibuildwheel>=2.22.0

# - name: Build Python Wheels
# env:
# CIBW_ARCHS_LINUX: aarch64
# CIBW_BUILD: cp3*-manylinux*
# CIBW_PROJECT_REQUIRES_PYTHON: ">=3.12"
# run: |
# # run cmake to create pyproject.toml from pyproject.toml.in
# cmake -B configure_python --preset=minimal -DKAHYPAR_SETUP_PYTHON=On -DKAHYPAR_TBB_DIR=$TBB_INSTALL_DIR -DKAHYPAR_DISABLE_HWLOC=Off
# rm -rf configure_python
# python3 -m cibuildwheel --output-dir wheels

# - uses: actions/upload-artifact@v4
# with:
# name: cibw-wheels-ubuntu-24.04-arm2
# path: ./wheels/*.whl


# package_macos:
# name: Python Package MacOS

# runs-on: macos-latest
# env:
# CI_ACTIVE : 1
# TBB_INSTALL_DIR: /tmp/tbb_build

# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5

# - name: Install Dependencies
# run: |
# brew install tbb boost pipx

# - name: Build Python Wheels
# env:
# CIBW_ARCHS_MACOS: x86_64 arm64
# CIBW_BUILD: cp3*-macos*
# # TBB doesn't compile on older MacOS than 10.13
# MACOSX_DEPLOYMENT_TARGET: 10.13
# run: |
# # run cmake to create pyproject.toml from pyproject.toml.in
# cmake -B configure_python --preset=minimal -DKAHYPAR_SETUP_PYTHON=On -DKAHYPAR_TBB_DIR=$TBB_INSTALL_DIR -DKAHYPAR_DISABLE_HWLOC=On
# rm -rf configure_python
# pipx run cibuildwheel --output-dir wheels

# - uses: actions/upload-artifact@v4
# with:
# name: cibw-wheels-macos
# path: ./wheels/*.whl


package_windows:
name: Python Package Windows

runs-on: windows-latest
env:
CI_ACTIVE : 1
TBB_INSTALL_DIR: /tmp/tbb_build
TBB_INSTALL_DIR: "C:/Users/AppData/Local/Temp/tbb_build"

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5

- name: Install Dependencies
run: |
sudo apt-get install libtbb-dev libhwloc-dev libboost-program-options-dev
python3 -m pip install cibuildwheel>=2.22.0
- name: Build Python Wheels
env:
CIBW_ARCHS_LINUX: x86_64
CIBW_BUILD: cp3*-manylinux*
run: |
# run cmake to create pyproject.toml from pyproject.toml.in
cmake -B configure_python --preset=minimal -DKAHYPAR_SETUP_PYTHON=On -DKAHYPAR_TBB_DIR=$TBB_INSTALL_DIR -DKAHYPAR_DISABLE_HWLOC=Off
rm -rf configure_python
python3 -m cibuildwheel --output-dir wheels
- uses: actions/upload-artifact@v4
- uses: msys2/setup-msys2@v2
with:
name: cibw-wheels-ubuntu-24.04
path: ./wheels/*.whl


package_linux_arm_1:
name: Python Package Linux ARM 1

runs-on: ubuntu-24.04
env:
CI_ACTIVE : 1
TBB_INSTALL_DIR: /tmp/tbb_build
install: git make

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Install Dependencies
- name: Install Boost and TBB
shell: msys2 {0}
run: |
sudo apt-get install libtbb-dev libhwloc-dev libboost-program-options-dev
python3 -m pip install cibuildwheel>=2.22.0
pacman --noconfirm -S mingw-w64-x86_64-boost mingw-w64-x86_64-tbb mingw-w64-x86_64-cmake mingw-w64-x86_64-gcc
- name: Build Python Wheels
env:
CIBW_ARCHS_LINUX: aarch64
CIBW_BUILD: cp3{9,10,11}-manylinux*
- name: Put MSYS2_MinGW64 on Path
run: |
# run cmake to create pyproject.toml from pyproject.toml.in
cmake -B configure_python --preset=minimal -DKAHYPAR_SETUP_PYTHON=On -DKAHYPAR_TBB_DIR=$TBB_INSTALL_DIR -DKAHYPAR_DISABLE_HWLOC=Off
rm -rf configure_python
python3 -m cibuildwheel --output-dir wheels
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-ubuntu-24.04-arm1
path: ./wheels/*.whl

package_linux_arm_2:
name: Python Package Linux ARM 2

runs-on: ubuntu-24.04
env:
CI_ACTIVE : 1
TBB_INSTALL_DIR: /tmp/tbb_build

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all

- name: Install Dependencies
run: |
sudo apt-get install libtbb-dev libhwloc-dev libboost-program-options-dev
python3 -m pip install cibuildwheel>=2.22.0
echo "${{ runner.temp }}/msys64/mingw64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Build Python Wheels
env:
CIBW_ARCHS_LINUX: aarch64
CIBW_BUILD: cp3*-manylinux*
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.12"
CIBW_ARCHS_WINDOWS: x86_64 AMD64
CIBW_BUILD: cp3*-windows*
run: |
# run cmake to create pyproject.toml from pyproject.toml.in
cmake -B configure_python --preset=minimal -DKAHYPAR_SETUP_PYTHON=On -DKAHYPAR_TBB_DIR=$TBB_INSTALL_DIR -DKAHYPAR_DISABLE_HWLOC=Off
rm -rf configure_python
python3 -m cibuildwheel --output-dir wheels
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-ubuntu-24.04-arm2
path: ./wheels/*.whl


package_macos:
name: Python Package MacOS

runs-on: macos-latest
env:
CI_ACTIVE : 1
TBB_INSTALL_DIR: /tmp/tbb_build

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5

- name: Install Dependencies
run: |
brew install tbb boost pipx
- name: Build Python Wheels
env:
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_BUILD: cp3*-macos*
# TBB doesn't compile on older MacOS than 10.13
MACOSX_DEPLOYMENT_TARGET: 10.13
run: |
# run cmake to create pyproject.toml from pyproject.toml.in
cmake -B configure_python --preset=minimal -DKAHYPAR_SETUP_PYTHON=On -DKAHYPAR_TBB_DIR=$TBB_INSTALL_DIR -DKAHYPAR_DISABLE_HWLOC=On
rm -rf configure_python
pipx run cibuildwheel --output-dir wheels
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-macos
name: cibw-wheels-windows
path: ./wheels/*.whl


build_sdist:
name: Build Source Distribution
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Install Dependencies
run: |
sudo apt-get install libtbb-dev libhwloc-dev libboost-program-options-dev
- name: Build sdist
run: |
# run cmake to create pyproject.toml from pyproject.toml.in
cmake -B configure_python --preset=minimal -DKAHYPAR_SETUP_PYTHON=On -DKAHYPAR_TBB_DIR=$TBB_INSTALL_DIR -DKAHYPAR_DISABLE_HWLOC=Off
rm -rf configure_python
pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

upload_pypi:
needs: [package_linux_x86, package_linux_arm_1, package_linux_arm_2, package_macos, build_sdist]
runs-on: ubuntu-24.04
environment: pypi
permissions:
id-token: write
steps:
- name: Collect Python Packages
uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# build_sdist:
# name: Build Source Distribution
# runs-on: ubuntu-24.04
# steps:
# - uses: actions/checkout@v4

# - name: Install Dependencies
# run: |
# sudo apt-get install libtbb-dev libhwloc-dev libboost-program-options-dev

# - name: Build sdist
# run: |
# # run cmake to create pyproject.toml from pyproject.toml.in
# cmake -B configure_python --preset=minimal -DKAHYPAR_SETUP_PYTHON=On -DKAHYPAR_TBB_DIR=$TBB_INSTALL_DIR -DKAHYPAR_DISABLE_HWLOC=Off
# rm -rf configure_python
# pipx run build --sdist

# - uses: actions/upload-artifact@v4
# with:
# name: cibw-sdist
# path: dist/*.tar.gz

# upload_pypi:
# needs: [package_linux_x86, package_linux_arm_1, package_linux_arm_2, package_macos, build_sdist]
# runs-on: ubuntu-24.04
# environment: pypi
# permissions:
# id-token: write
# steps:
# - name: Collect Python Packages
# uses: actions/download-artifact@v4
# with:
# # unpacks all CIBW artifacts into dist/
# pattern: cibw-*
# path: dist
# merge-multiple: true

# - name: Publish to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 655c41a

Please sign in to comment.