Skip to content

Commit e27e9a5

Browse files
committed
CI (MSYS2): Save ccache before running tests.
1 parent 67d33e5 commit e27e9a5

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.github/workflows/dynamic_arch.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,17 +219,19 @@ jobs:
219219

220220
- name: Prepare ccache
221221
# Get cache location of ccache
222+
# Create key that is used in action/cache/restore and action/cache/save steps
222223
id: ccache-prepare
223224
run: |
224225
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
225229
226-
- name: Compilation cache
227-
uses: actions/cache@v3
230+
- name: Restore ccache
231+
uses: actions/cache/restore@v3
228232
with:
229233
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 }}
233235
# Restore a matching ccache cache entry. Prefer same branch.
234236
restore-keys: |
235237
ccache-msys2-${{ matrix.msystem }}-${{ matrix.idx }}-${{ matrix.build-type }}-${{ github.ref }}
@@ -270,6 +272,13 @@ jobs:
270272
continue-on-error: true
271273
run: ccache -s
272274

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+
273282
- name: Run tests
274283
timeout-minutes: 60
275284
run: cd build && ctest

0 commit comments

Comments
 (0)