From d2b321e9e9326da6b61f6ee5612772e31f3be2e0 Mon Sep 17 00:00:00 2001 From: michalChrobot Date: Tue, 5 Aug 2025 10:28:52 +0200 Subject: [PATCH 1/9] removed disable-burst file --- .yamato/disable-burst-if-requested.py | 97 --------------------------- 1 file changed, 97 deletions(-) delete mode 100644 .yamato/disable-burst-if-requested.py diff --git a/.yamato/disable-burst-if-requested.py b/.yamato/disable-burst-if-requested.py deleted file mode 100644 index edf84d3f26..0000000000 --- a/.yamato/disable-burst-if-requested.py +++ /dev/null @@ -1,97 +0,0 @@ -# This file was used before for mobiles and Webgl but was removed (around end of January 2025). The file itself was left here for now in case we would need to use it. -# This Python script is used to manage Burst AOT (Ahead-Of-Time) compilation settings for Unity builds. -# An example usage would be "- python .yamato/disable-burst-if-requested.py --project-path {{ project.path }} --platform WebGL" - -import argparse -import json -import os - - -args = None -platform_plugin_definition = None - - -def resolve_target(platform): - resolved_target = platform - if 'StandaloneWindows' in platform: - resolved_target = 'StandaloneWindows' - elif 'StandaloneLinux' in platform: - resolved_target = 'StandaloneLinux64' - - return resolved_target - - -def create_config(settings_path, platform): - config_name = os.path.join(settings_path, 'BurstAotSettings_{}.json'.format(resolve_target(platform))) - monobehaviour = { - 'm_Enabled': True, - 'm_EditorHideFlags': 0, - 'm_Name': "", - 'm_EditorClassIdentifier': 'Unity.Burst.Editor:Unity.Burst.Editor:BurstPlatformAotSettings', - 'DisableOptimisations': False, - 'DisableSafetyChecks': True, - 'DisableBurstCompilation': False - } - - data = {'MonoBehaviour': monobehaviour} - with open(config_name, 'w') as f: - json.dump(data, f) - return config_name - - -def get_or_create_AOT_config(project_path, platform): - settings_path = os.path.join(project_path, 'ProjectSettings') - if not os.path.isdir(settings_path): - os.mkdir(settings_path) - config_names = [os.path.join(settings_path, filename) for filename in os.listdir(settings_path) if filename.startswith("BurstAotSettings_{}".format(resolve_target(platform)))] - if not config_names: - return [create_config(settings_path, platform)] - return config_names - - -def disable_AOT(project_path, platform): - config_names = get_or_create_AOT_config(project_path, platform) - for config_name in config_names: - set_AOT(config_name, True) - - -def enable_AOT(project_path, platform): - config_names = get_or_create_AOT_config(project_path, platform) - for config_name in config_names: - set_AOT(config_name, False) - - -def set_AOT(config_file, status): - config = None - with open(config_file, 'r') as f: - config = json.load(f) - - assert config is not None, 'AOT settings not found; did the burst-enabled build finish successfully?' - - config['MonoBehaviour']['DisableBurstCompilation'] = status - with open(config_file, 'w') as f: - json.dump(config, f) - - -def main(): - enable_burst = os.environ.get('ENABLE_BURST_COMPILATION', 'true').strip().lower() - if enable_burst == 'true': - print('BURST COMPILATION: ENABLED') - elif enable_burst == 'false': - print('BURST COMPILATION: DISABLED') - disable_AOT(args.project_path, args.platform) - else: - sys.exit('BURST COMPILATION: unexpected value: {}'.format(enable_burst)) - - -def parse_args(): - global args - parser = argparse.ArgumentParser(description='This tool disables burst AOT compilation') - parser.add_argument('--project-path', help='Specify the location of the unity project.') - parser.add_argument('--platform', help="Platform to be used to run the build.") - args = parser.parse_args() - - -if __name__ == '__main__': - parse_args() - main() \ No newline at end of file From 60d73736d0d6f990a61ed2241f9429f997655d22 Mon Sep 17 00:00:00 2001 From: michalChrobot Date: Tue, 5 Aug 2025 10:29:19 +0200 Subject: [PATCH 2/9] Running CI only on comment trigger --- .github/workflows/pr-keyword-check.yml | 10 ++++++++++ .yamato/_triggers.yml | 27 ++++++++++++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/pr-keyword-check.yml diff --git a/.github/workflows/pr-keyword-check.yml b/.github/workflows/pr-keyword-check.yml new file mode 100644 index 0000000000..4b58d79741 --- /dev/null +++ b/.github/workflows/pr-keyword-check.yml @@ -0,0 +1,10 @@ +name: PR keyword check +on: + workflow_dispatch: + +# This workflow deliberately does nothing of value. The branch rules require the associated "Check PR issue comments for trigger keywords" job to have run before the PR being merged +jobs: + pr-keyword-check: + runs-on: unity-linux-runner + steps: + - run: ls diff --git a/.yamato/_triggers.yml b/.yamato/_triggers.yml index 6a274f869c..e345a450b1 100644 --- a/.yamato/_triggers.yml +++ b/.yamato/_triggers.yml @@ -15,6 +15,8 @@ # Focuses on critical validation paths that we should validate before merging PRs # Cancels previous runs on new commits # Excludes draft PRs + # Excludes running when changes ONLY touching documentation files + # Requires `/ci ngo` or `/ci ignore` comment to trigger the job. This was implemented and explained in https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/pull/3577 # Nightly: # This test validates same subset as pull_request_trigger with addition of mobile/console tests and webgl builds @@ -38,6 +40,20 @@ #----------------------------------------------------------------------------------- +# Gates the merger of PRs as a pre-requisite. Runs when `/ci ngo` or `/ci ignore` is present as an issue comment +# Notice that I needed this job to do "something" and that's why there is a placeholder GitHub action used +# TODO: In the future we could have comment like "docs" or "project" to run a specific subset of tests +check_pr_issue_comments_for_trigger_keywords: + name: Check PR for trigger comments of ngo or ignore. For example /ci ngo + agent: + type: Unity::github::action + action_source: pr-keyword-check.yml + triggers: + expression: |- + pull_request.comment eq "ngo" OR + pull_request.comment eq "ignore" + + # Run all relevant tasks when a pull request targeting the develop or release branch is created or updated. # In order to have better coverage we run desktop standalone tests with different configurations which allows to mostly cover for different platforms, scripting backends and editor versions. # Since standards job is a part of initial checks it's not present as direct dependency here @@ -61,15 +77,10 @@ pull_request_trigger: # Coverage on other standalone machines is present in Nightly job so it's enough to not run all of them for PRs - .yamato/desktop-standalone-tests.yml#desktop_standalone_test_testproject_ubuntu_il2cpp_2022.3 triggers: + expression: |- + pull_request.comment eq "ngo" AND + NOT pull_request.changes.all match "**/Documentation~/**" cancel_old_ci: true - pull_requests: - - targets: - only: - - "develop" - - "develop-2.0.0" - - "/release\/.*/" - - drafts: false - # Run all tests on trunk on nightly basis. # Same subset as pull_request_trigger with addition of mobile/desktop/console tests and webgl builds From f82b973fa388ee63cd70a5f7c45177a3482ed682 Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Fri, 29 Aug 2025 15:05:22 +0200 Subject: [PATCH 3/9] modify trigger to match against ONLY package or testproject changes --- .yamato/_triggers.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.yamato/_triggers.yml b/.yamato/_triggers.yml index e345a450b1..93bf824420 100644 --- a/.yamato/_triggers.yml +++ b/.yamato/_triggers.yml @@ -77,9 +77,13 @@ pull_request_trigger: # Coverage on other standalone machines is present in Nightly job so it's enough to not run all of them for PRs - .yamato/desktop-standalone-tests.yml#desktop_standalone_test_testproject_ubuntu_il2cpp_2022.3 triggers: + # Note that PR tests will run ONLY if we are changing package/sample code. If changes are let's say docs only no tests will be triggered + # TODO: consider setting up and running tests from Examples/ + # TODO: or docs only changes are spelling/link check expression: |- pull_request.comment eq "ngo" AND - NOT pull_request.changes.all match "**/Documentation~/**" + (pull_request.changes.any match "com.unity.netcode.gameobjects/**" OR + pull_request.changes.any match "testproject/**") cancel_old_ci: true # Run all tests on trunk on nightly basis. From 0ad2d0f121824f0158c2a0b26232bee0949221b3 Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Tue, 2 Sep 2025 15:13:56 +0200 Subject: [PATCH 4/9] changed runner test --- .github/workflows/pr-keyword-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-keyword-check.yml b/.github/workflows/pr-keyword-check.yml index 4b58d79741..e08a538d61 100644 --- a/.github/workflows/pr-keyword-check.yml +++ b/.github/workflows/pr-keyword-check.yml @@ -5,6 +5,6 @@ on: # This workflow deliberately does nothing of value. The branch rules require the associated "Check PR issue comments for trigger keywords" job to have run before the PR being merged jobs: pr-keyword-check: - runs-on: unity-linux-runner + runs-on: ubuntu-latest steps: - run: ls From 088a6fd1e30a9f6be424eac08f356caa929e400c Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Tue, 2 Sep 2025 15:19:46 +0200 Subject: [PATCH 5/9] Removed gihub action check since we can't trigger it from public repo --- .github/workflows/pr-keyword-check.yml | 10 ---------- .yamato/_triggers.yml | 5 +++-- 2 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 .github/workflows/pr-keyword-check.yml diff --git a/.github/workflows/pr-keyword-check.yml b/.github/workflows/pr-keyword-check.yml deleted file mode 100644 index e08a538d61..0000000000 --- a/.github/workflows/pr-keyword-check.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: PR keyword check -on: - workflow_dispatch: - -# This workflow deliberately does nothing of value. The branch rules require the associated "Check PR issue comments for trigger keywords" job to have run before the PR being merged -jobs: - pr-keyword-check: - runs-on: ubuntu-latest - steps: - - run: ls diff --git a/.yamato/_triggers.yml b/.yamato/_triggers.yml index 605b5883d2..818e3284c6 100644 --- a/.yamato/_triggers.yml +++ b/.yamato/_triggers.yml @@ -46,8 +46,9 @@ check_pr_issue_comments_for_trigger_keywords: name: Check PR for trigger comments of ngo or ignore. For example /ci ngo agent: - type: Unity::github::action - action_source: pr-keyword-check.yml + type: shell + commands: + - echo "This is a placeholder job. It exists only to gate PR merges based on issue comments" triggers: expression: |- pull_request.comment eq "ngo" OR From bfef80461f26248d3b6fa617f33f8bfb21b337d0 Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Tue, 2 Sep 2025 15:34:45 +0200 Subject: [PATCH 6/9] Updated PR trigger to not need comment trigger keyword --- .yamato/_triggers.yml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/.yamato/_triggers.yml b/.yamato/_triggers.yml index 818e3284c6..14645ed11e 100644 --- a/.yamato/_triggers.yml +++ b/.yamato/_triggers.yml @@ -40,20 +40,6 @@ #----------------------------------------------------------------------------------- -# Gates the merger of PRs as a pre-requisite. Runs when `/ci ngo` or `/ci ignore` is present as an issue comment -# Notice that I needed this job to do "something" and that's why there is a placeholder GitHub action used -# TODO: In the future we could have comment like "docs" or "project" to run a specific subset of tests -check_pr_issue_comments_for_trigger_keywords: - name: Check PR for trigger comments of ngo or ignore. For example /ci ngo - agent: - type: shell - commands: - - echo "This is a placeholder job. It exists only to gate PR merges based on issue comments" - triggers: - expression: |- - pull_request.comment eq "ngo" OR - pull_request.comment eq "ignore" - # Run all relevant tasks when a pull request targeting the develop or release branch is created or updated. # In order to have better coverage we run desktop standalone tests with different configurations which allows to mostly cover for different platforms, scripting backends and editor versions. @@ -82,9 +68,8 @@ pull_request_trigger: # TODO: consider setting up and running tests from Examples/ # TODO: or docs only changes are spelling/link check expression: |- - pull_request.comment eq "ngo" AND - (pull_request.changes.any match "com.unity.netcode.gameobjects/**" OR - pull_request.changes.any match "testproject/**") + pull_request.changes.any match "com.unity.netcode.gameobjects/**" OR + pull_request.changes.any match "testproject/**" cancel_old_ci: true # Run all tests on 6000.2 (latest supported editor) on nightly basis. From 58d8c52797d934d3f59e6de3893425fc88f97638 Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Tue, 2 Sep 2025 15:50:30 +0200 Subject: [PATCH 7/9] comment correction --- .yamato/_triggers.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.yamato/_triggers.yml b/.yamato/_triggers.yml index 14645ed11e..61b86407c0 100644 --- a/.yamato/_triggers.yml +++ b/.yamato/_triggers.yml @@ -15,8 +15,7 @@ # Focuses on critical validation paths that we should validate before merging PRs # Cancels previous runs on new commits # Excludes draft PRs - # Excludes running when changes ONLY touching documentation files - # Requires `/ci ngo` or `/ci ignore` comment to trigger the job. This was implemented and explained in https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/pull/3577 + # Excludes running when changes are not touching package or testproject code (e.g. docs only changes) # Nightly: # This test validates same subset as pull_request_trigger with addition of mobile/console tests and webgl builds From 5554c2a09d262e3fb80836bdf2559fd9730553dc Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Tue, 2 Sep 2025 16:12:00 +0200 Subject: [PATCH 8/9] Modify trigger to account for draft PRs and branches --- .yamato/_triggers.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.yamato/_triggers.yml b/.yamato/_triggers.yml index 61b86407c0..3713cb006c 100644 --- a/.yamato/_triggers.yml +++ b/.yamato/_triggers.yml @@ -67,8 +67,12 @@ pull_request_trigger: # TODO: consider setting up and running tests from Examples/ # TODO: or docs only changes are spelling/link check expression: |- - pull_request.changes.any match "com.unity.netcode.gameobjects/**" OR - pull_request.changes.any match "testproject/**" + (pull_request.target eq "develop" OR + pull_request.target eq "develop-2.0.0" OR + pull_request.target match "release/*") AND + NOT pull_request.draft AND + (pull_request.changes.any match "com.unity.netcode.gameobjects/**" OR + pull_request.changes.any match "testproject/**") cancel_old_ci: true # Run all tests on 6000.2 (latest supported editor) on nightly basis. From e114d8b29649a421f20d5dab3379bdeea0adce1e Mon Sep 17 00:00:00 2001 From: michal-chrobot Date: Tue, 2 Sep 2025 17:24:17 +0200 Subject: [PATCH 9/9] Added possibility of usage of /ci ngo --- .yamato/_triggers.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.yamato/_triggers.yml b/.yamato/_triggers.yml index 3713cb006c..d0585d925f 100644 --- a/.yamato/_triggers.yml +++ b/.yamato/_triggers.yml @@ -11,11 +11,13 @@ # TRIGGER PATTERNS------------------------------------------------------------------- # Pull Request: # This test validates Standards, Package tests, Project tests and Desktop standalone tests to ensure that main platforms are covered - # Triggers on PRs to develop, develop, and release branches - # Focuses on critical validation paths that we should validate before merging PRs - # Cancels previous runs on new commits - # Excludes draft PRs - # Excludes running when changes are not touching package or testproject code (e.g. docs only changes) + # Focuses on critical validation paths that we should validate before merging PRs. It also cancels previous runs on new commits + # By default it's triggered if + # 1) PR targets develop, develop-2.0.0 or release branches + # 2) PR is not a draft + # 3) PR changes files in package or testproject folders (doesn't run on for example DOCS only changes) + + # Note that in other cases you can trigger it by writing a comment "/ci ngo" in the PR thread # Nightly: # This test validates same subset as pull_request_trigger with addition of mobile/console tests and webgl builds @@ -67,12 +69,13 @@ pull_request_trigger: # TODO: consider setting up and running tests from Examples/ # TODO: or docs only changes are spelling/link check expression: |- - (pull_request.target eq "develop" OR + pull_request.comment eq "ngo" OR + ((pull_request.target eq "develop" OR pull_request.target eq "develop-2.0.0" OR pull_request.target match "release/*") AND NOT pull_request.draft AND (pull_request.changes.any match "com.unity.netcode.gameobjects/**" OR - pull_request.changes.any match "testproject/**") + pull_request.changes.any match "testproject/**")) cancel_old_ci: true # Run all tests on 6000.2 (latest supported editor) on nightly basis.