-
Notifications
You must be signed in to change notification settings - Fork 1
178 lines (150 loc) · 5.38 KB
/
build-wheels-seq.yml
File metadata and controls
178 lines (150 loc) · 5.38 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Build and Release dlib Wheels Sequentially
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build-x86_64:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12']
timeout-minutes: 200
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 system dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
build-essential cmake libboost-dev libopenblas-dev liblapack-dev \
libx11-dev libgtk-3-dev libjpeg-dev libpng-dev libtiff-dev \
libatlas-base-dev pkg-config
- name: Install Python build tools
run: |
python -m pip install --upgrade pip
pip install build wheel setuptools auditwheel
- name: Clone dlib
run: |
# Use master branch which has updated pybind11
git clone --depth 1 https://github.com/davisking/dlib.git dlib_src
- name: Build wheel
run: |
cd dlib_src
python setup.py bdist_wheel
# Check if wheel was created
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 (manylinux)
run: |
cd dlib_src
mkdir -p dist_repaired/
# auditwheel may fail on ubuntu-latest, so fallback to copy
auditwheel repair dist/*.whl -w dist_repaired/ || cp dist/*.whl dist_repaired/
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: dlib-py${{ matrix.python-version }}-linux-x86_64
path: dlib_src/dist_repaired/*.whl
retention-days: 30
build-aarch64:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.12']
timeout-minutes: 90
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Build wheel in Docker
run: |
docker run --rm --platform linux/arm64 \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
quay.io/pypa/manylinux2014_aarch64 \
bash -c '
export PYTHON_VERSION=${{ matrix.python-version }}
# Install system dependencies
yum install -y \
cmake3 boost-devel openblas-devel lapack-devel \
libX11-devel gtk3-devel \
libpng-devel libjpeg-devel libtiff-devel git \
gcc gcc-c++ make atlas-devel
# Set up Python based on version
if [ "$PYTHON_VERSION" = "3.11" ]; then
PYBIN=/opt/python/cp311-cp311/bin
elif [ "$PYTHON_VERSION" = "3.12" ]; then
PYBIN=/opt/python/cp312-cp312/bin
else
echo "Unsupported Python version: $PYTHON_VERSION"
exit 1
fi
$PYBIN/pip install --upgrade pip wheel setuptools auditwheel
# Clone dlib master (has updated pybind11 for Python 3.11+)
git clone --depth 1 https://github.com/davisking/dlib.git dlib_src
cd dlib_src
# Build wheel
$PYBIN/python setup.py bdist_wheel
# Create output directory and repair wheel
mkdir -p /workspace/dist_final/
if [ -f dist/*.whl ]; then
$PYBIN/auditwheel repair dist/*.whl -w /workspace/dist_final/
else
echo "No wheel found to repair"
ls -la dist/
exit 1
fi
'
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: dlib-py${{ matrix.python-version }}-linux-aarch64
path: dist_final/*.whl
retention-days: 30
release:
runs-on: ubuntu-latest
needs: [build-x86_64, build-aarch64]
if: startsWith(github.ref, 'refs/tags/')
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/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ github.ref_name }}
body: |
Prebuilt dlib wheels for Linux (x86_64 and aarch64) on Python 3.11 and 3.12
**Installation:**
pip install dlib-*.whl
Choose the wheel that matches your:
- Python version (cp311 or cp312)
- Architecture (x86_64 or aarch64)
files: wheels/*.whl
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}