Extract submodule cache steps to compound action

Creates a reusable action for caching submodules in the thirdparty
directory.
This commit is contained in:
Leroy Hopson 2022-06-01 09:54:06 +07:00
parent 1d51acb38d
commit 5108c7cabd
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
2 changed files with 43 additions and 31 deletions

View file

@ -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 }}