Skip to content

Commit e50691f

Browse files
committed
Port binary artifact caching to macos workflow
1 parent 4374be8 commit e50691f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/macos.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ jobs:
2020
uses: actions/cache@v3
2121
id: cache-vcpkg
2222
with:
23-
path: build/vcpkg_installed/
24-
key: vcpkg-x64-osx
23+
path: build/vcpkg_cache/
24+
key: vcpkg-binaries-x64-osx
2525

2626
- name: Create Build Environment
2727
if: ${{ !steps.cache-vcpkg.outputs.cache-hit }}
28-
run: cmake -E make_directory build
28+
run: |
29+
cmake -E make_directory build
30+
cmake -E make_directory build/vcpkg_cache
2931
3032
- name: Configure
3133
shell: pwsh
@@ -34,6 +36,10 @@ jobs:
3436
$vcpkgToolchain = Join-Path $env:VCPKG_INSTALLATION_ROOT './scripts/buildsystems/vcpkg.cmake' -Resolve
3537
$cmakeBuildType = '${{ matrix.config }}'
3638
39+
$cachedBinaries = Join-Path $(Get-Location) './vcpkg_cache/' -Resolve
40+
$cacheAccess = $(if ('${{ steps.cache-vcpkg.outputs.cache-hit }}' -eq 'true') { 'read' } else { 'write' })
41+
$env:VCPKG_BINARY_SOURCES = "clear;files,$cachedBinaries,$cacheAccess"
42+
3743
cmake "-DCMAKE_TOOLCHAIN_FILE=$vcpkgToolchain" "-DCMAKE_BUILD_TYPE=$cmakeBuildType" ${{ github.workspace }}
3844
3945
- name: Build

0 commit comments

Comments
 (0)