Skip to content

Commit 3aaac54

Browse files
committed
Cache vcpkg binary cache for macOS (see #8560)
1 parent 8e48a79 commit 3aaac54

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.github/workflows/main.yml

+16-8
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,6 @@ jobs:
290290
build-macos:
291291
name: build-macos-${{ matrix.arch }}
292292
runs-on: ${{ (matrix.arch == 'arm64' && 'macos-14') || 'macos-13' }}
293-
env:
294-
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
295293

296294
strategy:
297295
fail-fast: false
@@ -312,14 +310,16 @@ jobs:
312310

313311
- name: Prepare - Install tools
314312
run: |
315-
brew install automake autoconf-archive libtool ninja python-setuptools
313+
brew install --quiet automake autoconf-archive libtool ninja python-setuptools
316314
317-
- name: Export GitHub Actions cache environment variables
318-
uses: actions/github-script@v7
315+
- name: Restore vcpkg cache
316+
uses: actions/cache/restore@v4
317+
id: restore-vcpkg-cache
319318
with:
320-
script: |
321-
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
322-
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
319+
path: ~/.cache/vcpkg/archives
320+
key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('vcpkg-custom/**', 'vcpkg.json', 'vcpkg-configuration.json') }}
321+
restore-keys: |
322+
vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-
323323
324324
- name: Build
325325
run: |
@@ -348,6 +348,14 @@ jobs:
348348
mkdir gen/artifacts
349349
mv gen/Release/*.pkg gen/artifacts
350350
351+
- name: Save vcpkg cache
352+
uses: actions/cache/save@v4
353+
# Saves if the key changed (hashes on vcpkg/**, vcpkg.json, vcpkg-configuration.json)
354+
if: steps.restore-vcpkg-cache.outputs.cache-hit != 'true'
355+
with:
356+
path: ~/.cache/vcpkg/archives
357+
key: ${{ steps.restore-vcpkg-cache.outputs.cache-primary-key }}
358+
351359
- name: Upload installer
352360
uses: actions/upload-artifact@v4
353361
with:

0 commit comments

Comments
 (0)