Skip to content

Commit

Permalink
updated godot-cpp to 4.1.4 and updated build scripts
Browse files Browse the repository at this point in the history
changed the publishing method
added test scene
  • Loading branch information
DmitriySalnikov committed Sep 11, 2024
1 parent 3266e53 commit a06a8cb
Show file tree
Hide file tree
Showing 36 changed files with 1,313 additions and 486 deletions.
15 changes: 0 additions & 15 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,17 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

# Ignore some files when exporting to a ZIP.
/.clang-format export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.gitmodules export-ignore
/.github export-ignore
/LICENSE export-ignore
/SConstruct export-ignore
/*.* export-ignore
/src export-ignore
/godot-cpp export-ignore
/jni export-ignore
/patches export-ignore
/testsuite export-ignore
85 changes: 55 additions & 30 deletions .github/actions/compile_gdextension/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,58 @@ inputs:
description: Arch (universal|x86_32|x86_64|arm32|arm64|rv64|ppc32|ppc64|wasm32)
required: true
default: ""
artifact:
description: Artifact name. This name will be used for caching.
required: true
default: "bin"
additional:
description: Any additional arguments
default: ""
output_libs_path:
description: Path to compiled libraries
required: true
default: "bin"
use_cache:
description: Use cache
default: "true"
artifact:
description: Artifact name
required: true
default: "bin"
additional:
description: Any additional arguments
default: ""
token:
description: Secrets token
telemetry_version:
description: Telemetry version
default: 5e90ce91d776996bc12dce2ce39b5dedb031609d
runs:
using: "composite"
using: composite
steps:
- name: Get godot-cpp SHA
shell: bash
id: get_godot_cpp_sha
run: |
echo "sha=$(git rev-parse @:./godot-cpp)" >> $GITHUB_OUTPUT
- name: Checkout telemetry repo
uses: actions/checkout@v4
id: checkout_tele_repo
if: ${{env.PRODUCTION_BUILD == 'true' && contains(fromJSON('["template_debug", "editor"]'), inputs.target) && contains(fromJSON('["linux", "macos", "windows"]'), inputs.platform)}}
#continue-on-error: true
with:
repository: ${{github.repository_owner}}/my_telemetry_modules
token: ${{inputs.token}}
ref: ${{inputs.telemetry_version}}
path: src/my_telemetry_modules

- name: Restore .scons_cache directory
if: inputs.use_cache != 'false'
uses: actions/cache/restore@v3
id: restore_scons_cache
uses: actions/cache/restore@v4
with:
path: ${{env.SCONS_CACHE}}
key: ${{github.job}}-${{inputs.arch}}_${{inputs.target}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}-${{github.sha}}
key: ${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{inputs.arch}}_${{inputs.target}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}
${{github.job}}-${{inputs.arch}}_${{inputs.target}}-${{steps.get_godot_cpp_sha.outputs.sha}}
continue-on-error: true
${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}
${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}
- name: Set up Python 3.x
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.x"
architecture: "x64"
Expand All @@ -64,33 +80,43 @@ runs:
- name: Linux dependencies
shell: bash
if: runner.os == 'Linux'
if: (runner.os == 'Linux') && (inputs.platform == 'linux')
run: |
sudo apt-get update
sudo apt update
if [[ "${{inputs.arch}}" == *"32" ]];then
sudo apt-get install gcc-multilib g++-multilib
sudo apt install gcc-multilib g++-multilib
fi
- name: Compilation
shell: bash
run: |
echo "::group::🛠️ GDExtesion Compilation 🛠️"
cd godot-cpp
git apply --ignore-space-change --ignore-whitespace ../patches/visibilty_hidden.patch
git apply --ignore-space-change --ignore-whitespace ../patches/godot_cpp_exclude_unused_classes.patch
git apply --ignore-space-change --ignore-whitespace ../patches/unity_build.patch
cd ..
scons platform=${{inputs.platform}} arch=${{inputs.arch}} target=${{inputs.target}} addon_output_dir=${{inputs.output_libs_path}} ${{inputs.additional}}
scons apply_patches
telemetry_args=""
if [[ "${{env.PRODUCTION_BUILD}}" == "true" && " template_debug editor " == *" ${{inputs.target}} "* && " linux macos windows " == *" ${{inputs.platform}} "* && "${{steps.checkout_tele_repo.conclusion}}" == "success" ]]; then
telemetry_args="telemetry_enabled=yes"
fi
scons_params="platform=${{inputs.platform}} arch=${{inputs.arch}} target=${{inputs.target}} addon_output_dir=${{inputs.output_libs_path}} ${{inputs.additional}}"
scons $scons_params $telemetry_args
echo "::endgroup::"
- name: Prepare artifact Unix
if: runner.os != 'Windows' && inputs.platform != 'android' && inputs.platform != 'web'
shell: bash
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
strip -u $(find -L ${{inputs.output_libs_path}} -type f)
if [ "${{inputs.platform}}" == 'ios' ] || [ "${{inputs.platform}}" == 'macos' ]; then
found_files=$(find -L ${{inputs.output_libs_path}} -type f -iname "*.dylib")
echo "Found files: $found_files"
while IFS= read -r file; do
echo "Strip '$file'"
strip -u "$file"
done <<< "$found_files"
else
strip $(find -L ${{inputs.output_libs_path}} -type f)
found_files=$(find -L ${{inputs.output_libs_path}} -type f -exec file {} + | grep "ELF" | cut -d: -f1)
echo "Found files: $found_files"
strip $found_files
fi
- name: Prepare artifact Windows
Expand All @@ -100,16 +126,15 @@ runs:
Remove-Item ${{inputs.output_libs_path}}/* -Recurse -Include *.exp,*.lib,*.pdb -Force
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{inputs.artifact}}
retention-days: 7
path: ${{inputs.output_libs_path}}/*

- name: Save .scons_cache directory
if: inputs.use_cache != 'false'
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
path: ${{env.SCONS_CACHE}}
key: ${{github.job}}-${{inputs.arch}}_${{inputs.target}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}-${{github.sha}}
continue-on-error: true
key: ${{github.job}}-${{inputs.artifact}}-${{steps.get_godot_cpp_sha.outputs.sha}}-${{github.ref}}-${{github.sha}}
135 changes: 135 additions & 0 deletions .github/actions/setup_godot/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Download Godot Engine
description: Download Godot Engine executable and export templates
inputs:
tag:
description: Release tag in the official repository (4.2.1-stable, 4.1.3-stable, 4.1-stable)
required: true
file_suffix:
description: The name of the file to download.
required: true
download_export_templates:
description: Whether export templates need to be downloaded (true|false).
default: "false"
required: false
is_mono:
description: Whether Godot and export templates support dotnet (true|false).
default: "false"
required: false
outputs:
godot_folder:
description: Path to the Godot executable file
value: ${{steps.store_folder.outputs.path}}
godot:
description: Path to the Godot executable file
value: ${{steps.store_folder.outputs.exe}}
runs:
using: composite
steps:
- name: Store Godot folder
id: store_folder
env:
temp: ${{runner.temp}}
shell: bash
run: |
tmp_path="${{env.temp}}"
tmp_path_unix="${{env.temp}}"
if [ "${{runner.os}}" == "Windows" ]; then
tmp_path_unix=$(cygpath -u "${{env.temp}}")
echo "Fixed path: $tmp_path_unix"
fi
echo "path=$tmp_path/godot_installation" >> $GITHUB_OUTPUT
echo "path_unix=$tmp_path_unix/godot_installation" >> $GITHUB_OUTPUT
if [[ "${{inputs.file_suffix}}" == *"macos"* ]]; then
echo "exe=$tmp_path_unix/godot_installation/Godot.app/Contents/MacOS/Godot" >> $GITHUB_OUTPUT
else
echo "exe=$tmp_path_unix/godot_installation/godot" >> $GITHUB_OUTPUT
fi
- name: Restore cache directory
id: restore_scons_cache
uses: actions/cache/restore@v4
with:
path: ${{steps.store_folder.outputs.path}}
key: godot-${{inputs.tag}}-${{inputs.file_suffix}}${{inputs.download_export_templates == 'true' && '-with_exports' || ''}}-installation

- name: Download Godot Engine
uses: robinraju/[email protected]
if: ${{!steps.restore_scons_cache.outputs.cache-hit}}
with:
repository: "godotengine/godot"
tag: "${{inputs.tag}}"
fileName: "*${{inputs.file_suffix}}"
out-file-path: "temp_download"
extract: true

- name: Download templates
uses: robinraju/[email protected]
if: ${{!steps.restore_scons_cache.outputs.cache-hit && inputs.download_export_templates == 'true'}}
with:
repository: "godotengine/godot"
tag: "${{inputs.tag}}"
fileName: "*${{inputs.tag}}${{inputs.is_mono == 'true' && '_mono' || ''}}_export_templates.tpz"
out-file-path: "temp_download"

- name: Finish preparation
if: ${{!steps.restore_scons_cache.outputs.cache-hit}}
shell: bash
run: |
if [ "${{inputs.is_mono}}" == "true" ]; then
echo "Move the Mono files to the root of the temporary folder"
mv -f Godot*/* temp_download/ || true
mv -f godot*/* temp_download/ || true
fi
echo "Unzip templates"
if [ "${{inputs.download_export_templates}}" == "true" ]; then
templates_dir="temp_download/editor_data/export_templates"
mkdir -p $templates_dir
unzip temp_download/*_export_templates.tpz -d $templates_dir
version=$(cat $templates_dir/templates/version.txt)
mv $templates_dir/templates $templates_dir/$version
fi
echo "Remove archives"
rm -rf temp_download/*.zip
rm -rf temp_download/*.tpz
# Get files
files=$(find temp_download/ -mindepth 1 -maxdepth 1 -type f)
echo "Found files:"
echo ${files[@]}
# Rename everything to godot..
for file in $files; do
folder_basename=$(basename "$file")
if [[ "$folder_basename" == *"_console.exe" ]]; then
mv -f $file temp_download/godot_console.exe
elif [[ "$folder_basename" == *".exe" ]]; then
mv -f $file temp_download/godot.exe
elif [[ "$folder_basename" == "Godot"* || "$folder_basename" == "godot"* ]]; then
mv -f $file temp_download/godot
# Fix permissions on Unix
chmod +x temp_download/godot
fi
done
echo "Move files to installation folder"
mv -f temp_download/ ${{steps.store_folder.outputs.path_unix}}/
touch ${{steps.store_folder.outputs.path_unix}}/._sc_
echo "Final folder structure:"
find ${{steps.store_folder.outputs.path_unix}} -mindepth 1
if [[ "${{steps.store_folder.outputs.exe}}" == *"Godot.app"* ]]; then
echo "Fix permissions on macOS"
chmod 755 "${{steps.store_folder.outputs.exe}}"
fi
- name: Save cache directory
if: ${{!steps.restore_scons_cache.outputs.cache-hit}}
uses: actions/cache/save@v4
with:
path: ${{steps.store_folder.outputs.path}}
key: godot-${{inputs.tag}}-${{inputs.file_suffix}}${{inputs.download_export_templates == 'true' && '-with_exports' || ''}}-installation
Loading

0 comments on commit a06a8cb

Please sign in to comment.