Build and Release dlib Wheels v2 #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release dlib Wheels | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| build_wheels: | |
| name: Build wheels | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 180 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: arm64 | |
| - name: Clone dlib | |
| run: | | |
| git clone --depth 1 https://github.com/davisking/dlib.git dlib_src | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v2.21.0 | |
| with: | |
| package-dir: dlib_src | |
| env: | |
| CIBW_BUILD: cp311-* cp312-* | |
| CIBW_ARCHS_LINUX: x86_64 aarch64 | |
| CIBW_BEFORE_ALL_LINUX: > | |
| yum install -y cmake3 boost-devel openblas-devel lapack-devel | |
| libX11-devel gtk3-devel libpng-devel libjpeg-devel | |
| libtiff-devel atlas-devel gcc gcc-c++ make || | |
| apt-get update && apt-get install -y cmake libboost-dev | |
| libopenblas-dev liblapack-dev libx11-dev libgtk-3-dev | |
| libjpeg-dev libpng-dev libtiff-dev libatlas-base-dev | |
| CIBW_ENVIRONMENT: "CXXFLAGS='-O2 -g0'" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels | |
| path: ./wheelhouse/*.whl | |
| retention-days: 30 | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: [build_wheels] | |
| 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 }} |