From 9d0c307341a38e7681f1fa05dbdc48b2a0e26695 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Fri, 30 May 2025 07:57:42 -0400 Subject: [PATCH] CI: Add a quoteless cache restore key for GitHub runners The way we echo the cache keys for output variables strips these quotes. So when we save the caches at the end of CI, the keys are sans quotes. This patch adds an extra cache restore key without quotes to allow jobs to fetch their own caches again. This will become moot once all runners are able to use the Blacksmith cache action. --- .github/actions/cache-restore/action.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/actions/cache-restore/action.yml b/.github/actions/cache-restore/action.yml index eea329c8a00..ffd3ef34993 100644 --- a/.github/actions/cache-restore/action.yml +++ b/.github/actions/cache-restore/action.yml @@ -61,10 +61,11 @@ runs: id: 'ccache-blacksmith' if: ${{ inputs.ccache_path != '' && startsWith(inputs.runner_label, 'blacksmith') }} with: - path: ${{ inputs.ccache_path }} - key: '"ccache" | "${{ inputs.os }}" | "${{ inputs.arch }}" | "${{ inputs.toolchain }}" | "${{ inputs.cache_key_extra }}" | "${{ inputs.ccache_version }}" | ${{ steps.date-stamp.outputs.timestamp }}' - restore-keys: | - "ccache" | "${{ inputs.os }}" | "${{ inputs.arch }}" | "${{ inputs.toolchain }}" | "${{ inputs.cache_key_extra }}" | "${{ inputs.ccache_version }}" + path: ${{ inputs.ccache_path }} + key: '"ccache" | "${{ inputs.os }}" | "${{ inputs.arch }}" | "${{ inputs.toolchain }}" | "${{ inputs.cache_key_extra }}" | "${{ inputs.ccache_version }}" | ${{ steps.date-stamp.outputs.timestamp }}' + restore-keys: | + ccache | ${{ inputs.os }} | ${{ inputs.arch }} | ${{ inputs.toolchain }} | ${{ inputs.cache_key_extra }} | ${{ inputs.ccache_version }} + "ccache" | "${{ inputs.os }}" | "${{ inputs.arch }}" | "${{ inputs.toolchain }}" | "${{ inputs.cache_key_extra }}" | "${{ inputs.ccache_version }}" - name: 'Compiler Cache (GitHub runner)' uses: actions/cache/restore@v4 @@ -74,6 +75,7 @@ runs: path: ${{ inputs.ccache_path }} key: '"ccache" | "${{ inputs.os }}" | "${{ inputs.arch }}" | "${{ inputs.toolchain }}" | "${{ inputs.cache_key_extra }}" | "${{ inputs.ccache_version }}" | ${{ steps.date-stamp.outputs.timestamp }}' restore-keys: | + ccache | ${{ inputs.os }} | ${{ inputs.arch }} | ${{ inputs.toolchain }} | ${{ inputs.cache_key_extra }} | ${{ inputs.ccache_version }} "ccache" | "${{ inputs.os }}" | "${{ inputs.arch }}" | "${{ inputs.toolchain }}" | "${{ inputs.cache_key_extra }}" | "${{ inputs.ccache_version }}" - name: 'Configure Compiler Cache' @@ -96,9 +98,10 @@ runs: path: ${{ inputs.vcpkg_cache_path }} key: '"vcpkg" | "${{ inputs.os }}" | "${{ inputs.arch }}" | "${{ inputs.toolchain }}" | "${{ inputs.cache_key_extra }}" | "${{ inputs.ccache_version }}" | ${{ steps.date-stamp.outputs.timestamp }}' restore-keys: | + vcpkg | ${{ inputs.os }} | ${{ inputs.arch }} | ${{ inputs.toolchain }} | ${{ inputs.cache_key_extra }} | ${{ inputs.ccache_version }} "vcpkg" | "${{ inputs.os }}" | "${{ inputs.arch }}" | "${{ inputs.toolchain }}" | "${{ inputs.cache_key_extra }}" | "${{ inputs.ccache_version }}" - - name: 'Compiler Cache (GitHub runner)' + - name: 'Restore vcpkg cache (GitHub runner)' uses: actions/cache/restore@v4 if: ${{ inputs.ccache_path != '' && !startsWith(inputs.runner_label, 'blacksmith') }} id: 'vcpkg-gh' @@ -106,8 +109,11 @@ runs: path: ${{ inputs.vcpkg_cache_path }} key: '"vcpkg" | "${{ inputs.os }}" | "${{ inputs.arch }}" | "${{ inputs.toolchain }}" | "${{ inputs.cache_key_extra }}" | "${{ inputs.ccache_version }}" | ${{ steps.date-stamp.outputs.timestamp }}' restore-keys: | + vcpkg | ${{ inputs.os }} | ${{ inputs.arch }} | ${{ inputs.toolchain }} | ${{ inputs.cache_key_extra }} | ${{ inputs.ccache_version }} "vcpkg" | "${{ inputs.os }}" | "${{ inputs.arch }}" | "${{ inputs.toolchain }}" | "${{ inputs.cache_key_extra }}" | "${{ inputs.ccache_version }}" + # FIXME: When all runners are using the useblacksmith/cache action and this step is removed, we should also be able + # to remove the quoteless cache restore keys in the cache actions above. - name: 'Cache Outputs' id: 'cache-outputs' shell: bash