File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -219,17 +219,19 @@ jobs:
219
219
220
220
- name : Prepare ccache
221
221
# Get cache location of ccache
222
+ # Create key that is used in action/cache/restore and action/cache/save steps
222
223
id : ccache-prepare
223
224
run : |
224
225
echo "ccachedir=$(cygpath -m $(ccache -k cache_dir))" >> $GITHUB_OUTPUT
226
+ # We include the commit sha in the cache key, as new cache entries are
227
+ # only created if there is no existing entry for the key yet.
228
+ echo "key=ccache-msys2-${{ matrix.msystem }}-${{ matrix.idx }}-${{ matrix.build-type }}-${{ github.ref }}-${{ github.sha }}" >> $GITHUB_OUTPUT
225
229
226
- - name : Compilation cache
227
- uses : actions/cache@v3
230
+ - name : Restore ccache
231
+ uses : actions/cache/restore @v3
228
232
with :
229
233
path : ${{ steps.ccache-prepare.outputs.ccachedir }}
230
- # We include the commit sha in the cache key, as new cache entries are
231
- # only created if there is no existing entry for the key yet.
232
- key : ccache-msys2-${{ matrix.msystem }}-${{ matrix.idx }}-${{ matrix.build-type }}-${{ github.ref }}-${{ github.sha }}
234
+ key : ${{ steps.ccache-prepare.outputs.key }}
233
235
# Restore a matching ccache cache entry. Prefer same branch.
234
236
restore-keys : |
235
237
ccache-msys2-${{ matrix.msystem }}-${{ matrix.idx }}-${{ matrix.build-type }}-${{ github.ref }}
@@ -270,6 +272,13 @@ jobs:
270
272
continue-on-error : true
271
273
run : ccache -s
272
274
275
+ - name : Save ccache
276
+ # Save the cache after we are done (successfully) building
277
+ uses : actions/cache/save@v3
278
+ with :
279
+ path : ${{ steps.ccache-prepare.outputs.ccachedir }}
280
+ key : ${{ steps.ccache-prepare.outputs.key }}
281
+
273
282
- name : Run tests
274
283
timeout-minutes : 60
275
284
run : cd build && ctest
You can’t perform that action at this time.
0 commit comments