How to design a workflow that caches objects complied from a submodule? #210485
🏷️ Discussion TypeQuestion BodyI'm trying to figure out how to set up a github workflow action so that it caches the complied results of a submodule so that it's not built every single time I submit changes to my main project. I'm not quite sure how the This is something I modified from a Gemini prompt: Right now when the third step runs, it re-compiles the files that were already built in step 2. How could I change this so that it checks to see if the objects that were created in step 2 are up to date, and if so reuses them?
Guidelines
|
Replies: 2 comments 1 reply
|
Two separate things are going on, and neither is really about 1. Step 3 rebuilds godot-cpp because it is a different SCons build. SCons decides what is up to date from its signature database ( 2. Your cache folders are empty. SCons only writes a build cache when This is what the official godot-cpp-template workflow does, adapted to your steps: - name: Setup SCons Cache
uses: actions/cache@v6
with:
path: ${{ github.workspace }}/.scons_cache/
key: ${{ matrix.platform }}-${{ matrix.arch }}-release-${{ github.sha }}
restore-keys: |
${{ matrix.platform }}-${{ matrix.arch }}-release-
- name: Build Extension (Release)
env:
SCONS_CACHE: ${{ github.workspace }}/.scons_cache/
run: |
scons platform=${{ matrix.platform }} arch=${{ matrix.arch }} target=template_releaseOn the first run everything compiles and lands in If you also build |

Two separate things are going on, and neither is really about
actions/cache.1. Step 3 rebuilds godot-cpp because it is a different SCons build. SCons decides what is up to date from its signature database (
.sconsign.dblite), and that file lives next to the top-level SConstruct (SConsignFile docs).scons -C godot-cpprecords its signatures ingodot-cpp/.sconsign.dblite; the build from your project root uses./.sconsign.dblite, which knows nothing about those objects, so it compiles them again. If your SConstruct is based on godot-cpp-template, it also pulls godot-cpp in itself withSConscript("godot-cpp/SConstruct", {"api_version": ..., "customs": ...}), so the flags may not even match yo…