From 04e1e50b7234e182fe166de124a5829d2aad8fb9 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Fri, 12 Aug 2022 21:41:30 +0300 Subject: [PATCH] CI & CD: macos and windows install from src --- .github/workflows/test-src-build-macos.yml | 44 +++++++++++++ .github/workflows/test-src-build-windows.yml | 67 ++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 .github/workflows/test-src-build-macos.yml create mode 100644 .github/workflows/test-src-build-windows.yml diff --git a/.github/workflows/test-src-build-macos.yml b/.github/workflows/test-src-build-macos.yml new file mode 100644 index 00000000..6721e485 --- /dev/null +++ b/.github/workflows/test-src-build-macos.yml @@ -0,0 +1,44 @@ +name: Build from source(macOS) + +on: + workflow_dispatch: + pull_request: + branches: [master] + types: [opened, reopened, edited] + paths: + - 'libheif/macos/**' + - 'libheif/build.py' + - 'libheif/heif.h' + - 'setup.*' + - 'pyproject.toml' + push: + branches: [master] + paths: + - 'libheif/macos/**' + - 'libheif/build.py' + - 'libheif/heif.h' + - 'setup.*' + - 'pyproject.toml' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + macos_11: + name: macOS:11-x86_64 + runs-on: macos-11 + + steps: + - uses: actions/checkout@v3 + + - name: Install brew + run: | + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + brew install --formula ./libheif/macos/libheif.rb + + - name: Installing Pillow-Heif + run: python3 -m pip -v install ".[dev]" + + - name: Perform tests + run: python3 -m pytest -s diff --git a/.github/workflows/test-src-build-windows.yml b/.github/workflows/test-src-build-windows.yml new file mode 100644 index 00000000..0f8997a5 --- /dev/null +++ b/.github/workflows/test-src-build-windows.yml @@ -0,0 +1,67 @@ +name: Build from source(Windows) + +on: + workflow_dispatch: + pull_request: + branches: [master] + types: [opened, reopened, edited] + paths: + - 'libheif/windows/**' + - 'libheif/build.py' + - 'libheif/heif.h' + - 'setup.*' + - 'pyproject.toml' + push: + branches: [master] + paths: + - 'libheif/windows/**' + - 'libheif/build.py' + - 'libheif/heif.h' + - 'setup.*' + - 'pyproject.toml' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + windows_2019: + name: Windows:2019-x86_64 + runs-on: windows-2019 + env: + VCPKG_PREFIX: "C:/temp/msys64/mingw64" + + steps: + - uses: actions/checkout@v3 + + - uses: msys2/setup-msys2@v2 + with: + location: C:/temp + update: true + install: >- + patch + mingw-w64-x86_64-binutils + + - name: Build libheif and dependencies + shell: msys2 {0} + run: | + cd libheif/windows/mingw-w64-libheif + makepkg-mingw --syncdeps --noconfirm -f + pacman -U mingw-w64-x86_64-libheif-1.12.0-9-any.pkg.tar.zst --noconfirm + + - name: Installing Pillow-Heif + run: python -m pip -v install ".[dev]" + + - name: Copy DLLs from MSYS2 + run: | + $site_packages=(python -c 'import sysconfig; print(sysconfig.get_paths()[\"platlib\"])') + cp ${{ env.VCPKG_PREFIX }}/bin/libheif.dll $site_packages/ + cp ${{ env.VCPKG_PREFIX }}/bin/libde265-0.dll $site_packages/ + cp ${{ env.VCPKG_PREFIX }}/bin/libx265.dll $site_packages/ + cp ${{ env.VCPKG_PREFIX }}/bin/libaom.dll $site_packages/ + cp ${{ env.VCPKG_PREFIX }}/bin/libwinpthread-1.dll $site_packages/ + cp ${{ env.VCPKG_PREFIX }}/bin/libgcc_s_seh-1.dll $site_packages/ + cp ${{ env.VCPKG_PREFIX }}/bin/libstdc++-6.dll $site_packages/ + + - name: Perform tests + run: python -m pytest -s