Skip to content

Commit

Permalink
v0.10.0 (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigcat88 authored Feb 21, 2023
1 parent fa075a2 commit c3f5d2a
Show file tree
Hide file tree
Showing 145 changed files with 3,598 additions and 3,344 deletions.
7 changes: 4 additions & 3 deletions .github/transform_to-pi_heif.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
if __name__ == "__main__":
# change `pillow_heif` to `pi_heif`
files_list = [
"libheif/build.py",
"setup.py",
"docker/manylinux_armv7l_wheel.Dockerfile",
"docker/musllinux_armv7l_wheel.Dockerfile",
"docker/manylinux_armv7l_wheels.Dockerfile",
"docker/musllinux_armv7l_wheels.Dockerfile",
"docker/test_wheels.Dockerfile",
"MANIFEST.in",
"pillow_heif/_pillow_heif.c",
]
for dir_name in ("pillow_heif", "tests"):
for x in os.listdir(dir_name):
Expand All @@ -29,4 +29,5 @@
with open(file_name + DEV_NAME_ADD, "w") as file:
file.write(modified_data)

os.rename("pillow_heif/_pillow_heif.c", "pillow_heif/_pi_heif.c")
os.rename("pillow_heif", "pi_heif")
8 changes: 6 additions & 2 deletions .github/workflows/analysis-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ jobs:
with:
python-version: '3.10'

# to remove `brew uninstall --force --ignore-dependencies imagemagick libheif` when libheif will be updated.
# https://github.com/strukturag/libheif/issues/788
- name: Install from source
run: |
brew uninstall --force --ignore-dependencies imagemagick libheif
brew install --formula ./libheif/macos/libheif.rb
python3 -m pip install opencv-python coverage
python3 -m pip -v install ".[tests]"
Expand Down Expand Up @@ -196,7 +200,7 @@ jobs:
- name: Install from source
run: |
sudo -H python3 -m pip install pillow==9.0.1 cffi==1.15.1 pytest defusedxml packaging numpy coverage
sudo -H python3 -m pip install pillow==9.0.1 pytest defusedxml packaging numpy coverage
sudo -H PH_LIGHT_ACTION=1 python3 -m pip -v install --no-build-isolation .
- name: LibHeif info
Expand Down Expand Up @@ -242,7 +246,7 @@ jobs:
- name: Install from source
run: |
sudo -H python3 -m pip install pillow==9.1.1 cffi==1.15.1 pytest defusedxml packaging numpy
sudo -H python3 -m pip install pillow==9.1.1 pytest defusedxml packaging numpy
sudo -H PH_LIGHT_ACTION=1 python3 -m pip -v install --no-build-isolation .
- name: LibHeif info
Expand Down
148 changes: 137 additions & 11 deletions .github/workflows/build-cache-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ on:
push:
branches: [master]
paths:
- '.github/workflows/build-cache-deps.yml'
- 'docker/*_armv7l_wheels.Dockerfile'
- 'libheif/linux/**'
- 'libheif/linux_*.py'
- 'libheif/build.py'
- 'libheif/public_api.h'
- 'setup.py'
schedule:
- cron: '59 23 * * 5' # Every Friday at 23:59 (GMT+2)
workflow_dispatch:
Expand All @@ -27,7 +28,7 @@ jobs:
runs-on: ubuntu-20.04
env:
KEY_HEAD: ${{ matrix.cibw_arch }}-${{ matrix.cibw_buildlinux }}
BUILD_DIR_PREFIX: "/tmp/pillow_heif"
BUILD_DIR: "/tmp/ph_build_stuff"

steps:
- uses: actions/checkout@v3
Expand All @@ -38,7 +39,7 @@ jobs:
platforms: arm64

- name: Install cibuildwheel & twine
run: python3 -m pip install cibuildwheel==2.11.4 twine
run: python3 -m pip install twine cibuildwheel==2.11.4

- name: 32-bit musllinux preparations
if: matrix.cibw_buildlinux == 'musllinux' && matrix.cibw_arch == 'i686'
Expand All @@ -48,32 +49,157 @@ jobs:

- uses: actions/cache@v3
with:
path: ${{ env.BUILD_DIR_PREFIX }}/build-stuff
key: ${{ env.KEY_HEAD }}-${{ env.KEY_CFFI_BUILD }}-${{ env.KEY_LINUX_LIBS }}
path: ${{ env.BUILD_DIR }}
key: ${{ env.KEY_HEAD }}-${{ env.KEY_C_BUILD }}-${{ env.KEY_LINUX_LIBS }}
env:
KEY_LINUX_LIBS: ${{ hashFiles('libheif/linux_*.py') }}-${{ hashFiles('libheif/linux/**') }}
KEY_CFFI_BUILD: ${{ hashFiles('libheif/build.py') }}-${{ hashFiles('libheif/public_api.h') }}
KEY_LINUX_LIBS: ${{ hashFiles('libheif/linux/**') }}
KEY_C_BUILD: ${{ hashFiles('libheif/linux_*.py') }}-${{ hashFiles('libheif/setup.py') }}

- name: Start test build
run: cibuildwheel
env:
CIBW_BUILD: ${{ format('cp38-{0}*', matrix.cibw_buildlinux) }}
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_BEFORE_ALL_LINUX: ${{ env.INSTALL_OS_PACKAGES }}
CIBW_ENVIRONMENT_LINUX: BUILD_DIR_PREFIX=/host${{ env.BUILD_DIR_PREFIX }}
CIBW_ENVIRONMENT_LINUX: BUILD_DIR=/host${{ env.BUILD_DIR }}
CIBW_TEST_COMMAND: "python3 -c 'import pillow_heif; print(pillow_heif.libheif_info())'"
CIBW_TEST_EXTRAS: ""
CIBW_BUILD_VERBOSITY: 1

- name: Checking built wheels
run: twine check wheelhouse/*

- name: Uploading wheel
- name: Uploading wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/*.whl
if-no-files-found: error

- name: Fix cache permissions
run: sudo chmod -R 777 ${{ env.BUILD_DIR_PREFIX }}
run: sudo chmod -R 777 ${{ env.BUILD_DIR }}

pi_heif_dependencies_linux:
strategy:
fail-fast: true
matrix:
cibw_buildlinux: [ manylinux, musllinux ]
cibw_arch: [ "aarch64", "i686", "x86_64" ]
name: Pi-Heif • ${{ matrix.cibw_arch }} • ${{ matrix.cibw_buildlinux }}
runs-on: ubuntu-20.04
env:
KEY_HEAD: Pi-Heif-${{ matrix.cibw_arch }}-${{ matrix.cibw_buildlinux }}
BUILD_DIR: "/tmp/ph_build_stuff"

steps:
- uses: actions/checkout@v3
- name: Transform to Pi-Heif
run: |
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@v2
with:
platforms: arm64

- name: Install cibuildwheel & twine
run: python3 -m pip install twine cibuildwheel==2.11.4

- name: 32-bit musllinux preparations
if: matrix.cibw_buildlinux == 'musllinux' && matrix.cibw_arch == 'i686'
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@v3
with:
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: Start test build
run: cibuildwheel
env:
CIBW_BUILD: ${{ format('cp38-{0}*', matrix.cibw_buildlinux) }}
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_BEFORE_ALL_LINUX: ${{ env.INSTALL_OS_PACKAGES }}
CIBW_ENVIRONMENT_LINUX: BUILD_DIR=/host${{ env.BUILD_DIR }} PH_LIGHT_ACTION=1
CIBW_TEST_COMMAND: "python3 -c 'import pi_heif; print(pi_heif.libheif_info())'"
CIBW_TEST_EXTRAS: ""
CIBW_BUILD_VERBOSITY: 1

- name: Checking built wheels
run: twine check wheelhouse/*

- name: Uploading wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/*.whl
if-no-files-found: error

- name: Fix cache permissions
run: sudo chmod -R 777 ${{ env.BUILD_DIR }}

pi_heif_dependencies_linux_armv7:
strategy:
fail-fast: true
matrix:
i: [
{ "docker_file": "manylinux_armv7l_wheels", "name": "manylinux" },
{ "docker_file": "musllinux_armv7l_wheels", "name": "musllinux" },
]
v: ["3.8"]
name: Pi-Heif • ARMv7l • ${{ matrix.i['name'] }}
runs-on: ubuntu-20.04
env:
KEY_HEAD: Pi-Heif-ARMv7l-${{ matrix.i['name'] }}
BUILD_DIR: "./build_cache"

steps:
- uses: actions/checkout@v3
- name: Transform to Pi-Heif
run: |
cp -r -v ./pi-heif/* .
python3 .github/transform_to-pi_heif.py
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- uses: actions/cache@v3
with:
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: Build Pi-Heif
uses: docker/build-push-action@v4
with:
context: .
file: docker/${{ matrix.i['docker_file'] }}.Dockerfile
build-args: |
PY_VERSION=${{ matrix.v }}
platforms: linux/arm/v7
push: false
outputs: type=local,dest=./

- name: Checking built wheels
run: |
python3 -m pip install twine
python3 -m twine check ./repaired_dist/*
- name: Uploading wheels
uses: actions/upload-artifact@v3
with:
name: wheels_pi_heif
path: ./repaired_dist/*.whl
if-no-files-found: error

- name: Fix cache permissions
run: sudo chmod -R 777 ${{ env.BUILD_DIR }}
29 changes: 25 additions & 4 deletions .github/workflows/test-src-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,19 @@ on:
- 'docker/from_src/*.Dockerfile'
- 'libheif/linux/**'
- 'libheif/linux_*.py'
- 'libheif/build.py'
- 'libheif/public_api.h'
- 'setup.*'
- 'pyproject.toml'
- 'pillow_heif/_pillow_heif.c'
push:
branches: [master]
paths:
- '.github/workflows/test-src-build-linux.yml'
- 'docker/from_src/*.Dockerfile'
- 'libheif/linux/**'
- 'libheif/linux_*.py'
- 'libheif/build.py'
- 'libheif/public_api.h'
- 'setup.*'
- 'pyproject.toml'
- 'pillow_heif/_pillow_heif.c'

concurrency:
group: src_linux-${{ github.ref }}
Expand All @@ -35,6 +33,7 @@ jobs:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
arch: ["amd64", "arm64", "arm/v7"]
docker_file: ["Alpine_3_15", "Alpine_3_17", "Debian_11", "Ubuntu_22_04"]
Expand Down Expand Up @@ -67,3 +66,25 @@ jobs:
push: false
cache-from: type=gha,scope=${{ matrix.docker_file }}-${{ matrix.arch }}
target: build_test

ubuntu_22:
name: LibHeif==1.12.0
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Install LibHeif from default repo
run: sudo apt -y install libheif-dev

- name: Install from source
run: python3 -m pip -v install ".[dev]"

- name: LibHeif info
run: python3 -c "import pillow_heif; print(pillow_heif.libheif_info())"

- name: Run Tests
run: python3 -m pytest -rs
10 changes: 4 additions & 6 deletions .github/workflows/test-src-build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,21 @@ on:
paths:
- '.github/workflows/test-src-build-macos.yml'
- 'libheif/macos/**'
- 'libheif/build.py'
- 'libheif/public_api.h'
- 'setup.*'
- 'pyproject.toml'
- 'pi-heif/libheif/macos/**'
- 'pi-heif/setup.cfg'
- 'pillow_heif/_pillow_heif.c'
push:
branches: [master]
paths:
- '.github/workflows/test-src-build-macos.yml'
- 'libheif/macos/**'
- 'libheif/build.py'
- 'libheif/public_api.h'
- 'setup.*'
- 'pyproject.toml'
- 'pi-heif/libheif/macos/**'
- 'pi-heif/setup.cfg'
- 'pillow_heif/_pillow_heif.c'

concurrency:
group: src_macos-${{ github.ref }}
Expand All @@ -42,7 +40,7 @@ jobs:
- uses: actions/checkout@v3
- name: Install libheif from formula
run: |
brew uninstall --force --ignore-dependencies imagemagick
brew uninstall --force --ignore-dependencies imagemagick libheif
brew install --formula ./libheif/macos/libheif.rb
- name: Installing Pillow-Heif
Expand Down Expand Up @@ -71,7 +69,7 @@ jobs:
- name: Install libheif from formula
run: |
brew uninstall --force --ignore-dependencies imagemagick x265 aom
brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom
brew install --formula ./libheif/macos/libheif.rb
- name: Installing Pi-Heif
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-src-build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ on:
paths:
- '.github/workflows/test-src-build-windows.yml'
- 'libheif/windows/**'
- 'libheif/build.py'
- 'libheif/public_api.h'
- 'libheif/heif.h'
- 'setup.*'
- 'pyproject.toml'
- 'pi-heif/libheif/windows/**'
- 'pi-heif/setup.cfg'
- 'pillow_heif/_pillow_heif.c'
push:
branches: [master]
paths:
- '.github/workflows/test-src-build-windows.yml'
- 'libheif/windows/**'
- 'libheif/build.py'
- 'libheif/public_api.h'
- 'libheif/heif.h'
- 'setup.*'
- 'pyproject.toml'
- 'pi-heif/libheif/windows/**'
- 'pi-heif/setup.cfg'
- 'pillow_heif/_pillow_heif.c'

concurrency:
group: src_windows-${{ github.ref }}
Expand Down
Loading

0 comments on commit c3f5d2a

Please sign in to comment.