From 76b38de01a31c5c1762c4b8239e7a51ebea84bef Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Sat, 13 Jul 2024 16:24:13 +0200 Subject: [PATCH] [CI] Upload build cache before running tests --- .../action.yml | 9 ++++----- .github/actions/godot-cache-save/action.yml | 17 +++++++++++++++++ .github/workflows/ci.yml | 10 ++++++++-- 3 files changed, 29 insertions(+), 7 deletions(-) rename .github/actions/{godot-cache => godot-cache-restore}/action.yml (77%) create mode 100644 .github/actions/godot-cache-save/action.yml diff --git a/.github/actions/godot-cache/action.yml b/.github/actions/godot-cache-restore/action.yml similarity index 77% rename from .github/actions/godot-cache/action.yml rename to .github/actions/godot-cache-restore/action.yml index 2d7afc85..5df57765 100644 --- a/.github/actions/godot-cache/action.yml +++ b/.github/actions/godot-cache-restore/action.yml @@ -1,5 +1,5 @@ -name: Setup Godot build cache -description: Setup Godot build cache. +name: Restore Godot build cache +description: Restore Godot build cache. inputs: cache-name: description: The cache base name (job name by default). @@ -10,9 +10,8 @@ inputs: runs: using: "composite" steps: - # Upload cache on completion and check it out now - - name: Load .scons_cache directory - uses: actions/cache@v3 + - name: Restore .scons_cache directory + uses: actions/cache/restore@v3 with: path: ${{inputs.scons-cache}} key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} diff --git a/.github/actions/godot-cache-save/action.yml b/.github/actions/godot-cache-save/action.yml new file mode 100644 index 00000000..b7cbf91f --- /dev/null +++ b/.github/actions/godot-cache-save/action.yml @@ -0,0 +1,17 @@ +name: Save Godot build cache +description: Save 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: Save SCons cache directory + uses: actions/cache/save@v4 + with: + path: ${{inputs.scons-cache}} + key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4471faf..76abdd57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,8 +99,8 @@ jobs: with: submodules: recursive - - name: Setup Godot build cache - uses: ./.github/actions/godot-cache + - name: Restore Godot build cache + uses: ./.github/actions/godot-cache-restore with: cache-name: ${{ matrix.cache-name }} continue-on-error: true @@ -153,6 +153,12 @@ jobs: cd test scons platform=${{ matrix.platform }} verbose=yes target=template_release ${{ matrix.flags }} + - name: Save Godot build cache + uses: ./.github/actions/godot-cache-save + with: + cache-name: ${{ matrix.cache-name }} + continue-on-error: true + - name: Download latest Godot artifacts uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9 if: ${{ matrix.run-tests && env.GODOT_TEST_VERSION == 'master' }}