CI (MSYS2): Save ccache before running tests.

This commit is contained in:
Markus Mützel 2023-04-21 14:10:40 +02:00
parent 67d33e5b98
commit e27e9a50b1
1 changed files with 15 additions and 6 deletions

View File

@ -219,17 +219,19 @@ jobs:
- name: Prepare ccache - name: Prepare ccache
# Get cache location of ccache # Get cache location of ccache
# Create key that is used in action/cache/restore and action/cache/save steps
id: ccache-prepare id: ccache-prepare
run: | run: |
echo "ccachedir=$(cygpath -m $(ccache -k cache_dir))" >> $GITHUB_OUTPUT echo "ccachedir=$(cygpath -m $(ccache -k cache_dir))" >> $GITHUB_OUTPUT
- name: Compilation cache
uses: actions/cache@v3
with:
path: ${{ steps.ccache-prepare.outputs.ccachedir }}
# We include the commit sha in the cache key, as new cache entries are # We include the commit sha in the cache key, as new cache entries are
# only created if there is no existing entry for the key yet. # only created if there is no existing entry for the key yet.
key: ccache-msys2-${{ matrix.msystem }}-${{ matrix.idx }}-${{ matrix.build-type }}-${{ github.ref }}-${{ github.sha }} echo "key=ccache-msys2-${{ matrix.msystem }}-${{ matrix.idx }}-${{ matrix.build-type }}-${{ github.ref }}-${{ github.sha }}" >> $GITHUB_OUTPUT
- name: Restore ccache
uses: actions/cache/restore@v3
with:
path: ${{ steps.ccache-prepare.outputs.ccachedir }}
key: ${{ steps.ccache-prepare.outputs.key }}
# Restore a matching ccache cache entry. Prefer same branch. # Restore a matching ccache cache entry. Prefer same branch.
restore-keys: | restore-keys: |
ccache-msys2-${{ matrix.msystem }}-${{ matrix.idx }}-${{ matrix.build-type }}-${{ github.ref }} ccache-msys2-${{ matrix.msystem }}-${{ matrix.idx }}-${{ matrix.build-type }}-${{ github.ref }}
@ -270,6 +272,13 @@ jobs:
continue-on-error: true continue-on-error: true
run: ccache -s run: ccache -s
- name: Save ccache
# Save the cache after we are done (successfully) building
uses: actions/cache/save@v3
with:
path: ${{ steps.ccache-prepare.outputs.ccachedir }}
key: ${{ steps.ccache-prepare.outputs.key }}
- name: Run tests - name: Run tests
timeout-minutes: 60 timeout-minutes: 60
run: cd build && ctest run: cd build && ctest