Skip to content

Commit bd31299

Browse files
committed
Fix ImageMagick caching: cache Homebrew downloads instead of Cellar
The previous approach of caching /opt/homebrew/Cellar/imagemagick failed because it didn't include ImageMagick's dependencies (like liblqr). New approach: - macOS: Cache Homebrew downloads directory - Speeds up downloads but lets brew handle proper installation + linking - brew automatically manages dependencies correctly - Linux: Keep apt archives cache - Works well since apt handles dependencies properly This is simpler, more reliable, and still provides significant speedup by avoiding re-downloading packages.
1 parent 0b2a4dd commit bd31299

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

.github/actions/setup-cmux/action.yml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,16 @@ runs:
2929
restore-keys: |
3030
${{ runner.os }}-bun-cache-
3131
32-
- name: Cache ImageMagick (macOS)
32+
- name: Cache Homebrew downloads (macOS)
3333
if: runner.os == 'macOS'
34-
id: cache-imagemagick-mac
3534
uses: actions/cache@v4
3635
with:
3736
path: |
38-
/opt/homebrew/Cellar/imagemagick
39-
/usr/local/Cellar/imagemagick
40-
key: ${{ runner.os }}-${{ runner.arch }}-imagemagick-7.1.1
37+
~/Library/Caches/Homebrew/downloads
38+
~/Library/Caches/Homebrew/Cask
39+
key: ${{ runner.os }}-${{ runner.arch }}-brew-downloads-imagemagick-v1
40+
restore-keys: |
41+
${{ runner.os }}-${{ runner.arch }}-brew-downloads-
4142
4243
- name: Cache apt packages (Linux)
4344
if: runner.os == 'Linux'
@@ -55,17 +56,9 @@ runs:
5556
if: runner.os == 'macOS'
5657
shell: bash
5758
run: |
58-
if [ "${{ steps.cache-imagemagick-mac.outputs.cache-hit }}" == "true" ]; then
59-
echo "✅ ImageMagick restored from cache"
60-
# Link the cached installation
61-
brew link --overwrite --force imagemagick 2>/dev/null || true
62-
if command -v magick &>/dev/null; then
63-
magick --version | head -1
64-
else
65-
echo "⚠️ Cache restored but linking failed, reinstalling..."
66-
HOMEBREW_NO_AUTO_UPDATE=1 brew install imagemagick
67-
magick --version | head -1
68-
fi
59+
if command -v magick &>/dev/null && magick --version &>/dev/null 2>&1; then
60+
echo "✅ ImageMagick available (cached)"
61+
magick --version | head -1
6962
else
7063
echo "📦 Installing ImageMagick..."
7164
HOMEBREW_NO_AUTO_UPDATE=1 brew install imagemagick

0 commit comments

Comments
 (0)