Skip to content

Commit 75d8dcf

Browse files
committed
Add intel-based macOS runner to github action Build Wheel
1 parent 60806ed commit 75d8dcf

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

.github/workflows/build_wheel.yaml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,14 @@ on: [push]
5959

6060
env:
6161
VCPKG_ROOT: ${{ github.workspace }}/vendor/vcpkg # Match your project structure
62-
VCPKG_TRIPLET: x64-osx # Use arm64-osx for Apple Silicon
6362

6463
jobs:
6564
build:
66-
runs-on: macos-latest
6765
strategy:
6866
matrix:
69-
arch: [x86_64, arm64]
67+
os: [macos-13, macos-14]
7068
python-version: ["3.11", "3.12"]
69+
runs-on: ${{ matrix.os }}
7170
steps:
7271
- name: Checkout repository
7372
uses: actions/checkout@v3
@@ -90,17 +89,6 @@ jobs:
9089
python -m pip install wheel # Add other build deps if needed
9190
python -m pip install -r requirements.txt
9291
93-
# - name: Cache vcpkg
94-
# uses: actions/cache@v3
95-
# with:
96-
# path: |
97-
# ${{ env.VCPKG_ROOT }}/downloads
98-
# ${{ env.VCPKG_ROOT }}/packages
99-
# ${{ env.VCPKG_ROOT }}/installed
100-
# key: ${{ runner.os }}-vcpkg-${{ matrix.arch }}-${{ hashFiles('vcpkg.json') }}
101-
# restore-keys: |
102-
# ${{ runner.os }}-vcpkg-${{ matrix.arch }}-
103-
10492
- name: Bootstrap vcpkg
10593
run: ${{ env.VCPKG_ROOT }}/bootstrap-vcpkg.sh -disableMetrics
10694

@@ -131,7 +119,9 @@ jobs:
131119
- name: Upload artifact
132120
uses: actions/upload-artifact@v4
133121
with:
134-
name: pymol-wheel
122+
name: macpymol-wheel-${{ matrix.os }}
135123
path: dist/*.whl
136124

137-
# TRIPLET=$([ "${{ matrix.arch }}" = "arm64" ] && echo "arm64-osx" || echo "x64-osx")
125+
# VCPKG_TRIPLET: x64-osx # Use arm64-osx for Apple Silicon
126+
# TRIPLET=$([ "${{ matrix.arch }}" = "arm64" ] && echo "arm64-osx" || echo "x64-osx")
127+
# arch: [x86_64, arm64]

automations/build_macos_wheel.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,21 @@
2525

2626
def build_wheel() -> None:
2727
"""Builds the wheel file for the python PyMOL package."""
28-
# Run the command using subprocess.run
28+
tmp_python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
29+
tmp_shared_suffix = f".cpython-{tmp_python_version.replace('.', '')}-darwin.so"
2930
if not pathlib.Path(const.PROJECT_ROOT_DIR / "src/python/pymol").exists():
3031
utils.copy_pymol_sources()
31-
_CMD_FROM_BUILD_DIR = pathlib.Path(const.PROJECT_ROOT_DIR / "cmake-build-release" / "_cmd.cpython-311-darwin.so")
32-
_CMD_FROM_PRE_BUILT_DIR = pathlib.Path(const.PROJECT_ROOT_DIR / "pre-built" / "_cmd.cpython-311-darwin.so")
32+
_CMD_FROM_BUILD_DIR = pathlib.Path(const.PROJECT_ROOT_DIR / "cmake-build-release" / f"_cmd{tmp_shared_suffix}")
33+
_CMD_FROM_PRE_BUILT_DIR = pathlib.Path(const.PROJECT_ROOT_DIR / "pre-built" / f"_cmd{tmp_shared_suffix}")
3334
if _CMD_FROM_BUILD_DIR.exists():
3435
shutil.copy(
3536
_CMD_FROM_BUILD_DIR,
36-
pathlib.Path(const.PROJECT_ROOT_DIR / "src/python/pymol" / "_cmd.cpython-311-darwin.so")
37+
pathlib.Path(const.PROJECT_ROOT_DIR / "src/python/pymol" / f"_cmd{tmp_shared_suffix}")
3738
)
3839
else:
3940
shutil.copy(
4041
_CMD_FROM_PRE_BUILT_DIR,
41-
pathlib.Path(const.PROJECT_ROOT_DIR / "src/python/pymol" / "_cmd.cpython-311-darwin.so")
42+
pathlib.Path(const.PROJECT_ROOT_DIR / "src/python/pymol" / f"_cmd{tmp_shared_suffix}")
4243
)
4344
else:
4445
print("The src/python/pymol directory already exists, that might mean a self compiled _cmd module was built.")

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def build_cmake_extension(self):
7272
"-DCMAKE_TOOLCHAIN_FILE=./vendor/vcpkg/scripts/buildsystems/vcpkg.cmake",
7373
f"-DPYTHON_VER={tmp_python_version}",
7474
f"-DSHARED_SUFFIX={tmp_cmd_suffix}",
75-
"-DCMAKE_OSX_ARCHITECTURES=arm64"
75+
f"-DCMAKE_OSX_ARCHITECTURES={get_mac_architecture()}"
7676
]
7777

7878
# Run CMake to configure and build the extension

0 commit comments

Comments
 (0)