Skip to content

Commit

Permalink
Telemetry sources are published
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriySalnikov committed Jan 12, 2025
1 parent 8a7dcfd commit 29d4104
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 19 deletions.
9 changes: 3 additions & 6 deletions .github/actions/compile_gdextension/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ inputs:
use_cache:
description: Use cache
default: "true"
token:
description: Secrets token
telemetry_version:
description: Telemetry version
default: b8386398c134f3c7503139e84f952d62207e54ae
default: 42efc0d98c6a0e7a104c5a878005ca07d70ad031
runs:
using: composite
steps:
Expand All @@ -49,10 +47,9 @@ runs:
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}}
repository: ${{github.repository_owner}}/dst_modules
ref: ${{inputs.telemetry_version}}
path: src/editor/my_telemetry_modules
path: src/editor/dst_modules

- name: Restore .scons_cache directory
if: inputs.use_cache != 'false'
Expand Down
28 changes: 21 additions & 7 deletions .github/workflows/gdextension_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,19 @@ env:
SCONS_CACHE: ${{github.workspace}}/.scons-cache/
USE_CACHE: ${{!format('{0}', inputs.use_cache) && 'true' || format('{0}', inputs.use_cache)}} # Default true
PRODUCTION_BUILD: ${{!format('{0}', inputs.production_build) && 'false' || format('{0}', inputs.production_build)}} # Default false
ENVIRONMENT_NAME: ${{inputs.production_build == 'true' && 'production' || ''}}
OUTPUT_LIBS_PATH: bin
FORCE_DISABLE_UNITY: yes
GH_TOKEN: ${{ github.token }}

jobs:
windows-gdextension:
name: 🏁 Windows
runs-on: windows-latest
environment: ${{inputs.production_build == true && 'production' || ''}}
env:
TELEMETRY_DD3D_APP_ID: ${{secrets.TELEMETRY_DD3D_APP_ID}}
TELEMETRY_DD3D_HOST: ${{secrets.TELEMETRY_DD3D_HOST}}
TELEMETRY_DST_FILE_KEY: ${{secrets.TELEMETRY_DST_FILE_KEY}}

strategy:
fail-fast: false
Expand All @@ -74,13 +79,17 @@ jobs:
additional: lto=yes
output_libs_path: ${{env.OUTPUT_LIBS_PATH}}
use_cache: ${{env.USE_CACHE}}
token: ${{secrets.TELEMETRY_TOKEN}}

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

linux-gdextension:
name: 🐧 Linux
runs-on: ubuntu-20.04
environment: ${{inputs.production_build == true && 'production' || ''}}
env:
TELEMETRY_DD3D_APP_ID: ${{secrets.TELEMETRY_DD3D_APP_ID}}
TELEMETRY_DD3D_HOST: ${{secrets.TELEMETRY_DD3D_HOST}}
TELEMETRY_DST_FILE_KEY: ${{secrets.TELEMETRY_DST_FILE_KEY}}

strategy:
fail-fast: false
Expand All @@ -104,13 +113,17 @@ jobs:
additional: lto=yes
output_libs_path: ${{env.OUTPUT_LIBS_PATH}}
use_cache: ${{env.USE_CACHE}}
token: ${{secrets.TELEMETRY_TOKEN}}

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

macos-gdextension:
name: 🍏 MacOS
runs-on: macos-latest
environment: ${{inputs.production_build == true && 'production' || ''}}
env:
TELEMETRY_DD3D_APP_ID: ${{secrets.TELEMETRY_DD3D_APP_ID}}
TELEMETRY_DD3D_HOST: ${{secrets.TELEMETRY_DD3D_HOST}}
TELEMETRY_DST_FILE_KEY: ${{secrets.TELEMETRY_DST_FILE_KEY}}

strategy:
fail-fast: false
Expand All @@ -134,7 +147,6 @@ jobs:
additional: lto=yes macos_deployment_target=10.14
output_libs_path: ${{env.OUTPUT_LIBS_PATH}}
use_cache: ${{env.USE_CACHE}}
token: ${{secrets.TELEMETRY_TOKEN}}

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

Expand Down Expand Up @@ -164,7 +176,6 @@ jobs:
additional: lto=yes
output_libs_path: ${{env.OUTPUT_LIBS_PATH}}
use_cache: ${{env.USE_CACHE}}
token: ${{secrets.TELEMETRY_TOKEN}}

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

