Files
bitcoin/.github/actions/cache/restore/action.yml
will 25506ed6d9 ci: Add dynamic cache switching to warp cache
The GHA cache is very slow, taking on the order of minutes to save and
restore from.

Use WarpBuild's cache instead as this is in the same region and much
faster.

WarpBuild cache action does not auto-fallback to GHA if not being run on
Warp. To allow fork runs to fallback to GHA caching, whilst minimising
duplication in the action files, create new "interal" actions which
perform the switching logic, and use these in the (renamed) cache|save
actions.

Without this we would need the `if` logic in our prvious actions, 4
times in each of save and restore.

Plumb the provider through into the action, as a composite action can't
read `env` (`GITHUB_OUTPUT`) from previous steps.

Github-Pull: #35430
Rebased-From: 2ce4ae7d8f
2026-06-19 18:47:08 +02:00

56 lines
2.0 KiB
YAML

name: 'Restore Caches'
description: 'Restore ccache, depends sources, and built depends caches'
inputs:
provider:
description: 'The cache provider to use'
required: true
runs:
using: 'composite'
steps:
- name: Restore Ccache cache
id: ccache-cache
uses: ./.github/actions/cache/restore/internal
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ env.CONTAINER_NAME }}-${{ github.run_id }}
restore-keys: |
ccache-${{ env.CONTAINER_NAME }}-
provider: ${{ inputs.provider }}
- name: Restore depends sources cache
id: depends-sources
uses: ./.github/actions/cache/restore/internal
with:
path: ${{ env.SOURCES_PATH }}
key: depends-sources-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }}
restore-keys: |
depends-sources-${{ env.CONTAINER_NAME }}-
provider: ${{ inputs.provider }}
- name: Restore built depends cache
id: depends-built
uses: ./.github/actions/cache/restore/internal
with:
path: ${{ env.BASE_CACHE }}
key: depends-built-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }}
restore-keys: |
depends-built-${{ env.CONTAINER_NAME }}-
provider: ${{ inputs.provider }}
- name: Restore previous releases cache
id: previous-releases
uses: ./.github/actions/cache/restore/internal
with:
path: ${{ env.PREVIOUS_RELEASES_DIR }}
key: previous-releases-${{ env.CONTAINER_NAME }}-${{ env.PREVIOUS_RELEASES_HASH }}
restore-keys: |
previous-releases-${{ env.CONTAINER_NAME }}-
provider: ${{ inputs.provider }}
- name: export cache hits
shell: bash
run: |
echo "depends-sources-cache-hit=${{ steps.depends-sources.outputs.cache-hit }}" >> $GITHUB_ENV
echo "depends-built-cache-hit=${{ steps.depends-built.outputs.cache-hit }}" >> $GITHUB_ENV
echo "previous-releases-cache-hit=${{ steps.previous-releases.outputs.cache-hit }}" >> $GITHUB_ENV