Skip to content

Commit 65e8434

Browse files
committed
add: cibuildwheel
1 parent a89a19b commit 65e8434

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

.github/workflows/buildv2.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Build and Release dlib Wheels
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
build_wheels:
11+
name: Build wheels
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 180
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up QEMU
20+
uses: docker/setup-qemu-action@v3
21+
with:
22+
platforms: arm64
23+
24+
- name: Clone dlib
25+
run: |
26+
git clone --depth 1 https://github.com/davisking/dlib.git dlib_src
27+
28+
- name: Build wheels
29+
uses: pypa/cibuildwheel@v2.21.0
30+
with:
31+
package-dir: dlib_src
32+
env:
33+
CIBW_BUILD: cp311-* cp312-*
34+
CIBW_ARCHS_LINUX: x86_64 aarch64
35+
CIBW_BEFORE_ALL_LINUX: >
36+
yum install -y cmake3 boost-devel openblas-devel lapack-devel
37+
libX11-devel gtk3-devel libpng-devel libjpeg-devel
38+
libtiff-devel atlas-devel gcc gcc-c++ make ||
39+
apt-get update && apt-get install -y cmake libboost-dev
40+
libopenblas-dev liblapack-dev libx11-dev libgtk-3-dev
41+
libjpeg-dev libpng-dev libtiff-dev libatlas-base-dev
42+
CIBW_ENVIRONMENT: "CXXFLAGS='-O2 -g0'"
43+
44+
- name: Upload artifacts
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: wheels
48+
path: ./wheelhouse/*.whl
49+
retention-days: 30
50+
51+
release:
52+
runs-on: ubuntu-latest
53+
needs: [build_wheels]
54+
if: startsWith(github.ref, 'refs/tags/')
55+
permissions:
56+
contents: write
57+
58+
steps:
59+
- name: Download all artifacts
60+
uses: actions/download-artifact@v4
61+
with:
62+
path: artifacts/
63+
64+
- name: Prepare wheels
65+
run: |
66+
mkdir -p wheels
67+
find artifacts -name "*.whl" -exec cp {} wheels/ \;
68+
echo "Built wheels:"
69+
ls -lh wheels/
70+
71+
- name: Create Release
72+
uses: softprops/action-gh-release@v2
73+
with:
74+
name: Release ${{ github.ref_name }}
75+
body: |
76+
Prebuilt dlib wheels for Linux (x86_64 and aarch64) on Python 3.11 and 3.12
77+
78+
**Installation:**
79+
pip install dlib-*.whl
80+
81+
Choose the wheel that matches your:
82+
- Python version (cp311 or cp312)
83+
- Architecture (x86_64 or aarch64)
84+
files: wheels/*.whl
85+
draft: false
86+
prerelease: false
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)