|
12 | 12 | #-* |
13 | 13 | #-* |
14 | 14 | #Z* ------------------------------------------------------------------- |
| 15 | +#name: Build Wheel |
| 16 | +# |
| 17 | +#on: [push] |
| 18 | +# |
| 19 | +#jobs: |
| 20 | +# build: |
| 21 | +# |
| 22 | +# runs-on: macos-latest |
| 23 | +# strategy: |
| 24 | +# matrix: |
| 25 | +# python-version: ["3.10", "3.11", "3.12"] |
| 26 | +# |
| 27 | +# steps: |
| 28 | +# - uses: actions/checkout@v4 |
| 29 | +# - name: Set up Python ${{ matrix.python-version }} |
| 30 | +# uses: actions/setup-python@v5 |
| 31 | +# with: |
| 32 | +# python-version: ${{ matrix.python-version }} |
| 33 | +# # You can test your matrix by printing the current Python version |
| 34 | +# - name: Display Python version |
| 35 | +# run: python -c "import sys; print(sys.version)" |
| 36 | +# |
| 37 | +# - name: Install dependencies |
| 38 | +# run: | |
| 39 | +# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
| 40 | +# brew install cmake |
| 41 | +# python -m venv .venv |
| 42 | +# ./.venv/bin/pip install wheel setuptools |
| 43 | +# ./.venv/bin/pip install -r requirements.txt |
| 44 | +# ./automator.sh setup dev-env |
| 45 | +# |
| 46 | +# - name: Build wheel |
| 47 | +# run: | |
| 48 | +# ./automator.sh build so |
| 49 | +# ./automator.sh build wheel |
| 50 | +# |
| 51 | +# - name: Upload artifact |
| 52 | +# uses: actions/upload-artifact@v4 |
| 53 | +# with: |
| 54 | +# name: wheel-${{ matrix.python-version }} |
| 55 | +# path: dist/*.whl |
| 56 | + |
| 57 | + |
15 | 58 | name: Build Wheel |
16 | 59 |
|
17 | 60 | on: [push] |
18 | 61 |
|
| 62 | +env: |
| 63 | + VCPKG_ROOT: ${{ github.workspace }}/vendor/vcpkg # Match your project structure |
| 64 | + VCPKG_TRIPLET: x64-osx # Use arm64-osx for Apple Silicon |
| 65 | + |
19 | 66 | jobs: |
20 | 67 | build: |
21 | | - |
22 | 68 | runs-on: macos-latest |
23 | 69 | strategy: |
24 | 70 | matrix: |
25 | | - python-version: ["3.10", "3.11", "3.12"] |
26 | | - |
| 71 | + arch: [x86_64, arm64] |
| 72 | + python-version: ["3.11", "3.12"] |
27 | 73 | steps: |
28 | | - - uses: actions/checkout@v4 |
29 | | - - name: Set up Python ${{ matrix.python-version }} |
30 | | - uses: actions/setup-python@v5 |
| 74 | + - name: Checkout repository |
| 75 | + uses: actions/checkout@v3 |
31 | 76 | with: |
32 | | - python-version: ${{ matrix.python-version }} |
33 | | - # You can test your matrix by printing the current Python version |
34 | | - - name: Display Python version |
35 | | - run: python -c "import sys; print(sys.version)" |
| 77 | + submodules: recursive |
36 | 78 |
|
37 | | - - name: Install dependencies |
| 79 | + - name: Setup Python |
| 80 | + uses: actions/setup-python@v4 |
| 81 | + with: |
| 82 | + python-version: ${{ env.PYTHON_VER }} |
| 83 | + |
| 84 | + - name: Create virtual environment |
38 | 85 | run: | |
39 | | - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
40 | | - brew install cmake |
41 | 86 | python -m venv .venv |
42 | | - ./.venv/bin/pip install wheel setuptools |
43 | | - ./.venv/bin/pip install -r requirements.txt |
44 | | - ./automator.sh setup dev-env |
| 87 | + source .venv/bin/activate |
| 88 | + python -m pip install wheel # Add other build deps if needed |
| 89 | + python -m pip install -r requirements.txt |
| 90 | +
|
| 91 | + - name: Cache vcpkg |
| 92 | + uses: actions/cache@v3 |
| 93 | + with: |
| 94 | + path: | |
| 95 | + ${{ env.VCPKG_ROOT }}/downloads |
| 96 | + ${{ env.VCPKG_ROOT }}/packages |
| 97 | + ${{ env.VCPKG_ROOT }}/installed |
| 98 | + key: ${{ runner.os }}-vcpkg-${{ matrix.arch }}-${{ hashFiles('vcpkg.json') }} |
| 99 | + restore-keys: | |
| 100 | + ${{ runner.os }}-vcpkg-${{ matrix.arch }}- |
45 | 101 |
|
46 | | - - name: Build wheel |
| 102 | + - name: Bootstrap vcpkg |
| 103 | + run: ${{ env.VCPKG_ROOT }}/bootstrap-vcpkg.sh -disableMetrics |
| 104 | + |
| 105 | + - name: Install vcpkg dependencies |
47 | 106 | run: | |
48 | | - ./automator.sh build so |
49 | | - ./automator.sh build wheel |
| 107 | + TRIPLET=$([ "${{ matrix.arch }}" = "arm64" ] && echo "arm64-osx" || echo "x64-osx") |
| 108 | + ${{ env.VCPKG_ROOT }}/vcpkg install |
50 | 109 |
|
| 110 | + - name: Build extension |
| 111 | + env: |
| 112 | + CMAKE_ARGS: > |
| 113 | + -DCMAKE_TOOLCHAIN_FILE=./vendor/vcpkg/scripts/buildsystems/vcpkg.cmake |
| 114 | + -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} |
| 115 | + -DPYTHON_VER=${{ env.PYTHON_VER }} |
| 116 | + -DSHARED_SUFFIX=.cpython-311-darwin.so # Update to match Python version |
| 117 | + run: | |
| 118 | + source .venv/bin/activate |
| 119 | + python setup.py build bdist_wheel |
| 120 | +# - name: Create universal binary |
| 121 | +# if: matrix.arch == 'x86_64' # Run once after both arch builds |
| 122 | +# run: | |
| 123 | +# lipo -create \ |
| 124 | +# -output dist/_cmd_universal.so \ |
| 125 | +# build/lib*/_cmd*.so |
| 126 | +# rm build/lib*/_cmd*.so # Clean individual arch builds |
| 127 | +# mv dist/_cmd_universal.so build/lib/ |
| 128 | +# |
| 129 | +# - name: Package wheel |
| 130 | +# if: matrix.arch == 'x86_64' |
| 131 | +# run: | |
| 132 | +# source .venv/bin/activate |
| 133 | +# python setup.py bdist_wheel |
51 | 134 | - name: Upload artifact |
52 | 135 | uses: actions/upload-artifact@v4 |
53 | 136 | with: |
54 | | - name: wheel-${{ matrix.python-version }} |
| 137 | + name: pymol-wheel |
55 | 138 | path: dist/*.whl |
0 commit comments