Skip to content

Cache vcpkg binary cache for macOS #8560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 11, 2025
24 changes: 16 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,6 @@ jobs:
build-macos:
name: build-macos-${{ matrix.arch }}
runs-on: ${{ (matrix.arch == 'arm64' && 'macos-14') || 'macos-13' }}
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

strategy:
fail-fast: false
Expand All @@ -384,14 +382,16 @@ jobs:

- name: Prepare - Install tools
run: |
brew install automake autoconf-archive libtool ninja
brew install --quiet automake autoconf-archive libtool ninja

- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
- name: Restore vcpkg cache
uses: actions/cache/restore@v4
id: restore-vcpkg-cache
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
path: ~/.cache/vcpkg/archives
key: vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-${{ hashFiles('vcpkg-custom/**', 'vcpkg.json', 'vcpkg-configuration.json') }}
restore-keys: |
vcpkg-cache-${{ runner.os }}-${{ matrix.arch }}-

- name: Build
run: |
Expand Down Expand Up @@ -419,6 +419,14 @@ jobs:
mkdir gen/artifacts
mv gen/Release/*.pkg gen/artifacts

- name: Save vcpkg cache
uses: actions/cache/save@v4
# Saves if the key changed (hashes on vcpkg/**, vcpkg.json, vcpkg-configuration.json)
if: steps.restore-vcpkg-cache.outputs.cache-hit != 'true'
with:
path: ~/.cache/vcpkg/archives
key: ${{ steps.restore-vcpkg-cache.outputs.cache-primary-key }}

- name: Upload installer
uses: actions/upload-artifact@v4
with:
Expand Down
Loading