godot-xterm/.github/actions/cache-submodules/action.yml
Leroy Hopson 8255d8b3ce
fix(ci): exclude godot-cpp and libtsm from cache
The godot-cpp and libtsm dependecies are built via the SConstruct file
and therefore can be handled by the SCons cache. By caching the
seperately, changes to the submodules were being overwritten.
2024-03-03 21:04:40 +13:00

45 lines
1.9 KiB
YAML

name: Cache dependencies
inputs:
platform:
required: true
target:
required: true
arch:
required: true
outputs:
cache-hit:
value: ${{ steps.cache.outputs.cache-hit }}
runs:
using: "composite"
steps:
- name: Hash submodule revisions
id: hash
working-directory: addons/godot_xterm/native/thirdparty
shell: bash
run: |
libuv_rev=$(git ls-tree HEAD libuv --object-only)
node_pty_rev=$(git ls-tree HEAD node-pty --object-only)
hash_cmd=$([[ $RUNNER_OS == 'Windows' ]] && echo 'sha1sum' || echo 'shasum')
hash_of_hashes=$(echo -n "$libuv_rev$node_pty_rev" | $hash_cmd | head -c 40)
echo "hash=$hash_of_hashes" >> $GITHUB_OUTPUT
build_files_hash=${{ hashFiles('**/build.sh', '**/*.Dockerfile', '**/SConstruct', '**/*.yml') }}
echo "build-files-hash=$build_files_hash" >> $GITHUB_OUTPUT
- name: Cache submodules
uses: actions/cache@v3
id: cache
with:
path: |
addons/godot_xterm/native/thirdparty/libuv
addons/godot_xterm/native/thirdparty/node-pty
key: thirdparty-${{ inputs.platform }}-${{ inputs.arch }}-${{ inputs.target }}-${{ steps.hash.outputs.hash }}-${{ steps.hash.outputs.build-files-hash }}
restore-keys: |
thirdparty-${{ inputs.platform }}-${{ inputs.arch }}-${{ inputs.target }}-${{ steps.hash.outputs.hash }}-
thirdparty-${{ inputs.platform }}-${{ inputs.arch }}-${{ inputs.target }}-
- name: Scons cache
uses: actions/cache@v3
with:
path: "${{github.workspace}}/.scons-cache/"
key: scons-${{ inputs.platform }}-${{ inputs.arch }}-${{ inputs.target }}-${{ steps.hash.outputs.hash }}-${{ steps.hash.outputs.build-files-hash }}
restore-keys: |
scons-${{ inputs.platform }}-${{ inputs.arch }}-${{ inputs.target }}-${{ steps.hash.outputs.hash }}-
scons-${{ inputs.platform }}-${{ inputs.arch }}-${{ inputs.target }}-