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 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