-
Notifications
You must be signed in to change notification settings - Fork 1
140 lines (117 loc) · 4.23 KB
/
build-wheels-macos.yml
File metadata and controls
140 lines (117 loc) · 4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Build and Release dlib Wheels macOS
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
create_release:
description: "Create a release"
required: false
type: boolean
default: false
jobs:
build-macos:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14] # macos-13 = Intel (x86_64), macos-14 = Apple Silicon (arm64)
python-version: ["3.10", "3.11", "3.12", "3.13"]
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Homebrew dependencies
run: |
brew update
brew install cmake boost openblas
- name: Install Python build tools
run: |
python -m pip install --upgrade pip
pip install build wheel setuptools delocate
- name: Clone dlib
run: |
git clone --depth 1 https://github.com/davisking/dlib.git dlib_src
- name: Build wheel
run: |
cd dlib_src
python setup.py bdist_wheel
if [ ! -f dist/*.whl ]; then
echo "Wheel build failed - no wheel found in dist/"
ls -la dist/ || echo "dist/ directory not found"
exit 1
fi
- name: Repair wheel with delocate
run: |
cd dlib_src
mkdir -p dist_repaired/
# Use delocate to bundle dependencies
delocate-wheel -w dist_repaired/ -v dist/*.whl
echo "Repaired wheels:"
ls -lh dist_repaired/
- name: Set architecture for artifact name
id: arch
run: |
if [ "${{ matrix.os }}" = "macos-13" ]; then
echo "arch=x86_64" >> $GITHUB_OUTPUT
else
echo "arch=arm64" >> $GITHUB_OUTPUT
fi
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: dlib-py${{ matrix.python-version }}-macos-${{ steps.arch.outputs.arch }}
path: dlib_src/dist_repaired/*.whl
retention-days: 30
release:
runs-on: ubuntu-latest
needs: [build-macos]
if: startsWith(github.ref, 'refs/tags/') || github.event.inputs.create_release == 'true'
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
- name: Prepare wheels
run: |
mkdir -p wheels
find artifacts -name "*.whl" -exec cp {} wheels/ \;
echo "Built wheels:"
ls -lh wheels/
# Count wheels by architecture
x86_count=$(find wheels -name "*x86_64*.whl" | wc -l)
arm64_count=$(find wheels -name "*arm64*.whl" | wc -l)
echo "x86_64 (Intel) wheels: $x86_count"
echo "arm64 (Apple Silicon) wheels: $arm64_count"
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ github.event.inputs.create_release == 'true' && format('macOS Manual Release {0}', github.run_number) || github.ref_name }}
tag_name: ${{ github.event.inputs.create_release == 'true' && format('macos-{0}', github.run_number) || github.ref_name }}
body: |
Prebuilt dlib wheels for macOS (Intel x86_64 and Apple Silicon arm64)
**Supported:**
- **Architectures**: x86_64 (Intel), arm64 (Apple Silicon)
- **Python versions**: 3.10, 3.11, 3.12, 3.13
- **macOS versions**: 10.9+ (x86_64), 11.0+ (arm64)
**Installation:**
```bash
pip install dlib-*.whl
```
Choose the wheel that matches your:
- Python version (cp310, cp311, cp312, or cp313)
- Architecture (x86_64 for Intel Macs, arm64 for Apple Silicon)
**System Requirements:**
No additional dependencies needed - wheels are self-contained with bundled libraries.
files: wheels/*.whl
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}