From 2d2aa1cbb06c026afbc882f82b29a8d974b8a3a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Chrobot?= <124174716+michalChrobot@users.noreply.github.com> Date: Mon, 3 Nov 2025 15:21:38 +0100 Subject: [PATCH] chore: Small automations update (#3772) * Added possibility to specify sample branch * Updated variable check to be case insensitive * Added debug info * Corrected release automation frequency and changed branch for local testing * typo * test * corrected frequency * test * Updated corrected trigger --- .yamato/ngo-publish.yml | 2 +- .yamato/project-builders/builder.metafile | 3 ++- .yamato/project-builders/project-builders.yml | 15 ++++++++------- .../BuildAutomation/disable-enable-burst.py | 4 ++-- .../BuildAutomation/validate_params.py | 19 +++++++------------ 5 files changed, 20 insertions(+), 23 deletions(-) diff --git a/.yamato/ngo-publish.yml b/.yamato/ngo-publish.yml index 05671ecf1d..b2f9932b2f 100644 --- a/.yamato/ngo-publish.yml +++ b/.yamato/ngo-publish.yml @@ -4,7 +4,7 @@ ngo_release_preparation: triggers: recurring: - branch: develop # We make new releases from this branch - frequency: "10 * * 1" # Runs every Sunday at 10:00 AM + frequency: "10 ? * 1" # Runs every Sunday at 10:00 AM rerun: always commands: - pip install PyGithub diff --git a/.yamato/project-builders/builder.metafile b/.yamato/project-builders/builder.metafile index 9df87c2aac..026888497d 100644 --- a/.yamato/project-builders/builder.metafile +++ b/.yamato/project-builders/builder.metafile @@ -2,10 +2,11 @@ NetcodeProjects: # Note that we are using internal Unity repo. This means that we may test with newest changes that are not yet released to our users (there are also public versions) + # The parameters specify repo location, default branch to use (since you can modify it via job variable), path to manifest.json file so we can replace package entry and path to the project root folder since it differs between projects # Note that for BossRoom 'main' branch supports NGOv1.X and 'develop' branch supports NGOv2.X # Recently (19.08.2025) BossRoom got an update to 3.0.0 version which updated everything to U6 and NGOv2.X. Because of that I branched out from last commit that was supporting NGOv1.X for our playtest usage BossRoom: GithubRepo: "https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git" - branch: playtest/ngo-1.x + defaultBranch: playtest/ngo-1.x manifestPath: Packages/manifest.json projectPath: '.' diff --git a/.yamato/project-builders/project-builders.yml b/.yamato/project-builders/project-builders.yml index 5d5fe3d7d6..322a194c61 100644 --- a/.yamato/project-builders/project-builders.yml +++ b/.yamato/project-builders/project-builders.yml @@ -30,13 +30,14 @@ build_{{ netcodeProject[0] }}_project: SCRIPTING_BACKEND_IL2CPP_MONO: il2cpp BURST_ON_OFF: on PLATFORM_WIN64_MAC_ANDROID: win64 + SAMPLE_BRANCH: {{ netcodeProject[1].defaultBranch }} commands: # Validate inputs passed via Yamato variables - python Tools/scripts/BuildAutomation/validate_params.py - - echo Building {{ netcodeProject[0] }} project with Unity version of %UNITY_VERSION%, Scripting backend %SCRIPTING_BACKEND_IL2CPP_MONO%, Burst %BURST_ON_OFF% for platform %PLATFORM_WIN64_MAC_ANDROID% + - echo Building {{ netcodeProject[0] }} project from branch {{ netcodeProject[1].defaultBranch }} with Unity version of %UNITY_VERSION%, Scripting backend %SCRIPTING_BACKEND_IL2CPP_MONO%, Burst %BURST_ON_OFF% for platform %PLATFORM_WIN64_MAC_ANDROID% # Clone the external project repository into a specific directory. Notice that branch is also specified. - - git clone --single-branch --branch {{ netcodeProject[1].branch }} {{ netcodeProject[1].GithubRepo }} C:/ClonedProject + - git clone --single-branch --branch %SAMPLE_BRANCH% {{ netcodeProject[1].GithubRepo }} C:/ClonedProject # Modify the external project's manifest to use the local N4E package from current branch on which this Yamato job is running. (requires python that should be preinstalled in the image) - python Tools/scripts/BuildAutomation/manifest_update.py --manifest-path C:/ClonedProject/{{ netcodeProject[1].manifestPath }} --local-package-path %YAMATO_SOURCE_DIR%/com.unity.netcode.gameobjects @@ -61,21 +62,21 @@ build_{{ netcodeProject[0] }}_project: # Build the project using Unity Editor. This will call the given static BuilderScripts method. # Ideally, it would be nice to parametrize the BuilderScripts (for example to pass scripting backend as parameter) but -executeMethod only calls static methods without parameters so for now we will have multiple configurations # Notice that for Android platform even if mono is selected, il2cpp will be used since mono is not supported for Android builds. - - IF "%PLATFORM_WIN64_MAC_ANDROID%"=="win64" ( - IF "%SCRIPTING_BACKEND_IL2CPP_MONO%"=="il2cpp" ( + - IF /I "%PLATFORM_WIN64_MAC_ANDROID%"=="win64" ( + IF /I "%SCRIPTING_BACKEND_IL2CPP_MONO%"=="il2cpp" ( C:/TestingEditor/Unity.exe -projectPath C:/ClonedProject/{{ netcodeProject[1].projectPath }} -buildTarget win64 -executeMethod BuilderScripts.BuildWinIl2cpp -batchmode -logFile ./artifacts/UnityLog.txt -automated -crash-report-folder ./artifacts/CrashArtifacts -quit ) ELSE ( C:/TestingEditor/Unity.exe -projectPath C:/ClonedProject/{{ netcodeProject[1].projectPath }} -buildTarget win64 -executeMethod BuilderScripts.BuildWinMono -batchmode -logFile ./artifacts/UnityLog.txt -automated -crash-report-folder ./artifacts/CrashArtifacts -quit ) ) - ELSE IF "%PLATFORM_WIN64_MAC_ANDROID%"=="mac" ( - IF "%SCRIPTING_BACKEND_IL2CPP_MONO%"=="il2cpp" ( + ELSE IF /I "%PLATFORM_WIN64_MAC_ANDROID%"=="mac" ( + IF /I "%SCRIPTING_BACKEND_IL2CPP_MONO%"=="il2cpp" ( C:/TestingEditor/Unity.exe -projectPath C:/ClonedProject/{{ netcodeProject[1].projectPath }} -buildTarget osx -executeMethod BuilderScripts.BuildMacIl2cpp -batchmode -logFile ./artifacts/UnityLog.txt -automated -crash-report-folder ./artifacts/CrashArtifacts -quit ) ELSE ( C:/TestingEditor/Unity.exe -projectPath C:/ClonedProject/{{ netcodeProject[1].projectPath }} -buildTarget osx -executeMethod BuilderScripts.BuildMacMono -batchmode -logFile ./artifacts/UnityLog.txt -automated -crash-report-folder ./artifacts/CrashArtifacts -quit ) ) - ELSE IF "%PLATFORM_WIN64_MAC_ANDROID%"=="android" ( + ELSE IF /I "%PLATFORM_WIN64_MAC_ANDROID%"=="android" ( C:/TestingEditor/Unity.exe -projectPath C:/ClonedProject/{{ netcodeProject[1].projectPath }} -buildTarget android -executeMethod BuilderScripts.BuildAndroidIl2cpp -batchmode -logFile ./artifacts/UnityLog.txt -automated -crash-report-folder ./artifacts/CrashArtifacts -quit ) diff --git a/Tools/scripts/BuildAutomation/disable-enable-burst.py b/Tools/scripts/BuildAutomation/disable-enable-burst.py index 9c295bd5a5..d9cd0b29e6 100644 --- a/Tools/scripts/BuildAutomation/disable-enable-burst.py +++ b/Tools/scripts/BuildAutomation/disable-enable-burst.py @@ -52,7 +52,7 @@ def create_config(settings_path): # Note that this jobs uses environment variables to pass parameters to the script. def resolve_target(): # Get the platform value from the environment variable - platform_key = os.environ.get('PLATFORM_WIN64_MAC_ANDROID') + platform_key = os.environ.get('PLATFORM_WIN64_MAC_ANDROID').lower() resolved_target = platform_key if 'win64' == platform_key: @@ -95,7 +95,7 @@ def main(): parse_args() config_names = get_or_create_burst_AOT_config() - platform_key = os.environ.get('PLATFORM_WIN64_MAC_ANDROID') + platform_key = os.environ.get('PLATFORM_WIN64_MAC_ANDROID').lower() print(f"Burst compilation script: Unity project path is {args.project_path}") print(f"Burst compilation script: Target platform is {platform_key}") diff --git a/Tools/scripts/BuildAutomation/validate_params.py b/Tools/scripts/BuildAutomation/validate_params.py index d95c065626..4c105836cc 100644 --- a/Tools/scripts/BuildAutomation/validate_params.py +++ b/Tools/scripts/BuildAutomation/validate_params.py @@ -1,4 +1,4 @@ -import os +import os import sys # --- Configuration --- @@ -17,13 +17,11 @@ def main(): """ all_params_valid = True - # Iterate through the dictionary of rules. for var_name, allowed_values in VALIDATION_RULES.items(): - # Get the variable's value from the environment. - actual_value = os.environ.get(var_name, '') + actual_value = os.environ.get(var_name, '').lower() + allowed_values_lower = {v.lower() for v in allowed_values} - # Check if the actual value is in the set of allowed values. - if actual_value not in allowed_values: + if actual_value not in allowed_values_lower: print( f"ERROR: Invalid {var_name}: '{actual_value}'. " f"Allowed values are: {list(allowed_values)}", @@ -31,9 +29,8 @@ def main(): ) all_params_valid = False - # --- Validation for Invalid Combinations --- - platform = os.environ.get('PLATFORM_WIN64_MAC_ANDROID') - scripting_backend = os.environ.get('SCRIPTING_BACKEND_IL2CPP_MONO') + platform = os.environ.get('PLATFORM_WIN64_MAC_ANDROID', '').lower() + scripting_backend = os.environ.get('SCRIPTING_BACKEND_IL2CPP_MONO', '').lower() if platform == 'mac' and scripting_backend == 'il2cpp': print( @@ -51,13 +48,11 @@ def main(): ) all_params_valid = False - # --- Final Result --- if not all_params_valid: print("\nOne or more parameters failed validation. Halting build.", file=sys.stderr) - # Exit with a non-zero code to fail the Yamato job. sys.exit(1) print("All parameters are valid. Proceeding with the build.") if __name__ == "__main__": - main() + main() \ No newline at end of file