mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 18:26:17 +03:00
Merge pull request #7741 from hugovk/ci-stuff
CI: Cache libimagequant on Linux builds
This commit is contained in:
commit
b82e601a44
12
.github/workflows/docs.yml
vendored
12
.github/workflows/docs.yml
vendored
|
@ -37,16 +37,26 @@ jobs:
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
cache: pip
|
cache: pip
|
||||||
cache-dependency-path: ".ci/*.sh"
|
cache-dependency-path: |
|
||||||
|
".ci/*.sh"
|
||||||
|
"pyproject.toml"
|
||||||
|
|
||||||
- name: Build system information
|
- name: Build system information
|
||||||
run: python3 .github/workflows/system-info.py
|
run: python3 .github/workflows/system-info.py
|
||||||
|
|
||||||
|
- name: Cache libimagequant
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-libimagequant
|
||||||
|
with:
|
||||||
|
path: ~/cache-libimagequant
|
||||||
|
key: ${{ runner.os }}-libimagequant-${{ hashFiles('depends/install_imagequant.sh') }}
|
||||||
|
|
||||||
- name: Install Linux dependencies
|
- name: Install Linux dependencies
|
||||||
run: |
|
run: |
|
||||||
.ci/install.sh
|
.ci/install.sh
|
||||||
env:
|
env:
|
||||||
GHA_PYTHON_VERSION: "3.x"
|
GHA_PYTHON_VERSION: "3.x"
|
||||||
|
GHA_LIBIMAGEQUANT_CACHE_HIT: ${{ steps.cache-libimagequant.outputs.cache-hit }}
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
|
|
16
.github/workflows/test.yml
vendored
16
.github/workflows/test.yml
vendored
|
@ -26,6 +26,9 @@ concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
FORCE_COLOR: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
|
@ -65,17 +68,28 @@ jobs:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
allow-prereleases: true
|
allow-prereleases: true
|
||||||
cache: pip
|
cache: pip
|
||||||
cache-dependency-path: ".ci/*.sh"
|
cache-dependency-path: |
|
||||||
|
".ci/*.sh"
|
||||||
|
"pyproject.toml"
|
||||||
|
|
||||||
- name: Build system information
|
- name: Build system information
|
||||||
run: python3 .github/workflows/system-info.py
|
run: python3 .github/workflows/system-info.py
|
||||||
|
|
||||||
|
- name: Cache libimagequant
|
||||||
|
if: startsWith(matrix.os, 'ubuntu')
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-libimagequant
|
||||||
|
with:
|
||||||
|
path: ~/cache-libimagequant
|
||||||
|
key: ${{ runner.os }}-libimagequant-${{ hashFiles('depends/install_imagequant.sh') }}
|
||||||
|
|
||||||
- name: Install Linux dependencies
|
- name: Install Linux dependencies
|
||||||
if: startsWith(matrix.os, 'ubuntu')
|
if: startsWith(matrix.os, 'ubuntu')
|
||||||
run: |
|
run: |
|
||||||
.ci/install.sh
|
.ci/install.sh
|
||||||
env:
|
env:
|
||||||
GHA_PYTHON_VERSION: ${{ matrix.python-version }}
|
GHA_PYTHON_VERSION: ${{ matrix.python-version }}
|
||||||
|
GHA_LIBIMAGEQUANT_CACHE_HIT: ${{ steps.cache-libimagequant.outputs.cache-hit }}
|
||||||
|
|
||||||
- name: Install macOS dependencies
|
- name: Install macOS dependencies
|
||||||
if: startsWith(matrix.os, 'macOS')
|
if: startsWith(matrix.os, 'macOS')
|
||||||
|
|
|
@ -5,7 +5,7 @@ archive=$1
|
||||||
url=$2
|
url=$2
|
||||||
|
|
||||||
if [ ! -f $archive.tar.gz ]; then
|
if [ ! -f $archive.tar.gz ]; then
|
||||||
wget -O $archive.tar.gz $url
|
wget --no-verbose -O $archive.tar.gz $url
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rmdir $archive
|
rmdir $archive
|
||||||
|
|
|
@ -1,15 +1,39 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# install libimagequant
|
# install libimagequant
|
||||||
|
|
||||||
archive=libimagequant-4.2.2
|
archive_name=libimagequant
|
||||||
|
archive_version=4.2.2
|
||||||
|
|
||||||
./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/main/$archive.tar.gz
|
archive=$archive_name-$archive_version
|
||||||
|
|
||||||
pushd $archive/imagequant-sys
|
if [[ "$GHA_LIBIMAGEQUANT_CACHE_HIT" == "true" ]]; then
|
||||||
|
|
||||||
cargo install cargo-c
|
# Copy cached files into place
|
||||||
cargo cinstall --prefix=/usr --destdir=.
|
sudo cp ~/cache-$archive_name/libimagequant.so* /usr/lib/
|
||||||
sudo cp usr/lib/libimagequant.so* /usr/lib/
|
sudo cp ~/cache-$archive_name/libimagequant.h /usr/include/
|
||||||
sudo cp usr/include/libimagequant.h /usr/include/
|
|
||||||
|
|
||||||
popd
|
else
|
||||||
|
|
||||||
|
# Build from source
|
||||||
|
./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/main/$archive.tar.gz
|
||||||
|
|
||||||
|
pushd $archive/imagequant-sys
|
||||||
|
|
||||||
|
cargo install cargo-c
|
||||||
|
cargo cinstall --prefix=/usr --destdir=.
|
||||||
|
|
||||||
|
# Copy into place
|
||||||
|
sudo cp usr/lib/libimagequant.so* /usr/lib/
|
||||||
|
sudo cp usr/include/libimagequant.h /usr/include/
|
||||||
|
|
||||||
|
if [ -n "$GITHUB_ACTIONS" ]; then
|
||||||
|
# Copy to cache
|
||||||
|
rm -rf ~/cache-$archive_name
|
||||||
|
mkdir ~/cache-$archive_name
|
||||||
|
cp usr/lib/libimagequant.so* ~/cache-$archive_name/
|
||||||
|
cp usr/include/libimagequant.h ~/cache-$archive_name/
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user