diff --git a/.github/workflows/build-cache-deps.yml b/.github/workflows/build-cache-deps.yml index 6e6f9ef1..bdd410b7 100644 --- a/.github/workflows/build-cache-deps.yml +++ b/.github/workflows/build-cache-deps.yml @@ -52,7 +52,9 @@ jobs: CIBW_BUILD_VERBOSITY: 1 - name: Checking built wheels - run: twine check wheelhouse/* + run: | + pip install "twine>=6.1.0" "packaging>=24.2" + twine check wheelhouse/* - name: Uploading wheels uses: actions/upload-artifact@v3 @@ -99,7 +101,9 @@ jobs: CIBW_BUILD_VERBOSITY: 1 - name: Checking built wheels - run: twine check wheelhouse/* + run: | + pip install "twine>=6.1.0" "packaging>=24.2" + twine check wheelhouse/* - name: Uploading wheels uses: actions/upload-artifact@v3 @@ -152,7 +156,9 @@ jobs: CIBW_BUILD_VERBOSITY: 1 - name: Checking built wheels - run: twine check wheelhouse/* + run: | + pip install "twine>=6.1.0" "packaging>=24.2" + twine check wheelhouse/* - name: Uploading wheels uses: actions/upload-artifact@v3 @@ -205,7 +211,9 @@ jobs: CIBW_BUILD_VERBOSITY: 1 - name: Checking built wheels - run: twine check wheelhouse/* + run: | + pip install "twine>=6.1.0" "packaging>=24.2" + twine check wheelhouse/* - name: Uploading wheels uses: actions/upload-artifact@v3 diff --git a/.github/workflows/wheels-pi_heif.yml b/.github/workflows/wheels-pi_heif.yml index fb57ad8f..91e28e07 100644 --- a/.github/workflows/wheels-pi_heif.yml +++ b/.github/workflows/wheels-pi_heif.yml @@ -138,17 +138,16 @@ jobs: path: wheelhouse/*.whl if-no-files-found: error - wheels_linux_cpython: + wheels_linux_cpython_amd64: strategy: fail-fast: true matrix: cibw_buildlinux: [ manylinux, musllinux ] - cibw_arch: [ "aarch64", "x86_64" ] - name: ${{ matrix.cibw_buildlinux }} • ${{ matrix.cibw_arch }} • CPython - runs-on: ubuntu-20.04 + name: ${{ matrix.cibw_buildlinux }} • AMD64 • CPython + runs-on: ubuntu-24.04 env: BUILD_DIR: "/tmp/ph_build_stuff" - KEY_HEAD: Pi-Heif-${{ matrix.cibw_arch }}-${{ matrix.cibw_buildlinux }} + KEY_HEAD: Pi-Heif-x86_64-${{ matrix.cibw_buildlinux }} steps: - uses: actions/checkout@v4 @@ -157,11 +156,64 @@ jobs: cp -r -v ./pi-heif/* . python3 .github/transform_to-pi_heif.py - - name: Set up QEMU - if: matrix.cibw_arch == 'aarch64' - uses: docker/setup-qemu-action@v3 + - name: musllinux preparations + if: matrix.cibw_buildlinux == 'musllinux' + run: echo INSTALL_OS_PACKAGES="apk update && apk --no-cache add $OS_PACKAGES" >> $GITHUB_ENV + env: + OS_PACKAGES: "fribidi-dev harfbuzz-dev jpeg-dev lcms2-dev openjpeg-dev" + + - uses: actions/cache@v4 with: - platforms: arm64 + path: ${{ env.BUILD_DIR }} + key: ${{ env.KEY_HEAD }}-${{ env.KEY_C_BUILD }}-${{ env.KEY_LINUX_LIBS }} + env: + KEY_LINUX_LIBS: ${{ hashFiles('libheif/linux/**') }} + KEY_C_BUILD: ${{ hashFiles('libheif/linux_*.py') }}-${{ hashFiles('libheif/setup.py') }} + + - name: Run cibuildwheel + run: | + python3 -m pip install cibuildwheel==2.21.3 + python3 -m cibuildwheel + env: + CIBW_BUILD: ${{ format('cp3*-{0}_{1}', matrix.cibw_buildlinux, x86_64) }} + CIBW_ARCHS: "x86_64" + CIBW_BEFORE_ALL_LINUX: | + ${{ env.INSTALL_OS_PACKAGES }} + python3 {package}/libheif/linux_build_libs.py + CIBW_ENVIRONMENT_LINUX: BUILD_DIR=/host${{ env.BUILD_DIR }} PH_LIGHT_ACTION=1 + + - name: Checking built wheels + run: | + python3 -m pip install twine + python3 -m twine check wheelhouse/* + + - name: Uploading wheels + uses: actions/upload-artifact@v3 + with: + name: wheels_pi_heif + path: wheelhouse/*.whl + if-no-files-found: error + + - name: Fix cache permissions + run: sudo chmod -R 777 ${{ env.BUILD_DIR }} + + wheels_linux_cpython_arm64: + strategy: + fail-fast: true + matrix: + cibw_buildlinux: [ manylinux, musllinux ] + name: ${{ matrix.cibw_buildlinux }} • ARM64 • CPython + runs-on: ubuntu-24.04-arm + env: + BUILD_DIR: "/tmp/ph_build_stuff" + KEY_HEAD: Pi-Heif-aarch64-${{ matrix.cibw_buildlinux }} + + steps: + - uses: actions/checkout@v4 + - name: Transform to Pi-Heif + run: | + cp -r -v ./pi-heif/* . + python3 .github/transform_to-pi_heif.py - name: musllinux preparations if: matrix.cibw_buildlinux == 'musllinux' @@ -182,8 +234,8 @@ jobs: python3 -m pip install cibuildwheel==2.21.3 python3 -m cibuildwheel env: - CIBW_BUILD: ${{ format('cp3*-{0}_{1}', matrix.cibw_buildlinux, matrix.cibw_arch) }} - CIBW_ARCHS: ${{ matrix.cibw_arch }} + CIBW_BUILD: ${{ format('cp3*-{0}_{1}', matrix.cibw_buildlinux, aarch64) }} + CIBW_ARCHS: "aarch64" CIBW_BEFORE_ALL_LINUX: | ${{ env.INSTALL_OS_PACKAGES }} python3 {package}/libheif/linux_build_libs.py @@ -204,17 +256,16 @@ jobs: - name: Fix cache permissions run: sudo chmod -R 777 ${{ env.BUILD_DIR }} - wheels_linux_pypy: + wheels_linux_pypy_amd64: strategy: fail-fast: true matrix: cibw_buildlinux: [ manylinux ] - cibw_arch: [ "aarch64", "x86_64" ] - name: ${{ matrix.cibw_buildlinux }} • ${{ matrix.cibw_arch }} • PyPy - runs-on: ubuntu-20.04 + name: ${{ matrix.cibw_buildlinux }} • AMD64 • PyPy + runs-on: ubuntu-24.04 env: BUILD_DIR: "/tmp/ph_build_stuff" - KEY_HEAD: Pi-Heif-${{ matrix.cibw_arch }}-${{ matrix.cibw_buildlinux }} + KEY_HEAD: Pi-Heif-x86_64-${{ matrix.cibw_buildlinux }} steps: - uses: actions/checkout@v4 @@ -223,11 +274,58 @@ jobs: cp -r -v ./pi-heif/* . python3 .github/transform_to-pi_heif.py - - name: Set up QEMU - if: matrix.cibw_arch == 'aarch64' - uses: docker/setup-qemu-action@v3 + - uses: actions/cache@v4 with: - platforms: arm64 + path: ${{ env.BUILD_DIR }} + key: ${{ env.KEY_HEAD }}-${{ env.KEY_C_BUILD }}-${{ env.KEY_LINUX_LIBS }} + env: + KEY_LINUX_LIBS: ${{ hashFiles('libheif/linux/**') }} + KEY_C_BUILD: ${{ hashFiles('libheif/linux_*.py') }}-${{ hashFiles('libheif/setup.py') }} + + - name: Run cibuildwheel + run: | + python3 -m pip install cibuildwheel==2.21.3 + python3 -m cibuildwheel + env: + CIBW_BUILD: ${{ format('pp3*-{0}_{1}', matrix.cibw_buildlinux, x86_64) }} + CIBW_ARCHS: "x86_64" + CIBW_BEFORE_ALL_LINUX: | + yum makecache && yum install -y libjpeg-turbo-devel lcms2-devel + python3 {package}/libheif/linux_build_libs.py + CIBW_ENVIRONMENT_LINUX: BUILD_DIR=/host${{ env.BUILD_DIR }} PH_LIGHT_ACTION=1 + + - name: Checking built wheels + run: | + python3 -m pip install twine + python3 -m twine check wheelhouse/* + + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels_pi_heif + path: wheelhouse/*.whl + if-no-files-found: error + + - name: Fix cache permissions + run: sudo chmod -R 777 ${{ env.BUILD_DIR }} + + wheels_linux_pypy_arm64: + strategy: + fail-fast: true + matrix: + cibw_buildlinux: [ manylinux ] + name: ${{ matrix.cibw_buildlinux }} • ARM64 • PyPy + runs-on: ubuntu-24.04 + env: + BUILD_DIR: "/tmp/ph_build_stuff" + KEY_HEAD: Pi-Heif-aarch64-${{ matrix.cibw_buildlinux }} + + steps: + - uses: actions/checkout@v4 + - name: Transform to Pi-Heif + run: | + cp -r -v ./pi-heif/* . + python3 .github/transform_to-pi_heif.py - uses: actions/cache@v4 with: @@ -242,8 +340,8 @@ jobs: python3 -m pip install cibuildwheel==2.21.3 python3 -m cibuildwheel env: - CIBW_BUILD: ${{ format('pp3*-{0}_{1}', matrix.cibw_buildlinux, matrix.cibw_arch) }} - CIBW_ARCHS: ${{ matrix.cibw_arch }} + CIBW_BUILD: ${{ format('pp3*-{0}_{1}', matrix.cibw_buildlinux, aarch64) }} + CIBW_ARCHS: "aarch64" CIBW_BEFORE_ALL_LINUX: | yum makecache && yum install -y libjpeg-turbo-devel lcms2-devel python3 {package}/libheif/linux_build_libs.py diff --git a/.github/workflows/wheels-pillow_heif.yml b/.github/workflows/wheels-pillow_heif.yml index ce19fadc..76b5e34b 100644 --- a/.github/workflows/wheels-pillow_heif.yml +++ b/.github/workflows/wheels-pillow_heif.yml @@ -163,7 +163,7 @@ jobs: python3 -m pip install cibuildwheel==2.21.3 python3 -m cibuildwheel env: - CIBW_BUILD: ${{ format('cp3*-{0}_{1}', matrix.cibw_buildlinux, "x86_64") }} + CIBW_BUILD: ${{ format('cp3*-{0}_{1}', matrix.cibw_buildlinux, x86_64) }} CIBW_ARCHS: "x86_64" CIBW_BEFORE_ALL_LINUX: | ${{ env.INSTALL_OS_PACKAGES }} @@ -223,7 +223,7 @@ jobs: python3 -m pip install cibuildwheel==2.21.3 python3 -m cibuildwheel env: - CIBW_BUILD: ${{ format('cp3*-{0}_{1}', matrix.cibw_buildlinux, "aarch64") }} + CIBW_BUILD: ${{ format('cp3*-{0}_{1}', matrix.cibw_buildlinux, aarch64) }} CIBW_ARCHS: "aarch64" CIBW_BEFORE_ALL_LINUX: | ${{ env.INSTALL_OS_PACKAGES }} @@ -271,7 +271,7 @@ jobs: python3 -m pip install cibuildwheel==2.21.3 python3 -m cibuildwheel env: - CIBW_BUILD: ${{ format('pp3*-{0}_{1}', matrix.cibw_buildlinux, "x86_64") }} + CIBW_BUILD: ${{ format('pp3*-{0}_{1}', matrix.cibw_buildlinux, x86_64) }} CIBW_ARCHS: "x86_64" CIBW_BEFORE_ALL_LINUX: | yum makecache && yum install -y libjpeg-turbo-devel lcms2-devel @@ -320,7 +320,7 @@ jobs: python3 -m pip install cibuildwheel==2.21.3 python3 -m cibuildwheel env: - CIBW_BUILD: ${{ format('pp3*-{0}_{1}', matrix.cibw_buildlinux, "aarch64") }} + CIBW_BUILD: ${{ format('pp3*-{0}_{1}', matrix.cibw_buildlinux, aarch64) }} CIBW_ARCHS: "aarch64" CIBW_BEFORE_ALL_LINUX: | yum makecache && yum install -y libjpeg-turbo-devel lcms2-devel diff --git a/libheif/linux_build_libs.py b/libheif/linux_build_libs.py index 617a3b11..7e68225e 100644 --- a/libheif/linux_build_libs.py +++ b/libheif/linux_build_libs.py @@ -6,7 +6,7 @@ from re import IGNORECASE, MULTILINE, match, search from subprocess import DEVNULL, PIPE, STDOUT, CalledProcessError, TimeoutExpired, run -# 0 +# 1 BUILD_DIR = environ.get("BUILD_DIR", "/tmp/ph_build_stuff") INSTALL_DIR_LIBS = environ.get("INSTALL_DIR_LIBS", "/usr") PH_LIGHT_VERSION = sys.maxsize <= 2**32 or getenv("PH_LIGHT_ACTION", "0") != "0" diff --git a/setup.cfg b/setup.cfg index 10860169..b8549bbf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -64,3 +64,4 @@ dev = pre-commit pylint coverage + setuptools