Skip to content

Bump to v19.24.6 (#13) #69

Bump to v19.24.6 (#13)

Bump to v19.24.6 (#13) #69

Workflow file for this run

name: Build
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
WORKING_DIRECTORY: 'dlib'
BUILD_COMMIT: 'v19.24.6'
DLIB_BIN_VERSION: '19.24.6'
PYTHON_REQUIRES: '>=3.7'
jobs:
build_wheels_matrix:
runs-on: ubuntu-latest
outputs:
include: ${{ steps.set-matrix.outputs.include }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
submodules: true
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: pip install cibuildwheel==2.17.0 # sync version with pypa/cibuildwheel below
- id: set-matrix
env:
CIBW_PROJECT_REQUIRES_PYTHON: '>=3.7' # it is missing in setup.py and needed to determine which wheels to build
run: |
MATRIX_INCLUDE=$(
{
cibuildwheel --print-build-identifiers --platform linux --arch x86_64,aarch64 | grep cp | jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \
&& cibuildwheel --print-build-identifiers --platform macos --arch x86_64 | grep cp | jq -nRc '{"only": inputs, "os": "macos-13"}' \
&& cibuildwheel --print-build-identifiers --platform macos --arch arm64 | grep cp | jq -nRc '{"only": inputs, "os": "macos-14"}' \
&& cibuildwheel --print-build-identifiers --platform windows --arch AMD64 | grep cp | jq -nRc '{"only": inputs, "os": "windows-latest"}'
} | jq -sc
)
echo "include=$MATRIX_INCLUDE" >> $GITHUB_OUTPUT
working-directory: ${{ env.WORKING_DIRECTORY }}
build_wheels:
needs: build_wheels_matrix
runs-on: ${{ matrix.os }}
name: Build ${{ matrix.only }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.build_wheels_matrix.outputs.include) }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.ref }}
submodules: true
- name: Checkout build commit
run: git fetch --all && git checkout $BUILD_COMMIT
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Fix setup.py
run: |
sed -i'' -e "s/name='dlib'/name='dlib-bin'/" setup.py
sed -i'' -e "s/version=read_version_from_cmakelists('dlib\/CMakeLists.txt')/version='$DLIB_BIN_VERSION'/" setup.py
sed -i'' -e "s/url='https:\/\/github\.com\/davisking\/dlib'/url='https:\/\/github\.com\/alesanfra\/dlib-wheels'/" setup.py
sed -i'' -e "s/_cmake_extra_options = \[\]/_cmake_extra_options = \['-DDLIB_NO_GUI_SUPPORT=ON'\]/" setup.py
sed -i'' -e "s/requires = \[\"setuptools\", \"wheel\"\]/requires = \[\"setuptools\", \"wheel\", \"cmake==3.24.0\"\]/" pyproject.toml
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
- uses: pypa/cibuildwheel@v2.17.0 # sync version with pip install cibuildwheel above
with:
only: ${{ matrix.only }}
package-dir: ${{ env.WORKING_DIRECTORY }}
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_BEFORE_BUILD: pip install cmake
CIBW_TEST_COMMAND: python -c "import dlib"
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.only }}
path: wheelhouse/*.whl
upload_pypi:
needs: [build_wheels]
runs-on: ubuntu-latest
# upload to PyPI on master
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
permissions:
id-token: write # pypa/gh-action-pypi-publish
steps:
- uses: actions/download-artifact@v4
with:
path: dist/
pattern: dist-*
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip_existing: true