Expand Down Expand Up @@ -284,6 +295,11 @@ jobs:
double-debug-gdextension:
name: "2️⃣ Double: ${{matrix.runner-os}}, Platform-${{matrix.platform}}"
runs-on: ${{matrix.runner-os}}
environment: ${{inputs.production_build == true && 'production' || ''}}
env:
TELEMETRY_DD3D_APP_ID: ${{secrets.TELEMETRY_DD3D_APP_ID}}
TELEMETRY_DD3D_HOST: ${{secrets.TELEMETRY_DD3D_HOST}}
TELEMETRY_DST_FILE_KEY: ${{secrets.TELEMETRY_DST_FILE_KEY}}

strategy:
fail-fast: false
Expand Down Expand Up @@ -317,7 +333,6 @@ jobs:
additional: lto=yes precision=double fix_precision_enabled=yes shader_world_coords_enabled=no
output_libs_path: ${{env.OUTPUT_LIBS_PATH}}
use_cache: ${{env.USE_CACHE}}
token: ${{secrets.TELEMETRY_TOKEN}}

- name: Compile GDExtension target=template_release
uses: ./.github/actions/compile_gdextension
Expand All @@ -329,7 +344,6 @@ jobs:
additional: lto=yes precision=double fix_precision_enabled=yes shader_world_coords_enabled=no
output_libs_path: ${{env.OUTPUT_LIBS_PATH}}
use_cache: ${{env.USE_CACHE}}
token: ${{secrets.TELEMETRY_TOKEN}}

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

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ bin/
libs/
cmake_build_out/*
src/gen/*
src/editor/my_telemetry_modules
src/editor/dst_modules
addons/debug_draw_3d/gen/
clang_rt.asan_*
docs/images/classes/temp/
Expand Down
12 changes: 10 additions & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,17 @@ def setup_defines_and_flags(env: SConsEnvironment, src_out):
env.Append(CPPDEFINES=["DISABLE_DEBUG_RENDERING"])

if env["telemetry_enabled"]:
tele_src = "editor/my_telemetry_modules/GDExtension/usage_time_reporter.cpp"
tele_src = "editor/dst_modules/GDExtension/usage_time_reporter.cpp"
if os.path.exists(os.path.join(src_folder, tele_src)):
env.Append(CPPDEFINES=["TELEMETRY_ENABLED", "TELEMETRY_PROJECT_DD3D"])
env.Append(
CPPDEFINES=[
"TELEMETRY_ENABLED",
"UsageTimeReporterGodotObj=_UsageTimeReporterGodotObjDD3D",
'TELEMETRY_DST_FILE_KEY=\\"' + os.environ.get("TELEMETRY_DST_FILE_KEY", '\\"') + '\\"',
'TELEMETRY_APP_ID=\\"' + os.environ.get("TELEMETRY_DD3D_APP_ID", '\\"') + '\\"',
'TELEMETRY_HOST=\\"' + os.environ.get("TELEMETRY_DD3D_HOST", '\\"') + '\\"',
]
)
src_out.append(tele_src)
print("Compiling with telemetry support!")
else:
Expand Down
5 changes: 2 additions & 3 deletions src/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GODOT_WARNING_DISABLE()
GODOT_WARNING_RESTORE()

#ifdef TELEMETRY_ENABLED
#include "editor/my_telemetry_modules/GDExtension/usage_time_reporter.h"
#include "editor/dst_modules/GDExtension/usage_time_reporter.h"
DEFINE_TELEMETRY_OBJECT_ID(dd3d_usage_obj_id);
#endif

Expand Down Expand Up @@ -77,7 +77,7 @@ void initialize_debug_draw_3d_module(ModuleInitializationLevel p_level) {
upd_checker.instantiate();

#ifdef TELEMETRY_ENABLED
INIT_EDITOR_TELEMETRY_OBJECT(dd3d_usage_obj_id, DD3D_VERSION_STR, Utils::root_settings_section);
INIT_EDITOR_TELEMETRY_OBJECT(dd3d_usage_obj_id, "Debug Draw 3D", TELEMETRY_APP_ID, DD3D_VERSION_STR, Utils::root_settings_section, TELEMETRY_HOST, "telemetry_dd3d.json");
#endif
}
#endif
Expand All @@ -87,7 +87,6 @@ void initialize_debug_draw_3d_module(ModuleInitializationLevel p_level) {
/** GDExtension Uninitialize **/
void uninitialize_debug_draw_3d_module(ModuleInitializationLevel p_level) {
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) {

// If this library is disabled manually before deleting the scene tree (hot-reload),
// then an attempt is made to delete this node manually.
DebugDrawManager *debug_draw_manager = Object::cast_to<DebugDrawManager>(ObjectDB::get_instance(debug_draw_manager_id));
Expand Down

0 comments on commit 29d4104

Please sign in to comment.