Skip to content

Commit

Permalink
Move cache dir
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jan 21, 2024
1 parent 4dc0b47 commit 32b6872
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 16 deletions.
4 changes: 1 addition & 3 deletions .ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ if [[ $(uname) != CYGWIN* ]]; then
pushd depends && time ./install_webp.sh && popd

# libimagequant
if [[ "$GHA_LIBIMAGEQUANT_CACHE_HIT" != "true" ]]; then
pushd depends && time ./install_imagequant.sh && popd
fi
pushd depends && time ./install_imagequant.sh && popd

# raqm
pushd depends && time ./install_raqm.sh && popd
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,10 @@ jobs:
uses: actions/cache@v4
id: cache-libimagequant
with:
path: |
/usr/include/libimagequant.h
/usr/lib/libimagequant.so*
path: ~/cache-libimagequant
key: ${{ runner.os }}-libimagequant-${{ hashFiles('depends/install_imagequant.sh') }}
restore-keys: |
${{ runner.os }}-libimagequant-
# restore-keys: |
# ${{ runner.os }}-libimagequant-

- name: Install Linux dependencies
if: startsWith(matrix.os, 'ubuntu')
Expand Down
37 changes: 29 additions & 8 deletions depends/install_imagequant.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
#!/bin/bash
# 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

time cargo install cargo-c
time cargo cinstall --prefix=/usr --destdir=.
sudo cp usr/lib/libimagequant.so* /usr/lib/
sudo cp usr/include/libimagequant.h /usr/include/
# Copy cached files into place
sudo cp ~/cache-$archive_name/libimagequant.so* /usr/lib/
sudo cp ~/cache-$archive_name/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

time cargo install cargo-c
time cargo cinstall --prefix=/usr --destdir=.

# Copy into place
sudo cp usr/lib/libimagequant.so* /usr/lib/
sudo cp usr/include/libimagequant.h /usr/include/

# Copy to cache
mkdir ~/cache-$archive_name
cp usr/lib/libimagequant.so* cache-$archive_name/
cp usr/include/libimagequant.h cache-$archive_name/

popd

fi

0 comments on commit 32b6872

Please sign in to comment.