Skip to content

Commit

Permalink
Fixed macOS support.
Browse files Browse the repository at this point in the history
ScopeConfig data is now stored separately to avoid creating new copies of Ref<>.
Extended description of DebugDraw3DScopeConfig.
Added a CI action to test API integration into the engine.
Added `.framework` folder generation for macOS.
Changed the way to get Godot executables. Now cache and downloading directly from the Godot repository is used.
Updated version to 1.3.1.
  • Loading branch information
DmitriySalnikov committed Jan 8, 2024
1 parent 481aaf6 commit fd98345
Show file tree
Hide file tree
Showing 18 changed files with 631 additions and 226 deletions.
12 changes: 8 additions & 4 deletions .github/actions/compile_gdextension/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ inputs:
description: Secrets token
telemetry_version:
description: Telemetry version
default: 2ed8ace3201d466c0bac4f0d40f05d2ec85a6bd3
default: 999c64d0e0fc4c51f64130728eec33805721f4aa
runs:
using: composite
steps:
Expand Down Expand Up @@ -116,9 +116,13 @@ runs:
shell: bash
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
strip -u $(find -L ${{inputs.output_libs_path}} -type f)
found_files=$(find -L ${{inputs.output_libs_path}} -type f -exec file {} + | grep "Mach-O universal" | cut -d: -f1)
echo "Found files: $found_files"
strip -u $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 @@ -135,7 +139,7 @@ runs:
path: ${{inputs.output_libs_path}}/*

- name: Save .scons_cache directory
if: ${{!steps.restore_scons_cache.outputs.cache-hit && inputs.use_cache != 'false'}}
if: inputs.use_cache != 'false'
uses: actions/cache/save@v3
with:
path: ${{env.SCONS_CACHE}}
Expand Down
31 changes: 0 additions & 31 deletions .github/actions/delete_artifact/action.yml

This file was deleted.

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
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@v3
with:
path: ${{steps.store_folder.outputs.path}}
key: godot-${{inputs.tag}}-${{inputs.file_suffix}}${{inputs.download_export_templates == 'true' && '-with_exports' || ''}}

- 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@v3
with:
path: ${{steps.store_folder.outputs.path}}
key: godot-${{inputs.tag}}-${{inputs.file_suffix}}${{inputs.download_export_templates == 'true' && '-with_exports' || ''}}
91 changes: 88 additions & 3 deletions .github/workflows/gdextension_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ jobs:
]
name: 📦 Collect GDExtension binaries
runs-on: ubuntu-latest
outputs:
artifact_name: ${{steps.output_info.outputs.artifact_name}}

steps:
- name: Checkout
Expand All @@ -242,19 +244,102 @@ jobs:

- name: Store all libraries in one directory
run: |
ls -R extracted_files/
arch_dirs=$(find extracted_files/ -mindepth 1 -maxdepth 1 -type d)
echo "Original structure:"
find extracted_files -mindepth 1
mv -f extracted_files/**/* extracted_files
rm -rf extracted_files/**/
rm -rf $arch_dirs
echo "Final structure:"
find extracted_files -mindepth 1
touch extracted_files/.gdignore
- name: Output file information
id: output_info
run: |
cd extracted_files
echo "Total size: $(du -ch -b | grep total | cut -f1 | awk '{printf "%.2f", $1/1048576}') MB, Total number of files: $(find . -type f | wc -l)" >> $GITHUB_STEP_SUMMARY
echo "artifact_name=${{env.PRODUCTION_BUILD == 'true' && '.gdextension_libs_production' || '.gdextension_libs'}}" >> $GITHUB_OUTPUT
- name: Upload GDExtension
uses: actions/upload-artifact@v4
with:
name: ${{env.PRODUCTION_BUILD == 'true' && '.gdextension_libs_production' || '.gdextension_libs'}}
name: ${{steps.output_info.outputs.artifact_name}}
retention-days: 7
path: extracted_files/*

# ============================================

test_api_integration:
name: "🧪 Testing API: ${{matrix.runner-os}}, Godot-${{matrix.file_suffix}}"
runs-on: ${{matrix.runner-os}}
needs: collect-gdextension

strategy:
fail-fast: false
matrix:
# sync with other jobs
runner-os: [ubuntu-20.04, macos-latest, windows-latest]
include:
- runner-os: ubuntu-20.04
file_suffix: "stable_linux.x86_64.zip"
- runner-os: macos-latest
file_suffix: "stable_macos.universal.zip"
- runner-os: windows-latest
file_suffix: "stable_win64.exe.zip"

env:
# Sync with container: image:
GODOT_VERSION: 4.2.1-stable
PROJECT_PATH: dd3d_web_build

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: true

- name: Delete old libs folder
shell: bash
run: |
rm -rf addons/debug_draw_3d/libs
- name: Download Binaries
uses: actions/download-artifact@v4
with:
path: addons/debug_draw_3d/libs
name: ${{needs.collect-gdextension.outputs.artifact_name}}

- name: Prepare Test Project
shell: bash
run: |
cp -r addons ${{env.PROJECT_PATH}}/addons
cp -r examples_dd3d ${{env.PROJECT_PATH}}/examples_dd3d
find ${{env.PROJECT_PATH}} -mindepth 1
- name: Setup Godot
uses: ./.github/actions/setup_godot
id: setup_godot
with:
tag: ${{env.GODOT_VERSION}}
file_suffix: ${{matrix.file_suffix}}
download_export_templates: false
is_mono: false

- name: Import Assets
shell: bash
run: ${{steps.setup_godot.outputs.godot}} -v -e --headless --path ${{env.PROJECT_PATH}} --quit || true

- name: Test Run
shell: bash
timeout-minutes: 2
run: |
${{steps.setup_godot.outputs.godot}} -v --headless --path ${{env.PROJECT_PATH}} res://headless_test.tscn || true
- name: Check Results
shell: bash
run: |
if [ ! -f "${{env.PROJECT_PATH}}/SUCCESS" ]; then
echo "The file reporting success has not been created! Failed."
exit 1
fi
2 changes: 1 addition & 1 deletion .github/workflows/util_update_libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Replace with new files
shell: bash
run: |
ls -R extracted_files
find extracted_files -mindepth 1
rm -rf ${{env.ADDON_LIBS_PATH}}/
mv -f extracted_files ${{env.ADDON_LIBS_PATH}}
Expand Down
Loading

0 comments on commit fd98345

Please sign in to comment.