GHA: Update setup script and make build workflow for GDExtension

This commit is contained in:
Serhii Snitsaruk 2024-01-11 17:06:06 +01:00
parent 21b5053b72
commit c55c6553b2
5 changed files with 168 additions and 0 deletions

139
.github/workflows/gdextension_linux.yml vendored Normal file
View File

@ -0,0 +1,139 @@
name: 🐧 Linux GDExtension builds
on:
workflow_call:
inputs:
godot-cpp-version:
description: Ref in the godot-cpp repository.
type: string
default: 4.2
limboai-treeish:
description: A tag, branch or commit hash in the LimboAI repository.
type: string
default: master
# test-build:
# description: Should we perform only a limited number of test builds?
# type: boolean
# default: false
workflow_dispatch:
inputs:
godot-cpp-version:
description: Ref in the godot-cpp repository.
type: string
default: 4.2
limboai-treeish:
description: A tag, branch or commit hash in the LimboAI repository.
type: string
default: master
# test-build:
# description: Should we perform only a limited number of test builds?
# type: boolean
# default: false
# Global Settings
env:
SCONS_CACHE_LIMIT: 4096
SCONSFLAGS: dev_build=no debug_symbols=no symbol_visibility=auto
jobs:
gdextension-linux:
runs-on: "ubuntu-20.04"
name: ${{ matrix.opts.name }}
strategy:
fail-fast: false
matrix:
opts:
- name: GDExtension (x86_64, release)
target: template_release
arch: x86_64
should-build: true
- name: GDExtension (x86_64, debug)
target: editor
arch: x86_64
should-build: true
exclude:
- { opts: {should-build: false }}
env:
BIN: liblimboai.linux.${{matrix.opts.target}}.${{matrix.opts.arch}}
steps:
- name: Clone godot-cpp
uses: actions/checkout@v4
with:
repository: godotengine/godot-cpp
path: godot-cpp
ref: ${{ inputs.godot-cpp-version }}
- name: Clone LimboAI module
uses: actions/checkout@v4
with:
path: limboai
ref: ${{ inputs.limboai-treeish }}
# Inits GODOT_VERSION, LIMBOAI_VERSION and NAME_PREFIX environment variables.
- uses: ./limboai/.github/actions/init-version
# About sed see: https://github.com/godotengine/buildroot/issues/6
- name: Set up buildroot x86_64
if: matrix.opts.arch == 'x86_64'
run: |
wget https://download.tuxfamily.org/godotengine/toolchains/linux/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
tar -xjf x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2
mv x86_64-godot-linux-gnu_sdk-buildroot buildroot
cd buildroot
sed -i x86_64-godot-linux-gnu/sysroot/usr/lib/pkgconfig/dbus-1.pc -e "s@/lib@/lib64@g"
./relocate-sdk.sh
cd ..
- name: Set up buildroot x86_32
if: matrix.opts.arch == 'x86_32'
run: |
wget https://download.tuxfamily.org/godotengine/toolchains/linux/i686-godot-linux-gnu_sdk-buildroot.tar.bz2
tar -xjf i686-godot-linux-gnu_sdk-buildroot.tar.bz2
mv i686-godot-linux-gnu_sdk-buildroot buildroot
cd buildroot
./relocate-sdk.sh
cd ..
- name: Set up scons cache
uses: actions/cache@v3
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{env.BIN}}-${{inputs.godot-cpp-version}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}}
restore-keys: |
${{env.BIN}}-${{inputs.godot-cpp-version}}-${{inputs.limboai-treeish}}-${{env.LIMBOAI_VERSION}}
${{env.BIN}}-${{inputs.godot-cpp-version}}-${{inputs.limboai-treeish}}
${{env.BIN}}-${{inputs.godot-cpp-version}}
- name: Setup project structure for GDExtension
shell: bash
run: |
bash ./limboai/gdextension/setup_gdextension.sh
ls
ls -R demo/
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
PATH=${GITHUB_WORKSPACE}/buildroot/bin:$PATH
scons platform=linux target=${{matrix.opts.target}} arch=${{matrix.opts.arch}} ${{env.SCONSFLAGS}}
- name: Prepare artifact
run: |
mkdir -p out/
cp -r --dereference demo/addons/ out/
strip out/addons/limboai/bin/liblimboai*
chmod +x out/addons/limboai/bin/liblimboai*
ls -R out/
- name: Upload artifact
uses: actions/upload-artifact@v3
env:
NAME: ${{env.NAME_PREFIX}}.gdextension
with:
name: ${{ env.NAME }}
path: out/*

View File

@ -15,6 +15,10 @@ on:
description: A tag, branch or commit hash in the Godot repository.
type: string
default: 4.2.1-stable
godot-cpp-version:
description: Ref in the godot-cpp repository.
type: string
default: 4.2
pull_request:
branches: [ master ]
@ -28,6 +32,10 @@ on:
description: A tag, branch or commit hash in the Godot repository.
type: string
default: 4.2.1-stable
godot-cpp-version:
description: Ref in the godot-cpp repository.
type: string
default: 4.2
jobs:
unit-tests:
@ -130,3 +138,10 @@ jobs:
godot-treeish: ${{ inputs.godot-treeish }}
limboai-treeish: ${{ github.sha }}
test-build: true
gdextension:
name: 🔌 GDExtension test build
uses: ./.github/workflows/gdextension_linux.yml
with:
godot-cpp-version: 4.2
limboai-treeish: ${{ github.sha }}

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
# LimboAI-specific
demo/addons/
icons/*.import
# Godot auto generated files
*.gen.*

View File

@ -16,6 +16,10 @@ run/main_scene="res://examples/waypoints/example_waypoints.tscn"
config/features=PackedStringArray("4.2")
config/icon="res://icon.png"
[debug]
gdscript/warnings/native_method_override=1
[gui]
common/drop_mouse_on_gui_input_disabled=true

View File

@ -99,6 +99,15 @@ else
highlight -- Skipping limboai.gdextension. File already exists!
fi
if [ ! -e "${PWD}/demo/addons/limboai/icons/" ]; then
pushd demo/addons/limboai/ > /dev/null
ln -s ../../../icons icons
popd > /dev/null
highlight -- Linked icons.
else
highlight -- Skipping linking icons. File already exists!
fi
${PYTHON} limboai/gdextension/update_icons.py --silent
highlight -- Icon declarations updated.