Skip to content

Commit 72ff49e

Browse files
committed
feat: Add macos wheel builds
1 parent e8363d2 commit 72ff49e

File tree

3 files changed

+48
-12
lines changed

3 files changed

+48
-12
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
# macos-13 is an intel runner, macos-14 is apple silicon
19-
#os: [ubuntu-latest, windows-latest, macos-13, macos-14]
20-
os: [ubuntu-latest]
19+
os: [ubuntu-latest, macos-13]
2120

2221
steps:
2322
- uses: actions/checkout@v4
@@ -28,14 +27,7 @@ jobs:
2827
pip install twine
2928
3029
- name: Build wheels
31-
uses: pypa/cibuildwheel@v2.21.3
32-
# env:
33-
# CIBW_SOME_OPTION: value
34-
# ...
35-
# with:
36-
# package-dir: .
37-
# output-dir: wheelhouse
38-
# config-file: "{package}/pyproject.toml"
30+
uses: pypa/cibuildwheel@v2.23.3
3931

4032
- name: Publish PyPI
4133
env:
@@ -49,4 +41,4 @@ jobs:
4941
- uses: actions/upload-artifact@v4
5042
with:
5143
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
52-
path: ./wheelhouse/*.whl
44+
path: ./wheelhouse/*.whl
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
set -e
2+
3+
# Install homebrew
4+
export NONINTERACTIVE=1
5+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
6+
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> /Users/runner/.bash_profile
7+
eval "$(/usr/local/bin/brew shellenv)"
8+
9+
env
10+
11+
set -x
12+
13+
PROJECT_DIR="$1"
14+
PLATFORM=$(uname -m)
15+
echo $PLATFORM
16+
17+
# TODO: Add licenses if need be. Also check the linux cibw script
18+
# cat $PROJECT_DIR/tools/wheels/LICENSE_osx.txt >> $PROJECT_DIR/LICENSE.txt
19+
20+
# Install GFortran + OpenBLAS
21+
22+
if [[ $PLATFORM == "x86_64" ]]; then
23+
# Install openblas
24+
/usr/local/bin/brew update
25+
/usr/local/bin/brew install gcc gfortran openblas
26+
27+
ln -sf /usr/local/bin/gfortran-14 /usr/local/bin/gfortran
28+
fi
29+
30+
31+
python -m pip install -U --pre pip
32+
python -m pip install ninja meson-python

pyproject.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ markers = ["short: marks tests as short (deselect with '-m \"not short\"')"]
7474

7575
[tool.cibuildwheel]
7676
#skip = "cp36-* cp37-* cp38-* pp* *_ppc64le *_i686 *_s390x"
77-
build = "cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64"
77+
build = "cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64 cp312-macosx_x86_64"
7878
build-verbosity = 3
7979
# gmpy2 and scikit-umfpack are usually added for testing. However, there are
8080
# currently wheels missing that make the test script fail.
@@ -87,6 +87,18 @@ manylinux-aarch64-image = "manylinux2014"
8787
before-build = "bash {project}/devtools/ciwheels/cibw_before_build_linux.sh {project}"
8888
config-settings = "setup-args='-Dblas=cibuild'"
8989

90+
[tool.cibuildwheel.macos]
91+
before-build = "bash {project}/devtools/ciwheels/cibw_before_build_macos.sh {project}"
92+
93+
[tool.cibuildwheel.macos.environment]
94+
PKG_CONFIG_PATH = "{project}:/usr/local/opt/openblas/lib/pkgconfig"
95+
MACOSX_DEPLOYMENT_TARGET = "13.0"
96+
PATH = "$PATH:/usr/local/bin"
97+
CC = "/usr/local/bin/gcc-14"
98+
CXX = "/usr/local/bin/g++-14"
99+
FC = "/usr/local/bin/gfortran-14"
100+
101+
90102
[tool.cibuildwheel.linux.environment]
91103
# /project will be the $PWD equivalent inside the docker used to build the wheel
92104
PKG_CONFIG_PATH = "/project/"

0 commit comments

Comments
 (0)