mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-10 14:48:46 +02:00
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.
48 lines
2.1 KiB
YAML
48 lines
2.1 KiB
YAML
name: 'Save Caches'
|
|
description: 'Save ccache, depends sources, and built depends caches'
|
|
inputs:
|
|
provider:
|
|
description: 'The cache provider to use'
|
|
required: true
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: debug cache hit inputs
|
|
shell: bash
|
|
run: |
|
|
echo "depends sources direct cache hit to primary key: ${{ env.depends-sources-cache-hit }}"
|
|
echo "depends built direct cache hit to primary key: ${{ env.depends-built-cache-hit }}"
|
|
echo "previous releases direct cache hit to primary key: ${{ env.previous-releases-cache-hit }}"
|
|
|
|
- name: Save Ccache cache
|
|
uses: ./.github/actions/cache/save/internal
|
|
if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) }}
|
|
with:
|
|
path: ${{ env.CCACHE_DIR }}
|
|
key: ccache-${{ env.CONTAINER_NAME }}-${{ github.run_id }}
|
|
provider: ${{ inputs.provider }}
|
|
|
|
- name: Save depends sources cache
|
|
uses: ./.github/actions/cache/save/internal
|
|
if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) && (env.depends-sources-cache-hit != 'true') }}
|
|
with:
|
|
path: ${{ env.SOURCES_PATH }}
|
|
key: depends-sources-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }}
|
|
provider: ${{ inputs.provider }}
|
|
|
|
- name: Save built depends cache
|
|
uses: ./.github/actions/cache/save/internal
|
|
if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) && (env.depends-built-cache-hit != 'true' )}}
|
|
with:
|
|
path: ${{ env.BASE_CACHE }}
|
|
key: depends-built-${{ env.CONTAINER_NAME }}-${{ env.DEPENDS_HASH }}
|
|
provider: ${{ inputs.provider }}
|
|
|
|
- name: Save previous releases cache
|
|
uses: ./.github/actions/cache/save/internal
|
|
if: ${{ (github.event_name == 'push') && (github.ref_name == github.event.repository.default_branch) && (env.previous-releases-cache-hit != 'true' )}}
|
|
with:
|
|
path: ${{ env.PREVIOUS_RELEASES_DIR }}
|
|
key: previous-releases-${{ env.CONTAINER_NAME }}-${{ env.PREVIOUS_RELEASES_HASH }}
|
|
provider: ${{ inputs.provider }}
|