Skip to content

Commit 1d5a363

Browse files
committed
new: wheels for graceful release
1 parent f172899 commit 1d5a363

File tree

3 files changed

+127
-0
lines changed

3 files changed

+127
-0
lines changed
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
name: Build and Release dlib Wheels Gracefully
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
build_wheels_x86:
11+
name: Build x86_64 wheels
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 120
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Clone dlib
20+
run: |
21+
git clone --depth 1 https://github.com/davisking/dlib.git dlib_src
22+
23+
- name: Build x86_64 wheels
24+
uses: pypa/cibuildwheel@v2.21.0
25+
with:
26+
package-dir: dlib_src
27+
env:
28+
CIBW_BUILD: cp310-* cp311-* cp312-*
29+
CIBW_ARCHS_LINUX: x86_64
30+
CIBW_BEFORE_ALL_LINUX: >
31+
yum install -y cmake3 boost-devel openblas-devel lapack-devel
32+
libX11-devel libpng-devel libjpeg-devel
33+
libtiff-devel atlas-devel gcc gcc-c++ make git
34+
CIBW_ENVIRONMENT: "CXXFLAGS='-O2 -g0'"
35+
36+
- name: Upload x86_64 artifacts
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: wheels-x86_64
40+
path: ./wheelhouse/*.whl
41+
retention-days: 30
42+
43+
build_wheels_aarch64:
44+
name: Build aarch64 wheels
45+
runs-on: ubuntu-latest
46+
timeout-minutes: 180
47+
continue-on-error: true
48+
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
52+
53+
- name: Set up QEMU
54+
uses: docker/setup-qemu-action@v3
55+
with:
56+
platforms: arm64
57+
58+
- name: Clone dlib
59+
run: |
60+
git clone --depth 1 https://github.com/davisking/dlib.git dlib_src
61+
62+
- name: Build aarch64 wheels
63+
uses: pypa/cibuildwheel@v2.21.0
64+
with:
65+
package-dir: dlib_src
66+
env:
67+
CIBW_BUILD: cp310-* cp311-* cp312-*
68+
CIBW_ARCHS_LINUX: aarch64
69+
CIBW_BEFORE_ALL_LINUX: >
70+
yum install -y cmake3 boost-devel openblas-devel
71+
lapack-devel git gcc gcc-c++ make
72+
CIBW_ENVIRONMENT: "CXXFLAGS='-O2 -g0'"
73+
74+
- name: Upload aarch64 artifacts
75+
uses: actions/upload-artifact@v4
76+
if: success()
77+
with:
78+
name: wheels-aarch64
79+
path: ./wheelhouse/*.whl
80+
retention-days: 30
81+
82+
release:
83+
runs-on: ubuntu-latest
84+
needs: [build_wheels_x86, build_wheels_aarch64]
85+
if: always() && startsWith(github.ref, 'refs/tags/') && needs.build_wheels_x86.result == 'success'
86+
permissions:
87+
contents: write
88+
89+
steps:
90+
- name: Download all artifacts
91+
uses: actions/download-artifact@v4
92+
with:
93+
path: artifacts/
94+
95+
- name: Prepare wheels
96+
run: |
97+
mkdir -p wheels
98+
find artifacts -name "*.whl" -exec cp {} wheels/ \;
99+
echo "Built wheels:"
100+
ls -lh wheels/
101+
102+
# Count architectures
103+
x86_count=$(find wheels -name "*x86_64*.whl" | wc -l)
104+
aarch64_count=$(find wheels -name "*aarch64*.whl" | wc -l)
105+
echo "x86_64 wheels: $x86_count"
106+
echo "aarch64 wheels: $aarch64_count"
107+
108+
- name: Create Release
109+
uses: softprops/action-gh-release@v2
110+
with:
111+
name: Release ${{ github.ref_name }}
112+
body: |
113+
Prebuilt dlib wheels for Linux on Python 3.10, 3.11, and 3.12
114+
115+
**Installation:**
116+
```pip install dlib-*.whl```
117+
118+
Choose the wheel that matches your:
119+
- Python version (cp310, cp311, or cp312)
120+
- Architecture (x86_64 or aarch64, if available)
121+
122+
Note: aarch64 wheels may not be available if the build timed out.
123+
files: wheels/*.whl
124+
draft: false
125+
prerelease: false
126+
env:
127+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
File renamed without changes.

0 commit comments

Comments
 (0)