mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-10 04:40:25 +01:00
Extract submodule cache steps to compound action
Creates a reusable action for caching submodules in the thirdparty directory.
This commit is contained in:
parent
1d51acb38d
commit
5108c7cabd
2 changed files with 43 additions and 31 deletions
34
.github/actions/cache-submodules/action.yaml
vendored
Normal file
34
.github/actions/cache-submodules/action.yaml
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
name: Cache dependencies
|
||||
inputs:
|
||||
platform:
|
||||
required: true
|
||||
target:
|
||||
required: true
|
||||
bits:
|
||||
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: |
|
||||
godot_cpp_rev=$(git ls-tree HEAD godot-cpp --object-only)
|
||||
libuv_rev=$(git ls-tree HEAD libuv --object-only)
|
||||
libtsm_rev=$(git ls-tree HEAD libtsm --object-only)
|
||||
hash_cmd=$([[ $RUNNER_OS == 'Windows' ]] && echo 'sha1sum' || echo 'shasum')
|
||||
hash_of_hashes=$(echo -n "$godot_cpp_rev$libuv_rev$libtsm_rev" | $hash_cmd | head -c 40)
|
||||
echo "::set-output name=hash::$hash_of_hashes"
|
||||
- name: Cache submodules
|
||||
uses: actions/cache@v3
|
||||
id: cache
|
||||
with:
|
||||
path: addons/godot_xterm/native/thirdparty
|
||||
key: thirdparty-${{ inputs.platform }}-${{ inputs.bits }}-${{ inputs.target }}-${{ steps.hash.outputs.hash }}
|
||||
restore-keys: |
|
||||
thirdparty-${{ inputs.platform }}-${{ inputs.bits }}-${{ inputs.target }}-
|
||||
thirdparty-${{ inputs.platform }}-${{ inputs.bits }}-
|
40
.github/workflows/main.yml
vendored
40
.github/workflows/main.yml
vendored
|
@ -15,8 +15,6 @@ env:
|
|||
EMSCRIPTEN_CACHE_VERSION: 1
|
||||
EXPORT_TEMPLATE_CACHE_VERSION: 1
|
||||
GODOT_CACHE_VERSION: 1
|
||||
GODOT_CPP_CACHE_VERSION: 1
|
||||
LIBUV_CACHE_VERSION: 1
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -46,33 +44,13 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Get godot-cpp submodule commit hash
|
||||
shell: bash
|
||||
env:
|
||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
||||
run: |
|
||||
echo ::set-env name=GODOT_CPP_COMMIT_HASH::$(git ls-tree HEAD addons/godot_xterm/native/thirdparty/godot-cpp -l | cut -d\ -f3)
|
||||
- name: Cache godot-cpp bindings
|
||||
uses: actions/cache@v2
|
||||
id: cache
|
||||
env:
|
||||
cache-name: cache-godot-cpp
|
||||
- name: Cache submodules
|
||||
uses: ./.github/actions/cache-submodules
|
||||
id: cache-submodules
|
||||
with:
|
||||
path: addons/godot_xterm/native/thirdparty/godot-cpp
|
||||
key: godot-cpp-${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.bits }}-${{ env.GODOT_CPP_COMMIT_HASH }}-v${{ env.GODOT_CPP_CACHE_VERSION }}
|
||||
- name: Get libuv submodule commit hash
|
||||
shell: bash
|
||||
env:
|
||||
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
||||
run: |
|
||||
echo ::set-env name=LIBUV_COMMIT_HASH::$(git ls-tree HEAD addons/godot_xterm/native/thirdparty/libuv -l | cut -d\ -f3)
|
||||
- name: Cache libuv
|
||||
uses: actions/cache@v2
|
||||
id: cache-libuv
|
||||
with:
|
||||
path: addons/godot_xterm/native/thirdparty/libuv
|
||||
key: libuv-cache-${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.bits }}-${{ env.LIBUV_COMMIT_HASH }}-v${{ env.LIBUV_CACHE_VERSION }}
|
||||
platform: ${{ matrix.platform }}
|
||||
target: ${{ matrix.target }}
|
||||
bits: ${{ matrix.bits }}
|
||||
- name: Cache emscripten
|
||||
if: ${{ matrix.platform == 'javascript' }}
|
||||
uses: actions/cache@v2
|
||||
|
@ -110,19 +88,19 @@ jobs:
|
|||
arch: win${{ matrix.bits }}
|
||||
|
||||
- name: Build godot-cpp bindings
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd addons/godot_xterm/native/thirdparty/godot-cpp
|
||||
scons platform=${{ matrix.platform }} target=${{ matrix.target }} bits=${{ matrix.bits }} generate_bindings=yes -j2
|
||||
|
||||
- name: Setup cmake
|
||||
if: steps.cache-libuv.outputs.cache-hit != 'true'
|
||||
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||
uses: jwlawson/actions-setup-cmake@v1.9
|
||||
with:
|
||||
cmake-version: '3.15.4'
|
||||
use-32bit: ${{ matrix.bits == 32 && matrix.os == 'windows-latest' }}
|
||||
- name: Build libuv
|
||||
if: steps.cache-libuv.outputs.cache-hit != 'true'
|
||||
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
env:
|
||||
TARGET: ${{ matrix.target }}
|
||||
|
|
Loading…
Reference in a new issue