Godot Version
4.4.1
Question
I’m trying to set up a workflow action on Github that will automatically compile a GDExtension I’m working on when I invoke it. Since compiling the godot-cpp library takes a long time, I’d like to cache and reuse the libraries. Unfortunately, when I run scons
on the my SConstruct
in the root of my project, it will automatically trigger the SConstruct
file inside of godot-cpp even if the static library has already been built.
I’m compiling the library with scons platform=linux arch=x86_64 custom_api_file=../extension_api.json
and my main project with scons platform=linux arch=x86_64
.
I don’t have this problem when I build for Windows on my desktop. I’m not sure if this problem is due to how I’m setting up the build server, or if I need to specify extra arguments to scons
to stop it from automatically rebuilding the godot-cpp
library.
This is my full github action workflow so far:
name: build-linux
on: [workflow_dispatch]
jobs:
build-linux-extension:
name: Build Linux Extension
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install -y g++ python3 python3-pip
sudo python -m pip install scons
- name: Cache Library
id: cache-linux-libraries
uses: actions/cache@v4
with:
path: |
./map_generation/godot-cpp/bin/*.a
key: ${{ runner.os }}-extn-${{ hashFiles('./map_generation/godot-cpp/**/*.cpp', './map_generation/godot-cpp/**/*.hpp', './map_generation/godot-cpp/SConstruct') }}
- name: Compile Support Library
if: steps.cache-linux-libraries.outputs.cache-hit != true
working-directory: ./map_generation/godot-cpp
run: |
scons platform=linux arch=x86_64 custom_api_file=../extension_api.json
- name: Compile extension
working-directory: ./map_generation
run: |
scons platform=linux arch=x86_64
- name: List godot-cpp/bin directory
working-directory: ./map_generation/godot-cpp
run: |
ls bin
- name: List godot/bin directory
working-directory: ./map_generation/godot
run: |
ls bin