From 67d33e5b9878a42e0b61151a6bd40ac728fbe19c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Fri, 21 Apr 2023 13:02:23 +0200 Subject: [PATCH 1/2] CI (MSYS2): Update location of compiler cache. --- .github/workflows/dynamic_arch.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dynamic_arch.yml b/.github/workflows/dynamic_arch.yml index ff40b354d..fdfad3365 100644 --- a/.github/workflows/dynamic_arch.yml +++ b/.github/workflows/dynamic_arch.yml @@ -217,11 +217,16 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 + - name: Prepare ccache + # Get cache location of ccache + id: ccache-prepare + run: | + echo "ccachedir=$(cygpath -m $(ccache -k cache_dir))" >> $GITHUB_OUTPUT + - name: Compilation cache uses: actions/cache@v3 with: - # It looks like this path needs to be hard-coded. - path: C:/msys64/home/runneradmin/.ccache + path: ${{ steps.ccache-prepare.outputs.ccachedir }} # 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. key: ccache-msys2-${{ matrix.msystem }}-${{ matrix.idx }}-${{ matrix.build-type }}-${{ github.ref }}-${{ github.sha }} @@ -234,9 +239,10 @@ jobs: # Limit the maximum size and switch on compression to avoid exceeding the total disk or cache quota. run: | which ccache - test -d ~/.ccache || mkdir -p ~/.ccache - echo "max_size = 250M" > ~/.ccache/ccache.conf - echo "compression = true" >> ~/.ccache/ccache.conf + test -d ${{ steps.ccache-prepare.outputs.ccachedir }} || mkdir -p ${{ steps.ccache-prepare.outputs.ccachedir }} + echo "max_size = 250M" > ${{ steps.ccache-prepare.outputs.ccachedir }}/ccache.conf + echo "compression = true" >> ${{ steps.ccache-prepare.outputs.ccachedir }}/ccache.conf + ccache -p ccache -s echo $HOME cygpath -w $HOME From e27e9a50b1d831d2b02a7d1c7477fab5ab9f460d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=BCtzel?= Date: Fri, 21 Apr 2023 14:10:40 +0200 Subject: [PATCH 2/2] CI (MSYS2): Save ccache before running tests. --- .github/workflows/dynamic_arch.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dynamic_arch.yml b/.github/workflows/dynamic_arch.yml index fdfad3365..b537c8494 100644 --- a/.github/workflows/dynamic_arch.yml +++ b/.github/workflows/dynamic_arch.yml @@ -219,17 +219,19 @@ jobs: - name: Prepare ccache # Get cache location of ccache + # Create key that is used in action/cache/restore and action/cache/save steps id: ccache-prepare run: | 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 # 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-keys: | ccache-msys2-${{ matrix.msystem }}-${{ matrix.idx }}-${{ matrix.build-type }}-${{ github.ref }} @@ -270,6 +272,13 @@ jobs: continue-on-error: true 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 timeout-minutes: 60 run: cd build && ctest