fix #54
This file contains 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 | ||
on: | ||
push: | ||
workflow_dispatch: | ||
pull_request_target: | ||
types: [assigned, opened, synchronize, reopened] | ||
env: | ||
WORKING_DIRECTORY: 'dlib' | ||
BUILD_COMMIT: 'v19.24.4' | ||
DLIB_BIN_VERSION: '19.24.4' | ||
CIBW_PROJECT_REQUIRES_PYTHON: '>=3.8' | ||
CIBUILDWHEEL_VERSION: '2.17.0' | ||
jobs: | ||
build_wheels_matrix: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
include: ${{ steps.set-matrix.outputs.include }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
- name: Install cibuildwheel | ||
run: pip install cibuildwheel==$CIBUILDWHEEL_VERSION | ||
- id: set-matrix | ||
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: | ||
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 | ||
working-directory: ${{ env.WORKING_DIRECTORY }} | ||
- name: Set up QEMU | ||
if: runner.os == 'Linux' | ||
uses: docker/setup-qemu-action@v3 | ||
- uses: pypa/cibuildwheel@v${{ env.CIBUILDWHEEL_VERSION }} # sync version with pip install cibuildwheel above | ||
Check failure on line 81 in .github/workflows/build.yaml GitHub Actions / BuildInvalid workflow file
|
||
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 |