Skip to content

Commit 86578b9

Browse files
committed
github: make cache key more precise
1 parent a93b9c9 commit 86578b9

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ jobs:
7474
id: cache-sysroot
7575
uses: actions/cache@v4
7676
with:
77-
path: sysroot-${{ matrix.platform }}-${{ matrix.arch }}
78-
key: ${{ matrix.platform }}-${{ matrix.arch }}-${{ hashFiles('scripts/build_dependencies.sh') }}-${{ hashFiles('patches/**') }}
77+
path: ./sysroot-${{ matrix.platform }}-${{ matrix.arch }}
78+
key: ${{ matrix.platform }}-${{ matrix.arch }}-${{ hashFiles('scripts/build_dependencies.sh') }}-${{ hashFiles('patches/**') }}-${{ github.sha }}
79+
restore-keys: ${{ matrix.platform }}-${{ matrix.arch }}-${{ hashFiles('scripts/build_dependencies.sh') }}-${{ hashFiles('patches/**') }}
7980
upload-chunk-size: 1048576 # 1 MiB
8081
lookup-only: true
8182
- name: Setup Path
@@ -114,23 +115,24 @@ jobs:
114115
id: cache-sysroot-universal
115116
uses: actions/cache@v4
116117
with:
117-
path: sysroot-macOS-arm64_x86_64
118-
key: macos-universal-${{ hashFiles('scripts/build_dependencies.sh', 'scripts/pack_dependencies.sh') }}-${{ hashFiles('patches/**') }}
118+
path: ./sysroot-macOS-arm64_x86_64
119+
key: macos-universal-${{ hashFiles('scripts/build_dependencies.sh', 'scripts/pack_dependencies.sh') }}-${{ hashFiles('patches/**') }}-${{ github.sha }}
120+
restore-keys: macos-universal-${{ hashFiles('scripts/build_dependencies.sh', 'scripts/pack_dependencies.sh') }}-${{ hashFiles('patches/**') }}
119121
lookup-only: true
120122
- name: Cache Sysroot (arm64)
121123
if: steps.cache-sysroot-universal.outputs.cache-hit != 'true'
122124
id: cache-sysroot-arm64
123-
uses: actions/cache@v4
125+
uses: actions/cache/restore@v4
124126
with:
125-
path: sysroot-macos-arm64
127+
path: ./sysroot-macos-arm64
126128
key: macos-arm64-${{ hashFiles('scripts/build_dependencies.sh') }}-${{ hashFiles('patches/**') }}
127129
fail-on-cache-miss: true
128130
- name: Cache Sysroot (x86_64)
129131
if: steps.cache-sysroot-universal.outputs.cache-hit != 'true'
130132
id: cache-sysroot-x86_64
131-
uses: actions/cache@v4
133+
uses: actions/cache/restore@v4
132134
with:
133-
path: sysroot-macos-x86_64
135+
path: ./sysroot-macos-x86_64
134136
key: macos-x86_64-${{ hashFiles('scripts/build_dependencies.sh') }}-${{ hashFiles('patches/**') }}
135137
fail-on-cache-miss: true
136138
- name: Pack Universal Sysroot
@@ -169,9 +171,9 @@ jobs:
169171
submodules: recursive
170172
- name: Cache Sysroot
171173
id: cache-sysroot
172-
uses: actions/cache@v4
174+
uses: actions/cache/restore@v4
173175
with:
174-
path: sysroot-${{ matrix.configuration.platform }}-${{ matrix.configuration.arch }}
176+
path: ./sysroot-${{ matrix.configuration.platform }}-${{ matrix.configuration.arch }}
175177
key: ${{ matrix.configuration.platform }}-${{ matrix.configuration.arch }}-${{ hashFiles('scripts/build_dependencies.sh') }}-${{ hashFiles('patches/**') }}
176178
fail-on-cache-miss: true
177179
- name: Setup Xcode
@@ -198,9 +200,9 @@ jobs:
198200
submodules: recursive
199201
- name: Cache Sysroot
200202
id: cache-sysroot
201-
uses: actions/cache@v4
203+
uses: actions/cache/restore@v4
202204
with:
203-
path: sysroot-macOS-arm64_x86_64
205+
path: ./sysroot-macOS-arm64_x86_64
204206
key: macos-universal-${{ hashFiles('scripts/build_dependencies.sh', 'scripts/pack_dependencies.sh') }}-${{ hashFiles('patches/**') }}
205207
fail-on-cache-miss: true
206208
- name: Setup Xcode

0 commit comments

Comments
 (0)