Skip to content

Commit d6822c0

Browse files
Fix CI for Python wheels (#364)
1 parent e580653 commit d6822c0

File tree

9 files changed

+235
-96
lines changed

9 files changed

+235
-96
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: build-linux-wheels
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build-manylinux-python:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
python-version: ["cp38-manylinux_x86_64", "cp39-manylinux_x86_64", "cp310-manylinux_x86_64", "cp311-manylinux_x86_64", "cp312-manylinux_x86_64", "cp313-manylinux_x86_64"]
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Python (runner)
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.12'
22+
23+
- name: Install build tooling
24+
run: |
25+
python -m pip install --upgrade pip
26+
python -m pip install --upgrade cibuildwheel twine
27+
28+
- name: Build manylinux wheels with cibuildwheel
29+
env:
30+
# Target CPython versions (align with former matrix)
31+
CIBW_BUILD: ${{ matrix.python-version }}
32+
# CIBW_BUILD: "cp310-manylinux_x86_64"
33+
# Skip PyPy & musllinux for now
34+
CIBW_SKIP: "pp* *musllinux*"
35+
# Install system deps (runs inside manylinux container)
36+
CIBW_BEFORE_ALL_LINUX: >-
37+
yum install -y epel-release &&
38+
yum install -y cmake3 libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel mesa-libGLU-devel
39+
# Provide flags similar to prior pip-wheel-args (handled via env; setup.py could be adapted to read these)
40+
# EXTRA_CMAKE_DEFINES: "-DUSE_AVX=Off -DCI_BUILD=On"
41+
EXTRA_CMAKE_DEFINES: "-DUSE_AVX=On -DCI_BUILD=On"
42+
# Verbosity
43+
CIBW_BUILD_VERBOSITY: "1"
44+
run: |
45+
# If needed, adapt setup.py to consume EXTRA_CMAKE_DEFINES; for now rely on defaults.
46+
python -m cibuildwheel --output-dir wheelhouse
47+
48+
- name: Upload wheels artifact
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: pysplishsplash-${{matrix.python-version}}
52+
path: wheelhouse
53+
if: always()
54+
55+
- name: Publish wheels to PyPI
56+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
57+
env:
58+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
59+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
60+
run: |
61+
twine upload wheelhouse/*-manylinux*.whl --skip-existing

.github/workflows/build-linux.yml

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- name: apt-get update
1515
run: sudo apt-get update --fix-missing
1616
- name: Install packages
@@ -22,49 +22,3 @@ jobs:
2222
- name: tests
2323
run: cd bin && ./KernelTests && ./ReadWriteStateTests
2424

25-
build-manylinux-python:
26-
27-
runs-on: ubuntu-latest
28-
strategy:
29-
matrix:
30-
# python-version: [3.7]
31-
python-version: [cp37-cp37m, cp38-cp38, cp39-cp39, cp310-cp310]
32-
33-
steps:
34-
- uses: actions/checkout@v3
35-
36-
# Set up python
37-
- name: Set up Python 3.8
38-
uses: actions/setup-python@v4
39-
with:
40-
python-version: 3.8
41-
42-
# Install dependencies
43-
- name: Install dependencies
44-
run: python -m pip install --upgrade twine
45-
46-
- name: Build manylinux Python wheels
47-
uses: digitalillusions/python-wheels-manylinux-build@master
48-
with:
49-
# python-versions: 'cp37-cp37m'
50-
python-versions: '${{ matrix.python-version }}'
51-
build-requirements: ''
52-
system-packages: 'cmake3 libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel mesa-libGLU-devel'
53-
package-path: ''
54-
pip-wheel-args: '--manylinux-build -DUSE_AVX=Off -DCI_BUILD=On'
55-
56-
# Upload artifacts
57-
- name: Upload compiled wheel
58-
uses: actions/upload-artifact@master
59-
with:
60-
name: pysplishsplash-linux-${{ matrix.python-version }}
61-
path: wheelhouse
62-
if: always()
63-
64-
# Publish to pypi
65-
- name: Publish wheels to PyPI
66-
env:
67-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
68-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
69-
run: |
70-
twine upload wheelhouse/*-manylinux*.whl --skip-existing
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: build-mac-wheels
2+
3+
on:
4+
push:
5+
branches: [ ]
6+
7+
jobs:
8+
build-mac-python:
9+
runs-on: macos-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
# python-version: ["cp38-macosx_arm64", "cp39-macosx_arm64", "cp310-macosx_arm64", "cp311-macosx_arm64", "cp312-macosx_arm64", "cp313-macosx_arm64"]
14+
python-version: ["cp39-macosx_arm64", "cp310-macosx_arm64", "cp311-macosx_arm64", "cp312-macosx_arm64", "cp313-macosx_arm64"]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Homebrew
20+
id: set-up-homebrew
21+
uses: Homebrew/actions/setup-homebrew@main
22+
- name: Install OpenMP
23+
run: brew install libomp
24+
25+
- name: Set up Python (runner)
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.12'
29+
30+
- name: Install build tooling
31+
run: |
32+
python -m pip install --upgrade pip
33+
python -m pip install --upgrade cibuildwheel twine
34+
35+
- name: Build macOS wheels with cibuildwheel
36+
env:
37+
# Target CPython versions (align with former matrix)
38+
CIBW_BUILD: ${{ matrix.python-version }}
39+
EXTRA_CMAKE_DEFINES: "-DUSE_AVX=On"
40+
# Ensure libomp from Homebrew is visible inside cibuildwheel build env
41+
# This block is executed in a shell for each build by cibuildwheel.
42+
# CIBW_BEFORE_BUILD: >-
43+
# brew install libomp && ls -a /opt/homebrew/opt/libomp/
44+
CIBW_ENVIRONMENT_MACOS: >-
45+
MACOSX_DEPLOYMENT_TARGET="14.0"
46+
run: |
47+
python -m cibuildwheel --output-dir wheelhouse
48+
49+
- name: Upload wheels artifact
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: pysplishsplash-${{matrix.python-version}}
53+
path: wheelhouse
54+
if: always()
55+
56+
- name: Publish wheels to PyPI
57+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
58+
env:
59+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
60+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
61+
run: |
62+
twine upload wheelhouse/*.whl --skip-existing

.github/workflows/build-mac.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: build-mac
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build-mac:
9+
10+
runs-on: macos-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up Homebrew
15+
id: set-up-homebrew
16+
uses: Homebrew/actions/setup-homebrew@main
17+
- name: Install OpenMP
18+
run: brew install libomp
19+
- name: configure
20+
run: mkdir build-release && cd build-release && cmake -DCMAKE_BUILD_TYPE=Release ..
21+
- name: build
22+
run: cmake --build build-release
23+
- name: tests
24+
run: cd bin && ./KernelTests && ./ReadWriteStateTests
25+
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: build-windows-wheels
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
# Build the python wheel in parallel
9+
build-windows-wheels:
10+
runs-on: windows-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
# python-version: [3.7]
15+
python-version: ['cp38-win_amd64', 'cp39-win_amd64', 'cp310-win_amd64', 'cp311-win_amd64', 'cp312-win_amd64', 'cp313-win_amd64']
16+
17+
steps:
18+
# Checkout repo
19+
- uses: actions/checkout@v3
20+
21+
# Checkout repo
22+
- name: Set up Python (runner)
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.12'
26+
27+
- name: Install build tooling
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install --upgrade cibuildwheel twine
31+
32+
- name: Build manylinux wheels with cibuildwheel
33+
env:
34+
EXTRA_CMAKE_DEFINES: "-DUSE_AVX=On"
35+
# Verbosity
36+
CIBW_BUILD_VERBOSITY: "1"
37+
CIBW_BUILD: ${{matrix.python-version}}
38+
run: |
39+
# If needed, adapt setup.py to consume EXTRA_CMAKE_DEFINES; for now rely on defaults.
40+
python -m cibuildwheel --output-dir wheelhouse
41+
42+
- name: Upload wheels artifact
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: pysplishsplash-${{matrix.python-version}}
46+
path: wheelhouse
47+
if: always()
48+
49+
# Upload wheel to pypi
50+
- name: Upload wheel to pypi
51+
env:
52+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
53+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
54+
run: |
55+
twine upload wheelhouse/*.whl --skip-existing

.github/workflows/build-windows.yml

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -32,44 +32,3 @@ jobs:
3232
- name: tests
3333
run: cd bin;./KernelTests;./ReadWriteStateTests
3434
shell: pwsh
35-
36-
# Build the python wheel in parallel
37-
build-windows-python:
38-
runs-on: windows-latest
39-
strategy:
40-
matrix:
41-
# python-version: [3.7]
42-
python-version: ['3.7', '3.8', '3.9', '3.10']
43-
44-
steps:
45-
# Checkout repo
46-
- uses: actions/checkout@v3
47-
48-
# Set up python
49-
- name: Set up Python ${{ matrix.python-version }}
50-
uses: actions/setup-python@v4
51-
with:
52-
python-version: ${{ matrix.python-version }}
53-
54-
# Install python dependencies
55-
- name: Install dependencies
56-
run: python -m pip install --upgrade pip setuptools wheel twine
57-
58-
# Change directory and run setup py
59-
- name: Run setup py
60-
run: python setup.py bdist_wheel
61-
62-
# Upload artifacts
63-
- name: Upload compiled wheel
64-
uses: actions/upload-artifact@master
65-
with:
66-
name: pysplishsplash-windows-${{ matrix.python-version }}
67-
path: build/dist
68-
if: always()
69-
70-
# Upload wheel to pypi
71-
- name: Upload wheel to pypi
72-
env:
73-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
74-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
75-
run: twine upload build/dist/* --skip-existing

CMake/Common.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ if (USE_THIRD_PARTY_METHODS)
4242
add_definitions( -DUSE_THIRD_PARTY_METHODS)
4343
endif (USE_THIRD_PARTY_METHODS)
4444

45-
cmake_dependent_option(USE_PYTHON_BINDINGS "Generate Python Bindings using PyBind11" ON "PYTHON_EXECUTABLE" OFF)
45+
cmake_dependent_option(USE_PYTHON_BINDINGS "Generate Python Bindings using PyBind11" ON "Python_EXECUTABLE" OFF)
4646
if (USE_PYTHON_BINDINGS AND UNIX)
4747
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
4848
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bdist_wheel]
2-
dist-dir = build/dist
2+
dist_dir = build/dist
33

44
[egg_info]
55
egg_base = build/

0 commit comments

Comments
 (0)