diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-07-13 15:50:30 +0200 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-07-13 17:45:37 +0200 |
commit | 32f8292679629fd81657ece736b4936f3f67809f (patch) | |
tree | 0d3a57bc66180165cbe54a82a62a4efc43b16349 /.github/actions/godot-cache-restore | |
parent | 97b8ad1af0f2b4a216f6f1263bef4fbc69e56c7b (diff) | |
download | redot-engine-32f8292679629fd81657ece736b4936f3f67809f.tar.gz |
[CI] Upload build cache before running tests
This improves turnaround time on large PRs where compilation is
successful but unit testing or similar fails, forcing recompilation of
unchanged code
Diffstat (limited to '.github/actions/godot-cache-restore')
-rw-r--r-- | .github/actions/godot-cache-restore/action.yml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/.github/actions/godot-cache-restore/action.yml b/.github/actions/godot-cache-restore/action.yml new file mode 100644 index 0000000000..eb955affef --- /dev/null +++ b/.github/actions/godot-cache-restore/action.yml @@ -0,0 +1,34 @@ +name: Restore Godot build cache +description: Restore Godot build cache. +inputs: + cache-name: + description: The cache base name (job name by default). + default: "${{github.job}}" + scons-cache: + description: The SCons cache path. + default: "${{github.workspace}}/.scons-cache/" +runs: + using: "composite" + steps: + - name: Restore SCons cache directory + uses: actions/cache/restore@v4 + with: + path: ${{inputs.scons-cache}} + key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + + # We try to match an existing cache to restore from it. Each potential key is checked against + # all existing caches as a prefix. E.g. 'linux-template-minimal' would match any cache that + # starts with "linux-template-minimal", such as "linux-template-minimal-master-refs/heads/master-6588a4a29af1621086feac0117d5d4d37af957fd". + # + # We check these prefixes in this order: + # + # 1. The exact match, including the base branch, the commit reference, and the SHA hash of the commit. + # 2. A partial match for the same base branch and the same commit reference. + # 3. A partial match for the same base branch and the base branch commit reference. + # 4. A partial match for the same base branch only (not ideal, matches any PR with the same base branch). + + restore-keys: | + ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}} + ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-refs/heads/${{env.GODOT_BASE_BRANCH}} + ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}} |