Skip to content

Commit 32bbe16

Browse files
comoco-xiaofbxiang
authored andcommitted
add build script for macOS
1 parent 8360d51 commit 32bbe16

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,38 @@ jobs:
105105
name: windows-wheel-${{ matrix.python-version }}
106106
path: ./dist/*.whl
107107

108+
build-mac:
109+
runs-on: macos-latest
110+
permissions:
111+
contents: write
112+
steps:
113+
- name: Checkout
114+
uses: actions/checkout@v4
115+
with:
116+
submodules: "true"
117+
fetch-depth: 0
118+
fetch-tags: true
119+
- name: Initialize submodules
120+
run: git submodule update --init --recursive
121+
- name: Install CMake
122+
run: brew install cmake
123+
- name: Set up pyenv
124+
run: |
125+
brew update
126+
brew install pyenv
127+
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
128+
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
129+
echo 'eval "$(pyenv init --path)"' >> ~/.bash_profile
130+
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
131+
source ~/.bash_profile
132+
- name: Build wheels
133+
run: "git config --global --add safe.directory '*' && ./scripts/build_mac.sh"
134+
- name: Upload wheels
135+
uses: actions/upload-artifact@v4
136+
with:
137+
name: mac-wheels-all
138+
path: ./dist/*.whl
139+
108140
release:
109141
runs-on: ubuntu-latest
110142
needs: [build-linux-all, build-windows-pybind]
@@ -136,6 +168,11 @@ jobs:
136168
with:
137169
name: linux-wheels-all
138170
path: wheelhouse
171+
- name: Download wheels
172+
uses: actions/download-artifact@v3
173+
with:
174+
name: mac-wheels-all
175+
path: wheelhouse
139176
- name: ls
140177
run: ls wheelhouse
141178
- name: Update Nightly Release

scripts/build_mac.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
3+
function build() {
4+
echo "Building wheel"
5+
6+
PY_VERSION=$1
7+
if [ "$PY_VERSION" -eq 311 ]; then
8+
PY_DOT=3.11.10
9+
elif [ "$PY_VERSION" -eq 312 ]; then
10+
PY_DOT=3.12.4
11+
elif [ "$PY_VERSION" -eq 313 ]; then
12+
PY_DOT=3.13.2
13+
else
14+
echo "Error, python version not found!"
15+
fi
16+
17+
if pyenv versions | grep -q "${PY_DOT}"; then
18+
echo "Version ${PY_DOT} is installed."
19+
else
20+
pyenv install ${PY_DOT}
21+
fi
22+
pyenv global ${PY_DOT}
23+
python --version
24+
25+
python -m pip install setuptools wheel
26+
python setup.py bdist_wheel --build-dir=build --plat-name macosx_12_0_universal2
27+
}
28+
29+
build 311
30+
build 312
31+
build 313

0 commit comments

Comments
 (0)