This is a first step to split up the cabal and stack caches in separate pieces. Here we split the work folder, which just contains the postgrest-specific build artifacts, into a separate cache. More fine-grained caching should give us better cache hits and much fewer upload size in the regular case, improving CI performance. Since the work file caches are very small (about 30-40 MB) they are cached for PRs, too. This will allow the majority of PRs, which only change source code files, but no dependencies, to still have cached their build files for additional commits.
36 lines
1.3 KiB
YAML
36 lines
1.3 KiB
YAML
name: Cache on main
|
|
|
|
description: Stores caches on main and release branches only, but restores them on all branches.
|
|
|
|
inputs:
|
|
path:
|
|
description: Path(s) to cache
|
|
required: true
|
|
save-prs:
|
|
description: Whether to additionally store the cache in a pull request, too. Should only be used for very small caches.
|
|
default: false
|
|
prefix:
|
|
description: Cache key prefix to be used in both primary key and restore-keys.
|
|
required: true
|
|
suffix:
|
|
description: Cache key suffix to be used only in primary key.
|
|
required: true
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
if: ${{ startsWith(github.ref, 'refs/heads/') || (inputs.save-prs && github.head_ref) }}
|
|
with:
|
|
path: ${{ inputs.path }}
|
|
key: ${{ runner.os }}-${{ inputs.prefix }}-${{ inputs.suffix }}
|
|
restore-keys: |
|
|
${{ runner.os }}-${{ inputs.prefix }}-
|
|
- uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
if: ${{ !startsWith(github.ref, 'refs/heads/') && !(inputs.save-prs && github.head_ref) }}
|
|
with:
|
|
path: ${{ inputs.path }}
|
|
key: ${{ runner.os }}-${{ inputs.prefix }}-${{ inputs.suffix }}
|
|
restore-keys: |
|
|
${{ runner.os }}-${{ inputs.prefix }}-
|